Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
f44bc89b
Commit
f44bc89b
authored
Jun 09, 2007
by
Vedran Rodic
Committed by
Alexandre Julliard
Jun 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm: Fix PlaySound so it doesn't block when another sound is already playing.
parent
86b40413
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
playsound.c
dlls/winmm/playsound.c
+10
-9
No files found.
dlls/winmm/playsound.c
View file @
f44bc89b
...
...
@@ -45,6 +45,7 @@ typedef struct tagWINE_PLAYSOUND
HMODULE
hMod
;
DWORD
fdwSound
;
HANDLE
hThread
;
HWAVEOUT
hWave
;
struct
tagWINE_PLAYSOUND
*
lpNext
;
}
WINE_PLAYSOUND
;
...
...
@@ -268,7 +269,6 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
MMCKINFO
ckMainRIFF
;
MMCKINFO
mmckInfo
;
LPWAVEFORMATEX
lpWaveFormat
=
NULL
;
HWAVEOUT
hWave
=
0
;
LPWAVEHDR
waveHdr
=
NULL
;
INT
count
,
bufsize
,
left
,
index
;
struct
playsound_data
s
;
...
...
@@ -367,7 +367,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
s
.
hEvent
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
if
(
waveOutOpen
(
&
hWave
,
WAVE_MAPPER
,
lpWaveFormat
,
(
DWORD
)
PlaySound_Callback
,
if
(
waveOutOpen
(
&
wps
->
hWave
,
WAVE_MAPPER
,
lpWaveFormat
,
(
DWORD
)
PlaySound_Callback
,
(
DWORD
)
&
s
,
CALLBACK_FUNCTION
)
!=
MMSYSERR_NOERROR
)
goto
errCleanUp
;
...
...
@@ -381,8 +381,8 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
waveHdr
[
0
].
dwLoops
=
waveHdr
[
1
].
dwLoops
=
0L
;
waveHdr
[
0
].
dwFlags
=
waveHdr
[
1
].
dwFlags
=
0L
;
waveHdr
[
0
].
dwBufferLength
=
waveHdr
[
1
].
dwBufferLength
=
bufsize
;
if
(
waveOutPrepareHeader
(
hWave
,
&
waveHdr
[
0
],
sizeof
(
WAVEHDR
))
||
waveOutPrepareHeader
(
hWave
,
&
waveHdr
[
1
],
sizeof
(
WAVEHDR
)))
{
if
(
waveOutPrepareHeader
(
wps
->
hWave
,
&
waveHdr
[
0
],
sizeof
(
WAVEHDR
))
||
waveOutPrepareHeader
(
wps
->
hWave
,
&
waveHdr
[
1
],
sizeof
(
WAVEHDR
)))
{
goto
errCleanUp
;
}
...
...
@@ -405,7 +405,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
left
-=
count
;
waveHdr
[
index
].
dwBufferLength
=
count
;
waveHdr
[
index
].
dwFlags
&=
~
WHDR_DONE
;
if
(
waveOutWrite
(
hWave
,
&
waveHdr
[
index
],
sizeof
(
WAVEHDR
))
==
MMSYSERR_NOERROR
)
{
if
(
waveOutWrite
(
wps
->
hWave
,
&
waveHdr
[
index
],
sizeof
(
WAVEHDR
))
==
MMSYSERR_NOERROR
)
{
index
^=
1
;
PlaySound_WaitDone
(
&
s
);
}
...
...
@@ -415,17 +415,17 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
}
while
(
wps
->
bLoop
);
PlaySound_WaitDone
(
&
s
);
/* for last buffer */
waveOutReset
(
hWave
);
waveOutReset
(
wps
->
hWave
);
waveOutUnprepareHeader
(
hWave
,
&
waveHdr
[
0
],
sizeof
(
WAVEHDR
));
waveOutUnprepareHeader
(
hWave
,
&
waveHdr
[
1
],
sizeof
(
WAVEHDR
));
waveOutUnprepareHeader
(
wps
->
hWave
,
&
waveHdr
[
0
],
sizeof
(
WAVEHDR
));
waveOutUnprepareHeader
(
wps
->
hWave
,
&
waveHdr
[
1
],
sizeof
(
WAVEHDR
));
errCleanUp:
TRACE
(
"Done playing=%s => %s!
\n
"
,
debugstr_w
(
wps
->
pszSound
),
bRet
?
"ok"
:
"ko"
);
CloseHandle
(
s
.
hEvent
);
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
);
HeapFree
(
GetProcessHeap
(),
0
,
lpWaveFormat
);
if
(
hWave
)
while
(
waveOutClose
(
hWave
)
==
WAVERR_STILLPLAYING
)
Sleep
(
100
);
if
(
wps
->
hWave
)
while
(
waveOutClose
(
wps
->
hWave
)
==
WAVERR_STILLPLAYING
)
Sleep
(
100
);
if
(
hmmio
)
mmioClose
(
hmmio
,
0
);
PlaySound_Free
(
wps
);
...
...
@@ -464,6 +464,7 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
* NULL... as of today, we stop all playing instances */
SetEvent
(
psStopEvent
);
waveOutReset
(
PlaySoundList
->
hWave
);
LeaveCriticalSection
(
&
WINMM_cs
);
WaitForSingleObject
(
psLastEvent
,
INFINITE
);
EnterCriticalSection
(
&
WINMM_cs
);
...
...
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