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
8366165e
Commit
8366165e
authored
Sep 28, 2015
by
Andrew Eikum
Committed by
Alexandre Julliard
Oct 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xaudio2: Call OnStreamEnd callback.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
parent
b28b4cc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
xaudio2.c
dlls/xaudio2_7/tests/xaudio2.c
+39
-2
xaudio_dll.c
dlls/xaudio2_7/xaudio_dll.c
+5
-0
No files found.
dlls/xaudio2_7/tests/xaudio2.c
View file @
8366165e
...
...
@@ -374,9 +374,11 @@ static const IXAudio2VoiceCallbackVtbl vcb_buf_vtbl = {
static
IXAudio2VoiceCallback
vcb_buf
=
{
&
vcb_buf_vtbl
};
static
int
nloopends
=
0
;
static
int
nstreamends
=
0
;
static
void
WINAPI
loop_buf_OnStreamEnd
(
IXAudio2VoiceCallback
*
This
)
{
++
nstreamends
;
}
static
void
WINAPI
loop_buf_OnBufferStart
(
IXAudio2VoiceCallback
*
This
,
...
...
@@ -421,7 +423,7 @@ static void test_buffer_callbacks(IXAudio2 *xa)
XAUDIO2_BUFFER
buf
;
XAUDIO2_VOICE_STATE
state
;
struct
vcb_buf_testdata
testdata
[
5
];
int
i
;
int
i
,
timeout
;
obs_calls
=
0
;
obe_calls
=
0
;
...
...
@@ -434,6 +436,7 @@ static void test_buffer_callbacks(IXAudio2 *xa)
hr
=
IXAudio2_CreateMasteringVoice
(
xa
,
&
master
,
2
,
44100
,
0
,
NULL
,
NULL
,
AudioCategory_GameEffects
);
ok
(
hr
==
S_OK
,
"CreateMasteringVoice failed: %08x
\n
"
,
hr
);
/* test OnBufferStart/End callbacks */
fmt
.
wFormatTag
=
WAVE_FORMAT_IEEE_FLOAT
;
fmt
.
nChannels
=
2
;
fmt
.
nSamplesPerSec
=
44100
;
...
...
@@ -487,14 +490,48 @@ static void test_buffer_callbacks(IXAudio2 *xa)
ok
(
state
.
SamplesPlayed
==
4410
*
5
,
"Got wrong samples played
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
buf
.
pAudioData
);
if
(
xaudio27
)
IXAudio27SourceVoice_DestroyVoice
((
IXAudio27SourceVoice
*
)
src
);
else
IXAudio2SourceVoice_DestroyVoice
(
src
);
/* test OnStreamEnd callback */
XA2CALL
(
CreateSourceVoice
,
&
src
,
&
fmt
,
0
,
1
.
f
,
&
loop_buf
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"CreateSourceVoice failed: %08x
\n
"
,
hr
);
buf
.
Flags
=
XAUDIO2_END_OF_STREAM
;
hr
=
IXAudio2SourceVoice_SubmitSourceBuffer
(
src
,
&
buf
,
NULL
);
ok
(
hr
==
S_OK
,
"SubmitSourceBuffer failed: %08x
\n
"
,
hr
);
hr
=
IXAudio2SourceVoice_Start
(
src
,
0
,
XAUDIO2_COMMIT_NOW
);
ok
(
hr
==
S_OK
,
"Start failed: %08x
\n
"
,
hr
);
timeout
=
0
;
while
(
nstreamends
==
0
&&
timeout
<
1000
){
Sleep
(
100
);
timeout
+=
100
;
}
ok
(
nstreamends
==
1
,
"Got wrong number of OnStreamEnd calls: %u
\n
"
,
nstreamends
);
/* xaudio resets SamplesPlayed after processing an end-of-stream buffer */
if
(
xaudio27
)
IXAudio27SourceVoice_GetState
((
IXAudio27SourceVoice
*
)
src
,
&
state
);
else
IXAudio2SourceVoice_GetState
(
src
,
&
state
,
0
);
ok
(
state
.
SamplesPlayed
==
0
,
"Got wrong samples played
\n
"
);
if
(
xaudio27
)
IXAudio27SourceVoice_DestroyVoice
((
IXAudio27SourceVoice
*
)
src
);
else
IXAudio2SourceVoice_DestroyVoice
(
src
);
IXAudio2MasteringVoice_DestroyVoice
(
master
);
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
buf
.
pAudioData
);
}
static
UINT32
play_to_completion
(
IXAudio2SourceVoice
*
src
,
UINT32
max_samples
)
...
...
dlls/xaudio2_7/xaudio_dll.c
View file @
8366165e
...
...
@@ -3092,9 +3092,14 @@ static void update_source_state(XA2SourceImpl *src)
TRACE
(
"%p: done with buffer %u
\n
"
,
src
,
old_buf
);
if
(
src
->
buffers
[
old_buf
].
xa2buffer
.
Flags
&
XAUDIO2_END_OF_STREAM
)
src
->
played_frames
=
0
;
if
(
src
->
cb
){
IXAudio2VoiceCallback_OnBufferEnd
(
src
->
cb
,
src
->
buffers
[
old_buf
].
xa2buffer
.
pContext
);
if
(
src
->
buffers
[
old_buf
].
xa2buffer
.
Flags
&
XAUDIO2_END_OF_STREAM
)
IXAudio2VoiceCallback_OnStreamEnd
(
src
->
cb
);
if
(
src
->
nbufs
>
0
)
IXAudio2VoiceCallback_OnBufferStart
(
src
->
cb
,
...
...
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