Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
197607db
Commit
197607db
authored
13 years ago
by
Jörg Höhle
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
winmm: Allow new sounds to interrupt previous PlaySound invocations.
parent
86de76b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/winmm/playsound.c
+20
-14
20 additions, 14 deletions
dlls/winmm/playsound.c
with
20 additions
and
14 deletions
dlls/winmm/playsound.c
+
20
−
14
View file @
197607db
...
...
@@ -44,10 +44,10 @@ typedef struct tagWINE_PLAYSOUND
LPCWSTR
pszSound
;
HMODULE
hMod
;
DWORD
fdwSound
;
struct
tagWINE_PLAYSOUND
*
lpNext
;
HWAVEOUT
hWave
;
}
WINE_PLAYSOUND
;
static
WINE_PLAYSOUND
*
PlaySound
Lis
t
;
static
WINE_PLAYSOUND
*
PlaySound
Curren
t
;
static
BOOL
bPlaySoundStop
;
static
HMMIO
get_mmioFromFile
(
LPCWSTR
lpszName
)
...
...
@@ -206,12 +206,9 @@ static BOOL PlaySound_IsString(DWORD fdwSound, const void* psz)
static
void
PlaySound_Free
(
WINE_PLAYSOUND
*
wps
)
{
WINE_PLAYSOUND
**
p
;
EnterCriticalSection
(
&
WINMM_cs
);
for
(
p
=
&
PlaySoundList
;
*
p
&&
*
p
!=
wps
;
p
=
&
((
*
p
)
->
lpNext
));
if
(
*
p
)
*
p
=
(
*
p
)
->
lpNext
;
if
(
PlaySoundList
==
NULL
)
SetEvent
(
psLastEvent
);
PlaySoundCurrent
=
NULL
;
SetEvent
(
psLastEvent
);
LeaveCriticalSection
(
&
WINMM_cs
);
if
(
wps
->
bAlloc
)
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
wps
->
pszSound
);
HeapFree
(
GetProcessHeap
(),
0
,
wps
);
...
...
@@ -399,7 +396,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
(
LPSTR
)
&
mmckInfo
.
ckid
,
mmckInfo
.
fccType
,
mmckInfo
.
cksize
);
s
.
hEvent
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
if
(
!
s
.
hEvent
)
if
(
!
s
.
hEvent
||
bPlaySoundStop
)
goto
errCleanUp
;
if
(
waveOutOpen
(
&
hWave
,
WAVE_MAPPER
,
lpWaveFormat
,
(
DWORD_PTR
)
PlaySound_Callback
,
...
...
@@ -423,6 +420,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
goto
errCleanUp
;
}
wps
->
hWave
=
hWave
;
s
.
dwEventCount
=
1L
;
/* for first buffer */
index
=
0
;
...
...
@@ -434,7 +432,6 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
{
if
(
bPlaySoundStop
)
{
waveOutReset
(
hWave
);
wps
->
bLoop
=
FALSE
;
break
;
}
...
...
@@ -464,7 +461,15 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
errCleanUp:
TRACE
(
"Done playing=%s => %s!
\n
"
,
debugstr_w
(
wps
->
pszSound
),
bRet
?
"ok"
:
"ko"
);
HeapFree
(
GetProcessHeap
(),
0
,
lpWaveFormat
);
if
(
hWave
)
while
(
waveOutClose
(
hWave
)
==
WAVERR_STILLPLAYING
)
Sleep
(
100
);
if
(
hWave
)
{
EnterCriticalSection
(
&
WINMM_cs
);
/* the CS prevents a concurrent waveOutReset */
wps
->
hWave
=
0
;
LeaveCriticalSection
(
&
WINMM_cs
);
while
(
waveOutClose
(
hWave
)
==
WAVERR_STILLPLAYING
)
Sleep
(
100
);
}
CloseHandle
(
s
.
hEvent
);
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
);
if
(
hmmio
)
mmioClose
(
hmmio
,
0
);
...
...
@@ -482,7 +487,7 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
pszSound
,
hmod
,
fdwSound
);
/* SND_NOWAIT is ignored in w95/2k/xp. */
if
((
fdwSound
&
SND_NOSTOP
)
&&
PlaySound
Lis
t
!=
NULL
)
if
((
fdwSound
&
SND_NOSTOP
)
&&
PlaySound
Curren
t
!=
NULL
)
return
FALSE
;
/* alloc internal structure, if we need to play something */
...
...
@@ -496,12 +501,14 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
/* since several threads can enter PlaySound in parallel, we're not
* sure, at this point, that another thread didn't start a new playsound
*/
while
(
PlaySound
Lis
t
!=
NULL
)
while
(
PlaySound
Curren
t
!=
NULL
)
{
ResetEvent
(
psLastEvent
);
/* FIXME: doc says we have to stop all instances of pszSound if it's non
* NULL... as of today, we stop all playing instances */
bPlaySoundStop
=
TRUE
;
if
(
PlaySoundCurrent
->
hWave
)
waveOutReset
(
PlaySoundCurrent
->
hWave
);
LeaveCriticalSection
(
&
WINMM_cs
);
WaitForSingleObject
(
psLastEvent
,
INFINITE
);
...
...
@@ -510,8 +517,7 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
bPlaySoundStop
=
FALSE
;
}
if
(
wps
)
wps
->
lpNext
=
PlaySoundList
;
PlaySoundList
=
wps
;
PlaySoundCurrent
=
wps
;
LeaveCriticalSection
(
&
WINMM_cs
);
if
(
!
wps
)
return
TRUE
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment