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
5b0914ec
Commit
5b0914ec
authored
May 17, 2016
by
Maarten Lankhorst
Committed by
Alexandre Julliard
May 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Remove state machine from render buffer.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2fb97be1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
96 deletions
+8
-96
dsound.c
dlls/dsound/dsound.c
+1
-1
dsound_private.h
dlls/dsound/dsound_private.h
+1
-1
mixer.c
dlls/dsound/mixer.c
+1
-35
primary.c
dlls/dsound/primary.c
+5
-59
No files found.
dlls/dsound/dsound.c
View file @
5b0914ec
...
...
@@ -135,7 +135,7 @@ static HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
device
->
ref
=
1
;
device
->
priolevel
=
DSSCL_NORMAL
;
device
->
st
ate
=
STATE_STOPPED
;
device
->
st
opped
=
1
;
device
->
speaker_config
=
DSSPEAKER_COMBINED
(
DSSPEAKER_STEREO
,
DSSPEAKER_GEOMETRY_WIDE
);
DSOUND_ParseSpeakerConfig
(
device
);
...
...
dlls/dsound/dsound_private.h
View file @
5b0914ec
...
...
@@ -76,7 +76,7 @@ struct DirectSoundDevice
DWORD
priolevel
,
sleeptime
;
PWAVEFORMATEX
pwfx
,
primary_pwfx
;
LPBYTE
buffer
;
DWORD
writelead
,
buflen
,
aclen
,
fraglen
,
state
,
playpos
,
pa
d
;
DWORD
writelead
,
buflen
,
aclen
,
fraglen
,
playpos
,
pad
,
stoppe
d
;
int
nrofbuffers
;
IDirectSoundBufferImpl
**
buffers
;
RTL_RWLOCK
buffer_list_lock
;
...
...
dlls/dsound/mixer.c
View file @
5b0914ec
...
...
@@ -694,10 +694,6 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
* also wipe out just-played sound data */
if
(
!
pad
)
WARN
(
"Probable buffer underrun
\n
"
);
else
if
(
device
->
state
==
STATE_STOPPED
||
device
->
state
==
STATE_STARTING
)
{
TRACE
(
"Buffer restarting
\n
"
);
}
hr
=
IAudioRenderClient_GetBuffer
(
device
->
render
,
maxq
/
block
,
(
void
*
)
&
buffer
);
if
(
FAILED
(
hr
)){
...
...
@@ -724,23 +720,7 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
ERR
(
"ReleaseBuffer failed: %08x
\n
"
,
hr
);
device
->
pad
+=
maxq
;
if
(
maxq
)
{
if
(
device
->
state
==
STATE_STARTING
||
device
->
state
==
STATE_STOPPED
)
{
if
(
DSOUND_PrimaryPlay
(
device
)
!=
DS_OK
)
WARN
(
"DSOUND_PrimaryPlay failed
\n
"
);
else
if
(
device
->
state
==
STATE_STARTING
)
device
->
state
=
STATE_PLAYING
;
else
device
->
state
=
STATE_STOPPING
;
}
}
else
if
(
!
pad
&&
!
maxq
&&
(
all_stopped
==
TRUE
)
&&
(
device
->
state
==
STATE_STOPPING
))
{
device
->
state
=
STATE_STOPPED
;
DSOUND_PrimaryStop
(
device
);
}
}
else
if
(
device
->
state
!=
STATE_STOPPED
)
{
}
else
if
(
!
device
->
stopped
)
{
if
(
maxq
>
device
->
buflen
)
maxq
=
device
->
buflen
;
if
(
writepos
+
maxq
>
device
->
buflen
)
{
...
...
@@ -748,20 +728,6 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
DSOUND_WaveQueue
(
device
,
device
->
buffer
,
writepos
+
maxq
-
device
->
buflen
);
}
else
DSOUND_WaveQueue
(
device
,
device
->
buffer
+
writepos
,
maxq
);
/* in the DSSCL_WRITEPRIMARY mode, the app is totally in charge... */
if
(
device
->
state
==
STATE_STARTING
)
{
if
(
DSOUND_PrimaryPlay
(
device
)
!=
DS_OK
)
WARN
(
"DSOUND_PrimaryPlay failed
\n
"
);
else
device
->
state
=
STATE_PLAYING
;
}
else
if
(
device
->
state
==
STATE_STOPPING
)
{
if
(
DSOUND_PrimaryStop
(
device
)
!=
DS_OK
)
WARN
(
"DSOUND_PrimaryStop failed
\n
"
);
else
device
->
state
=
STATE_STOPPED
;
}
}
LeaveCriticalSection
(
&
(
device
->
mixlock
));
...
...
dlls/dsound/primary.c
View file @
5b0914ec
...
...
@@ -272,11 +272,6 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device, WAVEFORMATEX *wfx,
HeapFree
(
GetProcessHeap
(),
0
,
device
->
pwfx
);
device
->
pwfx
=
wfx
;
if
(
device
->
state
==
STATE_PLAYING
)
device
->
state
=
STATE_STARTING
;
else
if
(
device
->
state
==
STATE_STOPPING
)
device
->
state
=
STATE_STOPPED
;
device
->
writelead
=
(
wfx
->
nSamplesPerSec
/
100
)
*
wfx
->
nBlockAlign
;
TRACE
(
"buflen: %u, fraglen: %u
\n
"
,
device
->
buflen
,
device
->
fraglen
);
...
...
@@ -384,7 +379,7 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
return
S_OK
;
err_service:
ERR
(
"GetService failed: %08x
\n
"
,
hres
);
WARN
(
"GetService failed: %08x
\n
"
,
hres
);
err:
device
->
speaker_config
=
oldspeakerconfig
;
DSOUND_ParseSpeakerConfig
(
device
);
...
...
@@ -421,36 +416,6 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
return
DS_OK
;
}
HRESULT
DSOUND_PrimaryPlay
(
DirectSoundDevice
*
device
)
{
HRESULT
hr
;
TRACE
(
"(%p)
\n
"
,
device
);
hr
=
IAudioClient_Start
(
device
->
client
);
if
(
FAILED
(
hr
)
&&
hr
!=
AUDCLNT_E_NOT_STOPPED
){
WARN
(
"Start failed: %08x
\n
"
,
hr
);
return
hr
;
}
return
DS_OK
;
}
HRESULT
DSOUND_PrimaryStop
(
DirectSoundDevice
*
device
)
{
HRESULT
hr
;
TRACE
(
"(%p)
\n
"
,
device
);
hr
=
IAudioClient_Stop
(
device
->
client
);
if
(
FAILED
(
hr
)){
WARN
(
"Stop failed: %08x
\n
"
,
hr
);
return
hr
;
}
return
DS_OK
;
}
WAVEFORMATEX
*
DSOUND_CopyFormat
(
const
WAVEFORMATEX
*
wfex
)
{
WAVEFORMATEX
*
pwfx
;
...
...
@@ -698,16 +663,7 @@ static HRESULT WINAPI PrimaryBufferImpl_Play(IDirectSoundBuffer *iface, DWORD re
return
DSERR_INVALIDPARAM
;
}
/* **** */
EnterCriticalSection
(
&
(
device
->
mixlock
));
if
(
device
->
state
==
STATE_STOPPED
)
device
->
state
=
STATE_STARTING
;
else
if
(
device
->
state
==
STATE_STOPPING
)
device
->
state
=
STATE_PLAYING
;
LeaveCriticalSection
(
&
(
device
->
mixlock
));
/* **** */
device
->
stopped
=
0
;
return
DS_OK
;
}
...
...
@@ -718,16 +674,7 @@ static HRESULT WINAPI PrimaryBufferImpl_Stop(IDirectSoundBuffer *iface)
DirectSoundDevice
*
device
=
This
->
device
;
TRACE
(
"(%p)
\n
"
,
iface
);
/* **** */
EnterCriticalSection
(
&
(
device
->
mixlock
));
if
(
device
->
state
==
STATE_PLAYING
)
device
->
state
=
STATE_STOPPING
;
else
if
(
device
->
state
==
STATE_STARTING
)
device
->
state
=
STATE_STOPPED
;
LeaveCriticalSection
(
&
(
device
->
mixlock
));
/* **** */
device
->
stopped
=
1
;
return
DS_OK
;
}
...
...
@@ -795,7 +742,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetCurrentPosition(IDirectSoundBuffer *i
*
playpos
=
mixpos
;
if
(
writepos
)
{
*
writepos
=
mixpos
;
if
(
device
->
state
!=
STATE_STOPPED
)
{
if
(
!
device
->
stopped
)
{
/* apply the documented 10ms lead to writepos */
*
writepos
+=
device
->
writelead
;
*
writepos
%=
device
->
buflen
;
...
...
@@ -821,8 +768,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetStatus(IDirectSoundBuffer *iface, DWO
}
*
status
=
0
;
if
((
device
->
state
==
STATE_STARTING
)
||
(
device
->
state
==
STATE_PLAYING
))
if
(
!
device
->
stopped
)
*
status
|=
DSBSTATUS_PLAYING
|
DSBSTATUS_LOOPING
;
TRACE
(
"status=%x
\n
"
,
*
status
);
...
...
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