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
29d6fbc3
Commit
29d6fbc3
authored
Apr 27, 2011
by
Andrew Eikum
Committed by
Alexandre Julliard
Apr 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi/tests: Add tests for IAudioClock.
parent
d4c0bedd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
129 additions
and
0 deletions
+129
-0
render.c
dlls/mmdevapi/tests/render.c
+129
-0
No files found.
dlls/mmdevapi/tests/render.c
View file @
29d6fbc3
...
...
@@ -476,6 +476,134 @@ static void test_padding(void)
IAudioClient_Release
(
ac
);
}
static
void
test_clock
(
void
)
{
HRESULT
hr
;
IAudioClient
*
ac
;
IAudioClock
*
acl
;
IAudioRenderClient
*
arc
;
UINT64
freq
,
pos
,
pcpos
,
last
;
BYTE
*
data
;
WAVEFORMATEX
*
pwfx
;
hr
=
IMMDevice_Activate
(
dev
,
&
IID_IAudioClient
,
CLSCTX_INPROC_SERVER
,
NULL
,
(
void
**
)
&
ac
);
ok
(
hr
==
S_OK
,
"Activation failed with %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IAudioClient_GetMixFormat
(
ac
,
&
pwfx
);
ok
(
hr
==
S_OK
,
"GetMixFormat failed: %08x
\n
"
,
hr
);
if
(
hr
!=
S_OK
)
return
;
hr
=
IAudioClient_Initialize
(
ac
,
AUDCLNT_SHAREMODE_SHARED
,
0
,
5000000
,
0
,
pwfx
,
NULL
);
ok
(
hr
==
S_OK
,
"Initialize failed: %08x
\n
"
,
hr
);
hr
=
IAudioClient_GetService
(
ac
,
&
IID_IAudioClock
,
(
void
**
)
&
acl
);
ok
(
hr
==
S_OK
,
"GetService(IAudioClock) failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetFrequency
(
acl
,
&
freq
);
ok
(
hr
==
S_OK
,
"GetFrequency failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"GetPosition wrong error: %08x
\n
"
,
hr
);
pcpos
=
0
;
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
&
pcpos
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
==
0
,
"GetPosition returned non-zero pos before being started
\n
"
);
ok
(
pcpos
!=
0
,
"GetPosition returned zero pcpos
\n
"
);
last
=
pos
;
hr
=
IAudioClient_GetService
(
ac
,
&
IID_IAudioRenderClient
,
(
void
**
)
&
arc
);
ok
(
hr
==
S_OK
,
"GetService(IAudioRenderClient) failed: %08x
\n
"
,
hr
);
hr
=
IAudioRenderClient_GetBuffer
(
arc
,
pwfx
->
nSamplesPerSec
/
2
.,
&
data
);
ok
(
hr
==
S_OK
,
"GetBuffer failed: %08x
\n
"
,
hr
);
hr
=
IAudioRenderClient_ReleaseBuffer
(
arc
,
pwfx
->
nSamplesPerSec
/
2
.,
AUDCLNT_BUFFERFLAGS_SILENT
);
ok
(
hr
==
S_OK
,
"ReleaseBuffer failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
==
0
,
"GetPosition returned non-zero pos before being started
\n
"
);
hr
=
IAudioClient_Start
(
ac
);
ok
(
hr
==
S_OK
,
"Start failed: %08x
\n
"
,
hr
);
Sleep
(
100
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
>
0
,
"Position should have been further along...
\n
"
);
last
=
pos
;
hr
=
IAudioClient_Stop
(
ac
);
ok
(
hr
==
S_OK
,
"Stop failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
>=
last
,
"Position should have been further along...
\n
"
);
last
=
pos
;
hr
=
IAudioClient_Start
(
ac
);
ok
(
hr
==
S_OK
,
"Start failed: %08x
\n
"
,
hr
);
Sleep
(
100
);
hr
=
IAudioClient_Stop
(
ac
);
ok
(
hr
==
S_OK
,
"Stop failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
>=
last
,
"Position should have been further along...
\n
"
);
last
=
pos
;
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
==
last
,
"Position should have been further along...
\n
"
);
hr
=
IAudioClient_Reset
(
ac
);
ok
(
hr
==
S_OK
,
"Reset failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
==
0
,
"GetPosition returned non-zero pos after Reset
\n
"
);
last
=
pos
;
hr
=
IAudioRenderClient_GetBuffer
(
arc
,
pwfx
->
nSamplesPerSec
/
2
.,
&
data
);
ok
(
hr
==
S_OK
,
"GetBuffer failed: %08x
\n
"
,
hr
);
hr
=
IAudioRenderClient_ReleaseBuffer
(
arc
,
pwfx
->
nSamplesPerSec
/
2
.,
AUDCLNT_BUFFERFLAGS_SILENT
);
ok
(
hr
==
S_OK
,
"ReleaseBuffer failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
==
0
,
"GetPosition returned non-zero pos after Reset
\n
"
);
last
=
pos
;
hr
=
IAudioClient_Start
(
ac
);
ok
(
hr
==
S_OK
,
"Start failed: %08x
\n
"
,
hr
);
Sleep
(
100
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
>
last
,
"Position should have been further along...
\n
"
);
hr
=
IAudioClient_Stop
(
ac
);
ok
(
hr
==
S_OK
,
"Stop failed: %08x
\n
"
,
hr
);
hr
=
IAudioClock_GetPosition
(
acl
,
&
pos
,
NULL
);
ok
(
hr
==
S_OK
,
"GetPosition failed: %08x
\n
"
,
hr
);
ok
(
pos
>=
last
,
"Position should have been further along...
\n
"
);
IAudioClock_Release
(
acl
);
IAudioClient_Release
(
ac
);
}
START_TEST
(
render
)
{
HRESULT
hr
;
...
...
@@ -504,6 +632,7 @@ START_TEST(render)
test_references
();
test_event
();
test_padding
();
test_clock
();
IMMDevice_Release
(
dev
);
...
...
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