Maarten Lankhorst : dsound: Restore old speaker config after tests.
Alexandre Julliard
julliard at winehq.org
Fri Nov 20 10:48:03 CST 2009
Module: wine
Branch: master
Commit: b0cfbe81fa4611c2fce3b347db199348ef3ff009
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b0cfbe81fa4611c2fce3b347db199348ef3ff009
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Fri Nov 20 10:11:42 2009 +0100
dsound: Restore old speaker config after tests.
According to the documentation, only audio device vendors are allowed to
call this function, so make sure we properly restore the old speaker config.
---
dlls/dsound/tests/dsound.c | 13 ++++++++++---
dlls/dsound/tests/dsound8.c | 13 ++++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 114dbb6..f059c20 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -55,7 +55,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
IUnknown * unknown;
IDirectSound * ds;
IDirectSound8 * ds8;
- DWORD speaker_config, new_speaker_config;
+ DWORD speaker_config, new_speaker_config, ref_speaker_config;
/* Try to Query for objects */
rc=IDirectSound_QueryInterface(dso,&IID_IUnknown,(LPVOID*)&unknown);
@@ -144,11 +144,17 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
rc=IDirectSound_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %08x\n", rc);
+ ref_speaker_config = speaker_config;
speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
DSSPEAKER_GEOMETRY_WIDE);
- rc=IDirectSound_SetSpeakerConfig(dso,speaker_config);
- ok(rc==DS_OK,"IDirectSound_SetSpeakerConfig() failed: %08x\n", rc);
+ if (speaker_config == ref_speaker_config)
+ speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
+ DSSPEAKER_GEOMETRY_NARROW);
+ if(rc==DS_OK) {
+ rc=IDirectSound_SetSpeakerConfig(dso,speaker_config);
+ ok(rc==DS_OK,"IDirectSound_SetSpeakerConfig() failed: %08x\n", rc);
+ }
if (rc==DS_OK) {
rc=IDirectSound_GetSpeakerConfig(dso,&new_speaker_config);
ok(rc==DS_OK,"IDirectSound_GetSpeakerConfig() failed: %08x\n", rc);
@@ -156,6 +162,7 @@ static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
trace("IDirectSound_GetSpeakerConfig() failed to set speaker "
"config: expected 0x%08x, got 0x%08x\n",
speaker_config,new_speaker_config);
+ IDirectSound_SetSpeakerConfig(dso,ref_speaker_config);
}
EXIT:
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index a2b16d8..5eb7c05 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -54,7 +54,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
IUnknown * unknown;
IDirectSound * ds;
IDirectSound8 * ds8;
- DWORD speaker_config, new_speaker_config;
+ DWORD speaker_config, new_speaker_config, ref_speaker_config;
DWORD certified;
/* Try to Query for objects */
@@ -148,11 +148,17 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
rc=IDirectSound8_GetSpeakerConfig(dso,&speaker_config);
ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %08x\n", rc);
+ ref_speaker_config = speaker_config;
speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
DSSPEAKER_GEOMETRY_WIDE);
- rc=IDirectSound8_SetSpeakerConfig(dso,speaker_config);
- ok(rc==DS_OK,"IDirectSound8_SetSpeakerConfig() failed: %08x\n", rc);
+ if (speaker_config == ref_speaker_config)
+ speaker_config = DSSPEAKER_COMBINED(DSSPEAKER_STEREO,
+ DSSPEAKER_GEOMETRY_NARROW);
+ if(rc==DS_OK) {
+ rc=IDirectSound8_SetSpeakerConfig(dso,speaker_config);
+ ok(rc==DS_OK,"IDirectSound8_SetSpeakerConfig() failed: %08x\n", rc);
+ }
if (rc==DS_OK) {
rc=IDirectSound8_GetSpeakerConfig(dso,&new_speaker_config);
ok(rc==DS_OK,"IDirectSound8_GetSpeakerConfig() failed: %08x\n", rc);
@@ -160,6 +166,7 @@ static void IDirectSound8_test(LPDIRECTSOUND8 dso, BOOL initialized,
trace("IDirectSound8_GetSpeakerConfig() failed to set speaker "
"config: expected 0x%08x, got 0x%08x\n",
speaker_config,new_speaker_config);
+ IDirectSound8_SetSpeakerConfig(dso,ref_speaker_config);
}
rc=IDirectSound8_VerifyCertification(dso, &certified);
More information about the wine-cvs
mailing list