Module: wine Branch: master Commit: 82c298ee6ed0199e15be26e8c7c31d8ef9137d91 URL: http://source.winehq.org/git/wine.git/?a=commit;h=82c298ee6ed0199e15be26e8c7...
Author: Francois Gouget fgouget@free.fr Date: Tue Jan 20 03:25:49 2015 +0100
dsound: Make DSOUND_FindSpeakerConfig() static.
---
dlls/dsound/dsound_private.h | 1 - dlls/dsound/primary.c | 98 ++++++++++++++++++++++---------------------- 2 files changed, 49 insertions(+), 50 deletions(-)
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 52b2847..af2034a 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -219,7 +219,6 @@ HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LP LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN; HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave) DECLSPEC_HIDDEN; HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device) DECLSPEC_HIDDEN; -DWORD DSOUND_FindSpeakerConfig(IMMDevice *mmdevice, int channels) DECLSPEC_HIDDEN; HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, const DSBUFFERDESC *dsbd) DECLSPEC_HIDDEN; void primarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN; diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 7d05efd..52d00f9 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -79,6 +79,55 @@ static DWORD speaker_config_to_channel_mask(DWORD speaker_config) return SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; }
+static DWORD DSOUND_FindSpeakerConfig(IMMDevice *mmdevice, int channels) +{ + IPropertyStore *store; + HRESULT hr; + PROPVARIANT pv; + ULONG phys_speakers; + + const DWORD def = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, DSSPEAKER_GEOMETRY_WIDE); + + hr = IMMDevice_OpenPropertyStore(mmdevice, STGM_READ, &store); + if (FAILED(hr)) { + WARN("IMMDevice_OpenPropertyStore failed: %08x\n", hr); + return def; + } + + hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_PhysicalSpeakers, &pv); + + if (FAILED(hr)) { + WARN("IPropertyStore_GetValue failed: %08x\n", hr); + IPropertyStore_Release(store); + return def; + } + + if (pv.vt != VT_UI4) { + WARN("PKEY_AudioEndpoint_PhysicalSpeakers is not a ULONG: 0x%x\n", pv.vt); + PropVariantClear(&pv); + IPropertyStore_Release(store); + return def; + } + + phys_speakers = pv.u.ulVal; + + PropVariantClear(&pv); + IPropertyStore_Release(store); + + if ((channels >= 6 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_5POINT1) == KSAUDIO_SPEAKER_5POINT1) + return DSSPEAKER_5POINT1_BACK; + else if ((channels >= 6 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_5POINT1_SURROUND) == KSAUDIO_SPEAKER_5POINT1_SURROUND) + return DSSPEAKER_5POINT1_SURROUND; + else if ((channels >= 4 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_QUAD) == KSAUDIO_SPEAKER_QUAD) + return DSSPEAKER_QUAD; + else if ((channels >= 2 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_STEREO) == KSAUDIO_SPEAKER_STEREO) + return DSSPEAKER_COMBINED(DSSPEAKER_STEREO, DSSPEAKER_GEOMETRY_WIDE); + else if ((phys_speakers & KSAUDIO_SPEAKER_MONO) == KSAUDIO_SPEAKER_MONO) + return DSSPEAKER_MONO; + + return def; +} + static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client, BOOL forcewave, WAVEFORMATEX **wfx) { @@ -166,55 +215,6 @@ static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client return S_OK; }
-DWORD DSOUND_FindSpeakerConfig(IMMDevice *mmdevice, int channels) -{ - IPropertyStore *store; - HRESULT hr; - PROPVARIANT pv; - ULONG phys_speakers; - - const DWORD def = DSSPEAKER_COMBINED(DSSPEAKER_STEREO, DSSPEAKER_GEOMETRY_WIDE); - - hr = IMMDevice_OpenPropertyStore(mmdevice, STGM_READ, &store); - if (FAILED(hr)) { - WARN("IMMDevice_OpenPropertyStore failed: %08x\n", hr); - return def; - } - - hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_PhysicalSpeakers, &pv); - - if (FAILED(hr)) { - WARN("IPropertyStore_GetValue failed: %08x\n", hr); - IPropertyStore_Release(store); - return def; - } - - if (pv.vt != VT_UI4) { - WARN("PKEY_AudioEndpoint_PhysicalSpeakers is not a ULONG: 0x%x\n", pv.vt); - PropVariantClear(&pv); - IPropertyStore_Release(store); - return def; - } - - phys_speakers = pv.u.ulVal; - - PropVariantClear(&pv); - IPropertyStore_Release(store); - - if ((channels >= 6 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_5POINT1) == KSAUDIO_SPEAKER_5POINT1) - return DSSPEAKER_5POINT1_BACK; - else if ((channels >= 6 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_5POINT1_SURROUND) == KSAUDIO_SPEAKER_5POINT1_SURROUND) - return DSSPEAKER_5POINT1_SURROUND; - else if ((channels >= 4 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_QUAD) == KSAUDIO_SPEAKER_QUAD) - return DSSPEAKER_QUAD; - else if ((channels >= 2 || channels == 0) && (phys_speakers & KSAUDIO_SPEAKER_STEREO) == KSAUDIO_SPEAKER_STEREO) - return DSSPEAKER_COMBINED(DSSPEAKER_STEREO, DSSPEAKER_GEOMETRY_WIDE); - else if ((phys_speakers & KSAUDIO_SPEAKER_MONO) == KSAUDIO_SPEAKER_MONO) - return DSSPEAKER_MONO; - - return def; -} - HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave) { UINT prebuf_frames;