From 2d82fc42f075c369d8f41c7da2f1ec7480840f3a Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sat, 14 Jan 2006 17:06:22 +0100 Subject: [PATCH] dsound: Add DSOUND_PrimarySetFormat and use it to set primary format. --- dlls/dsound/dsound_private.h | 1 + dlls/dsound/primary.c | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 63225dbd151..cdce82c66a1 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -498,6 +498,7 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device); HRESULT DSOUND_PrimaryPlay(DirectSoundDevice *device); HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device); HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos); +HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex); /* buffer.c */ diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index c69eddc5503..e3cd3a27692 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -318,19 +318,12 @@ HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LP return DS_OK; } -/******************************************************************************* - * PrimaryBuffer - */ -/* This sets this format for the Primary Buffer Only */ -/* See file:///cdrom/sdk52/docs/worddoc/dsound.doc page 120 */ -static HRESULT WINAPI PrimaryBufferImpl_SetFormat( - LPDIRECTSOUNDBUFFER8 iface,LPCWAVEFORMATEX wfex -) { - DirectSoundDevice *device = ((PrimaryBufferImpl *)iface)->device; +HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex) +{ HRESULT err = DS_OK; int i, alloc_size, cp_size; DWORD nSamplesPerSec; - TRACE("(%p,%p)\n", iface, wfex); + TRACE("(%p,%p)\n", device, wfex); if (device->priolevel == DSSCL_NORMAL) { WARN("failed priority check!\n"); @@ -430,6 +423,19 @@ done: return err; } +/******************************************************************************* + * PrimaryBuffer + */ +/* This sets this format for the Primary Buffer Only */ +/* See file:///cdrom/sdk52/docs/worddoc/dsound.doc page 120 */ +static HRESULT WINAPI PrimaryBufferImpl_SetFormat( + LPDIRECTSOUNDBUFFER8 iface, + LPCWAVEFORMATEX wfex) +{ + TRACE("(%p,%p)\n", iface, wfex); + return DSOUND_PrimarySetFormat(((PrimaryBufferImpl *)iface)->device, wfex); +} + static HRESULT WINAPI PrimaryBufferImpl_SetVolume( LPDIRECTSOUNDBUFFER8 iface,LONG vol ) {