Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
d65ae3ff
Commit
d65ae3ff
authored
Sep 06, 2007
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Sep 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Support arbitrarily sized buffers for waveout.
parent
0c4ec8a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
mixer.c
dlls/dsound/mixer.c
+17
-11
primary.c
dlls/dsound/primary.c
+5
-9
No files found.
dlls/dsound/mixer.c
View file @
d65ae3ff
...
...
@@ -802,18 +802,24 @@ static void DSOUND_WaveQueue(DirectSoundDevice *device, BOOL force)
TRACE
(
"wave_fragpos = %i, wave_writepos = %i, pwqueue = %i, prebuf = %i
\n
"
,
wave_fragpos
,
wave_writepos
,
device
->
pwqueue
,
device
->
prebuf
);
if
(
force
==
FALSE
){
if
(
!
force
)
{
/* check remaining prebuffered frags */
prebuf_frags
=
DSOUND_BufPtrDiff
(
device
->
buflen
,
device
->
mixpos
,
wave_writepos
);
prebuf_frags
=
prebuf_frags
/
device
->
fraglen
;
prebuf_frags
=
device
->
mixpos
/
device
->
fraglen
;
if
(
prebuf_frags
==
device
->
helfrags
)
--
prebuf_frags
;
TRACE
(
"wave_fragpos = %d, mixpos_frags = %d
\n
"
,
wave_fragpos
,
prebuf_frags
);
if
(
prebuf_frags
<
wave_fragpos
)
prebuf_frags
+=
device
->
helfrags
;
prebuf_frags
-=
wave_fragpos
;
TRACE
(
"wanted prebuf_frags = %d
\n
"
,
prebuf_frags
);
}
else
{
else
/* buffer the maximum amount of frags */
prebuf_frags
=
device
->
prebuf
;
}
/* limit to the queue we have left */
if
((
prebuf_frags
+
device
->
pwqueue
)
>
device
->
prebuf
)
if
((
prebuf_frags
+
device
->
pwqueue
)
>
device
->
prebuf
)
prebuf_frags
=
device
->
prebuf
-
device
->
pwqueue
;
TRACE
(
"prebuf_frags = %i
\n
"
,
prebuf_frags
);
...
...
@@ -846,7 +852,6 @@ static void DSOUND_WaveQueue(DirectSoundDevice *device, BOOL force)
*/
static
void
DSOUND_PerformMix
(
DirectSoundDevice
*
device
)
{
TRACE
(
"(%p)
\n
"
,
device
);
/* **** */
...
...
@@ -907,6 +912,8 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
/* calc maximum prebuff */
prebuff_max
=
(
device
->
prebuf
*
device
->
fraglen
);
if
(
!
device
->
hwbuf
&&
playpos
+
prebuff_max
>=
device
->
helfrags
*
device
->
fraglen
)
prebuff_max
+=
device
->
buflen
-
device
->
helfrags
*
device
->
fraglen
;
/* check how close we are to an underrun. It occurs when the writepos overtakes the mixpos */
prebuff_left
=
DSOUND_BufPtrDiff
(
device
->
buflen
,
device
->
mixpos
,
playpos
);
...
...
@@ -964,9 +971,8 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
if
(
prebuff_left
>=
device
->
fraglen
){
/* update the wave queue if using wave system */
if
(
device
->
hwbuf
==
NULL
){
DSOUND_WaveQueue
(
device
,
TRUE
);
}
if
(
!
device
->
hwbuf
)
DSOUND_WaveQueue
(
device
,
FALSE
);
/* buffers are full. start playing if applicable */
if
(
device
->
state
==
STATE_STARTING
){
...
...
@@ -1005,7 +1011,7 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
}
else
{
/* update the wave queue if using wave system */
if
(
device
->
hwbuf
==
NULL
)
if
(
!
device
->
hwbuf
)
DSOUND_WaveQueue
(
device
,
TRUE
);
else
/* Keep alsa happy, which needs GetPosition called once every 10 ms */
...
...
dlls/dsound/primary.c
View file @
d65ae3ff
...
...
@@ -381,23 +381,19 @@ HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LP
return
err
;
}
}
else
{
TRACE
(
"pwplay=%i, pwqueue=%i
\n
"
,
device
->
pwplay
,
device
->
pwqueue
);
/* check if playpos was requested */
if
(
playpos
)
{
if
(
playpos
)
/* use the cached play position */
*
playpos
=
device
->
pwplay
*
device
->
fraglen
;
}
/* check if writepos was requested */
if
(
writepos
)
{
TRACE
(
"pwplay=%i, pwqueue=%i
\n
"
,
device
->
pwplay
,
device
->
pwqueue
);
if
(
writepos
)
/* the writepos is the first non-queued position */
*
writepos
=
(
device
->
pwplay
+
device
->
pwqueue
)
*
device
->
fraglen
;
*
writepos
%=
device
->
buflen
;
}
*
writepos
=
((
device
->
pwplay
+
device
->
pwqueue
)
%
device
->
helfrags
)
*
device
->
fraglen
;
}
TRACE
(
"playpos = %d, writepos = %d (%p, time=%d)
\n
"
,
playpos
?*
playpos
:
0
,
writepos
?*
writepos
:
0
,
device
,
GetTickCount
());
TRACE
(
"playpos = %d, writepos = %d (%p, time=%d)
\n
"
,
playpos
?*
playpos
:
-
1
,
writepos
?*
writepos
:-
1
,
device
,
GetTickCount
());
return
DS_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment