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
70fe39e4
Commit
70fe39e4
authored
May 09, 2005
by
Robert Reif
Committed by
Alexandre Julliard
May 09, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dead code and redundant variables from DSOUND_CalcPlayPosition
and callers.
parent
86f63cfe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
43 deletions
+13
-43
buffer.c
dlls/dsound/buffer.c
+9
-33
dsound_private.h
dlls/dsound/dsound_private.h
+1
-2
mixer.c
dlls/dsound/mixer.c
+3
-8
No files found.
dlls/dsound/buffer.c
View file @
70fe39e4
...
...
@@ -394,27 +394,15 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
return
ref
;
}
DWORD
DSOUND_CalcPlayPosition
(
IDirectSoundBufferImpl
*
This
,
DWORD
state
,
DWORD
pplay
,
DWORD
pwrite
,
DWORD
pmix
,
DWORD
bmix
)
DWORD
DSOUND_CalcPlayPosition
(
IDirectSoundBufferImpl
*
This
,
DWORD
pplay
,
DWORD
pwrite
)
{
DWORD
bplay
;
TRACE
(
"primary playpos=%ld, mixpos=%ld
\n
"
,
pplay
,
pmix
);
TRACE
(
"this mixpos=%ld, time=%ld
\n
"
,
bmix
,
GetTickCount
());
DWORD
bplay
=
This
->
buf_mixpos
;
DWORD
pmix
=
This
->
primary_mixpos
;
TRACE
(
"(%p, pplay=%lu, pwrite=%lu)
\n
"
,
This
,
pplay
,
pwrite
);
/* the actual primary play position (pplay) is always behind last mixed (pmix),
* unless the computer is too slow or something */
/* we need to know how far away we are from there */
#if 0 /* we'll never fill the primary entirely */
if (pmix == pplay) {
if ((state == STATE_PLAYING) || (state == STATE_STOPPING)) {
/* wow, the software mixer is really doing well,
* seems the entire primary buffer is filled! */
pmix += This->dsound->buflen;
}
/* else: the primary buffer is not playing, so probably empty */
}
#endif
if
(
pmix
<
pplay
)
pmix
+=
This
->
dsound
->
buflen
;
/* wraparound */
pmix
-=
pplay
;
/* detect buffer underrun */
...
...
@@ -433,10 +421,9 @@ DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This,
pmix
*=
This
->
pwfx
->
nBlockAlign
;
TRACE
(
"this back-offset=%ld
\n
"
,
pmix
);
/* subtract from our last mixed position */
bplay
=
bmix
;
while
(
bplay
<
pmix
)
bplay
+=
This
->
buflen
;
/* wraparound */
bplay
-=
pmix
;
if
(
This
->
leadin
&&
((
bplay
<
This
->
startpos
)
||
(
bplay
>
bmix
)))
{
if
(
This
->
leadin
&&
((
bplay
<
This
->
startpos
)
||
(
bplay
>
This
->
buf_mixpos
)))
{
/* seems we haven't started playing yet */
TRACE
(
"this still in lead-in phase
\n
"
);
bplay
=
This
->
startpos
;
...
...
@@ -462,28 +449,17 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(
/* we haven't been merged into the primary buffer (yet) */
*
playpos
=
This
->
buf_mixpos
;
}
else
if
(
playpos
)
{
DWORD
pplay
,
pwrite
,
lplay
,
splay
,
pstate
;
DWORD
pplay
,
pwrite
;
/* let's get this exact; first, recursively call GetPosition on the primary */
EnterCriticalSection
(
&
(
This
->
dsound
->
mixlock
));
if
(
DSOUND_PrimaryGetPosition
(
This
->
dsound
,
&
pplay
,
&
pwrite
)
!=
DS_OK
)
WARN
(
"DSOUND_PrimaryGetPosition failed
\n
"
);
/* detect HEL mode underrun */
pstate
=
This
->
dsound
->
state
;
if
(
!
(
This
->
dsound
->
hwbuf
||
This
->
dsound
->
pwqueue
))
{
if
(
!
(
This
->
dsound
->
hwbuf
||
This
->
dsound
->
pwqueue
))
TRACE
(
"detected an underrun
\n
"
);
/* pplay = ? */
if
(
pstate
==
STATE_PLAYING
)
pstate
=
STATE_STARTING
;
else
if
(
pstate
==
STATE_STOPPING
)
pstate
=
STATE_STOPPED
;
}
/* get data for ourselves while we still have the lock */
pstate
&=
This
->
state
;
lplay
=
This
->
primary_mixpos
;
splay
=
This
->
buf_mixpos
;
if
((
This
->
dsbd
.
dwFlags
&
DSBCAPS_GETCURRENTPOSITION2
)
||
This
->
dsound
->
hwbuf
)
{
/* calculate play position using this */
*
playpos
=
DSOUND_CalcPlayPosition
(
This
,
p
state
,
pplay
,
pwrite
,
lplay
,
splay
);
*
playpos
=
DSOUND_CalcPlayPosition
(
This
,
p
play
,
pwrite
);
}
else
{
/* (unless the app isn't using GETCURRENTPOSITION2) */
/* don't know exactly how this should be handled...
...
...
@@ -493,7 +469,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetCurrentPosition(
DWORD
wp
;
wp
=
(
This
->
dsound
->
pwplay
+
ds_hel_margin
)
*
This
->
dsound
->
fraglen
;
wp
%=
This
->
dsound
->
buflen
;
*
playpos
=
DSOUND_CalcPlayPosition
(
This
,
pstate
,
wp
,
pwrite
,
lplay
,
splay
);
*
playpos
=
DSOUND_CalcPlayPosition
(
This
,
wp
,
pwrite
);
}
LeaveCriticalSection
(
&
(
This
->
dsound
->
mixlock
));
}
...
...
dlls/dsound/dsound_private.h
View file @
70fe39e4
...
...
@@ -469,8 +469,7 @@ HRESULT DSOUND_PrimaryGetPosition(IDirectSoundImpl *This, LPDWORD playpos, LPDWO
/* buffer.c */
DWORD
DSOUND_CalcPlayPosition
(
IDirectSoundBufferImpl
*
This
,
DWORD
state
,
DWORD
pplay
,
DWORD
pwrite
,
DWORD
pmix
,
DWORD
bmix
);
DWORD
DSOUND_CalcPlayPosition
(
IDirectSoundBufferImpl
*
This
,
DWORD
pplay
,
DWORD
pwrite
);
/* mixer.c */
...
...
dlls/dsound/mixer.c
View file @
70fe39e4
...
...
@@ -657,13 +657,8 @@ void DSOUND_ForceRemix(IDirectSoundBufferImpl *dsb)
{
TRACE
(
"(%p)
\n
"
,
dsb
);
EnterCriticalSection
(
&
dsb
->
lock
);
if
(
dsb
->
state
==
STATE_PLAYING
)
{
#if 0 /* this may not be quite reliable yet */
dsb->need_remix = TRUE;
#else
if
(
dsb
->
state
==
STATE_PLAYING
)
dsb
->
dsound
->
need_remix
=
TRUE
;
#endif
}
LeaveCriticalSection
(
&
dsb
->
lock
);
}
...
...
@@ -671,8 +666,7 @@ static DWORD DSOUND_MixOne(IDirectSoundBufferImpl *dsb, DWORD playpos, DWORD wri
{
DWORD
len
,
slen
;
/* determine this buffer's write position */
DWORD
buf_writepos
=
DSOUND_CalcPlayPosition
(
dsb
,
dsb
->
state
&
dsb
->
dsound
->
state
,
writepos
,
writepos
,
dsb
->
primary_mixpos
,
dsb
->
buf_mixpos
);
DWORD
buf_writepos
=
DSOUND_CalcPlayPosition
(
dsb
,
writepos
,
writepos
);
/* determine how much already-mixed data exists */
DWORD
buf_done
=
((
dsb
->
buf_mixpos
<
buf_writepos
)
?
dsb
->
buflen
:
0
)
+
...
...
@@ -805,6 +799,7 @@ post_mix:
dsb
->
last_playpos
=
0
;
dsb
->
buf_mixpos
=
0
;
dsb
->
leadin
=
FALSE
;
dsb
->
need_remix
=
FALSE
;
DSOUND_CheckEvent
(
dsb
,
buf_left
);
}
...
...
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