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
5f2f5188
Commit
5f2f5188
authored
Dec 05, 1999
by
Eric Pouech
Committed by
Alexandre Julliard
Dec 05, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tried to reduce echo in playSound API (using two wavehdr instead of
one).
parent
aa5f5a32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
28 deletions
+39
-28
mmsystem.c
dlls/winmm/mmsystem.c
+39
-28
No files found.
dlls/winmm/mmsystem.c
View file @
5f2f5188
...
...
@@ -259,11 +259,9 @@ static BOOL WINAPI proc_PlaySound(LPCSTR lpszSoundName, UINT uFlags)
MMCKINFO
mmckInfo
;
LPWAVEFORMATEX
lpWaveFormat
=
NULL
;
HWAVE
hWave
=
0
;
WAVEHDR
waveHdr
;
INT
count
,
bufsize
,
left
;
LPWAVEHDR
waveHdr
=
NULL
;
INT
count
,
bufsize
,
left
,
index
;
waveHdr
.
lpData
=
NULL
;
TRACE
(
"SoundName='%s' uFlags=%04X !
\n
"
,
lpszSoundName
,
uFlags
);
if
(
lpszSoundName
==
NULL
)
{
TRACE
(
"Stop !
\n
"
);
...
...
@@ -345,42 +343,55 @@ static BOOL WINAPI proc_PlaySound(LPCSTR lpszSoundName, UINT uFlags)
/* make it so that 3 buffers per second are needed */
bufsize
=
(((
lpWaveFormat
->
nAvgBytesPerSec
/
3
)
-
1
)
/
lpWaveFormat
->
nBlockAlign
+
1
)
*
lpWaveFormat
->
nBlockAlign
;
waveHdr
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
bufsize
);
waveHdr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
WAVEHDR
)
+
2
*
bufsize
);
waveHdr
[
0
].
lpData
=
(
char
*
)
waveHdr
+
2
*
sizeof
(
WAVEHDR
);
waveHdr
[
1
].
lpData
=
(
char
*
)
waveHdr
+
2
*
sizeof
(
WAVEHDR
)
+
bufsize
;
waveHdr
[
0
].
dwUser
=
waveHdr
[
1
].
dwUser
=
0L
;
do
{
waveHdr
.
dwUser
=
0L
;
waveHdr
.
dwFlags
=
0L
;
waveHdr
.
dwLoops
=
0L
;
index
=
0
;
left
=
mmckInfo
.
cksize
;
mmioSeek
(
hmmio
,
mmckInfo
.
dwDataOffset
,
SEEK_SET
);
while
(
left
)
{
waveHdr
.
dwBufferLength
=
bufsize
;
if
(
waveOutPrepareHeader
(
hWave
,
&
waveHdr
,
sizeof
(
WAVEHDR
))
==
MMSYSERR_NOERROR
)
{
if
(
PlaySound_Stop
)
{
PlaySound_Stop
=
FALSE
;
PlaySound_Loop
=
FALSE
;
break
;
}
if
(
bufsize
>
left
)
bufsize
=
left
;
count
=
mmioRead
(
hmmio
,
waveHdr
.
lpData
,
bufsize
);
if
(
PlaySound_Stop
)
{
PlaySound_Stop
=
PlaySound_Loop
=
FALSE
;
break
;
}
waveHdr
[
index
].
dwBufferLength
=
bufsize
;
waveHdr
[
index
].
dwFlags
=
0L
;
waveHdr
[
index
].
dwLoops
=
0L
;
if
(
waveOutPrepareHeader
(
hWave
,
&
waveHdr
[
index
],
sizeof
(
WAVEHDR
))
==
MMSYSERR_NOERROR
)
{
count
=
mmioRead
(
hmmio
,
waveHdr
[
index
].
lpData
,
MIN
(
bufsize
,
left
)
);
if
(
count
<
1
)
break
;
left
-=
count
;
waveHdr
.
dwBufferLength
=
count
;
/* waveHdr.dwBytesRecorded = count; */
waveHdr
[
index
].
dwBufferLength
=
count
;
/* FIXME: doesn't expect async ops */
waveOutWrite
(
hWave
,
&
waveHdr
,
sizeof
(
WAVEHDR
));
while
(
!
(
waveHdr
.
dwFlags
&
WHDR_DONE
))
waveOutWrite
(
hWave
,
&
waveHdr
[
index
],
sizeof
(
WAVEHDR
));
index
^=
1
;
}
else
{
WARN
(
"can't prepare WaveOut device !
\n
"
);
}
if
(
waveHdr
[
index
].
dwFlags
&
WHDR_PREPARED
)
{
/* test if waveHdr[index] has been prepared, if so it has been queued for playing */
while
(
!
(
waveHdr
[
index
].
dwFlags
&
WHDR_DONE
))
Sleep
(
10
);
waveOutUnprepareHeader
(
hWave
,
&
waveHdr
,
sizeof
(
WAVEHDR
));
waveOutUnprepareHeader
(
hWave
,
&
waveHdr
[
index
]
,
sizeof
(
WAVEHDR
));
bRet
=
TRUE
;
}
else
WARN
(
"can't prepare WaveOut device !
\n
"
);
}
}
}
while
(
PlaySound_Loop
);
index
^=
1
;
if
(
waveHdr
[
index
].
dwFlags
&
WHDR_PREPARED
)
{
/* test if waveHdr[index] has been prepared, if so it has been queued for playing */
while
(
!
(
waveHdr
[
index
].
dwFlags
&
WHDR_DONE
))
Sleep
(
10
);
waveOutUnprepareHeader
(
hWave
,
&
waveHdr
[
index
],
sizeof
(
WAVEHDR
));
bRet
=
TRUE
;
}
errCleanUp:
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
.
lpData
);
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
);
HeapFree
(
GetProcessHeap
(),
0
,
lpWaveFormat
);
if
(
hWave
)
while
(
waveOutClose
(
hWave
)
==
WAVERR_STILLPLAYING
)
Sleep
(
100
);
if
(
hmmio
)
mmioClose
(
hmmio
,
0
);
...
...
@@ -2754,7 +2765,7 @@ UINT WINAPI midiInStart(HMIDIIN hMidiIn)
{
LPWINE_MLD
wmld
;
TRACE
(
"(%04X
\n
"
,
hMidiIn
);
TRACE
(
"(%04X
)
\n
"
,
hMidiIn
);
if
((
wmld
=
MMDRV_Get
(
hMidiIn
,
MMDRV_MIDIIN
,
FALSE
))
==
NULL
)
return
MMSYSERR_INVALHANDLE
;
...
...
@@ -2777,7 +2788,7 @@ UINT WINAPI midiInStop(HMIDIIN hMidiIn)
{
LPWINE_MLD
wmld
;
TRACE
(
"(%04X
\n
"
,
hMidiIn
);
TRACE
(
"(%04X
)
\n
"
,
hMidiIn
);
if
((
wmld
=
MMDRV_Get
(
hMidiIn
,
MMDRV_MIDIIN
,
FALSE
))
==
NULL
)
return
MMSYSERR_INVALHANDLE
;
...
...
@@ -2800,7 +2811,7 @@ UINT WINAPI midiInReset(HMIDIIN hMidiIn)
{
LPWINE_MLD
wmld
;
TRACE
(
"(%04X
\n
"
,
hMidiIn
);
TRACE
(
"(%04X
)
\n
"
,
hMidiIn
);
if
((
wmld
=
MMDRV_Get
(
hMidiIn
,
MMDRV_MIDIIN
,
FALSE
))
==
NULL
)
return
MMSYSERR_INVALHANDLE
;
...
...
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