From 243939f94f26b1840255590b2454e931374de73f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 13 Aug 2009 12:28:46 -0700 Subject: Allow delaying playback start until context creation, and don't use UpdateSize to store the buffer size This will make it possible to support the context attributes (frequency, refresh, etc) for some backends --- Alc/dsound.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'Alc/dsound.c') diff --git a/Alc/dsound.c b/Alc/dsound.c index 2329a4d7..92ee8073 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -309,7 +309,7 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam memset(&DSBDescription,0,sizeof(DSBUFFERDESC)); DSBDescription.dwSize=sizeof(DSBUFFERDESC); DSBDescription.dwFlags=DSBCAPS_GLOBALFOCUS|DSBCAPS_GETCURRENTPOSITION2; - DSBDescription.dwBufferBytes=(device->UpdateSize/num_frags) * num_frags * frameSize; + DSBDescription.dwBufferBytes=(device->BufferSize/num_frags) * num_frags * frameSize; DSBDescription.lpwfxFormat=&OutputType.Format; hr = IDirectSound_CreateSoundBuffer(pData->lpDS, &DSBDescription, &pData->DSsbuffer, NULL); } @@ -339,7 +339,7 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam } device->Format = format; - device->UpdateSize /= num_frags; + device->UpdateSize = device->BufferSize/num_frags; return ALC_TRUE; } @@ -360,6 +360,19 @@ static void DSoundClosePlayback(ALCdevice *device) device->ExtraData = NULL; } +static ALCboolean DSoundStartContext(ALCdevice *device, ALCcontext *context) +{ + return ALC_TRUE; + (void)device; + (void)context; +} + +static void DSoundStopContext(ALCdevice *device, ALCcontext *context) +{ + (void)device; + (void)context; +} + static ALCboolean DSoundOpenCapture(ALCdevice *pDevice, const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei SampleSize) { @@ -403,6 +416,8 @@ static ALCuint DSoundAvailableSamples(ALCdevice *pDevice) BackendFuncs DSoundFuncs = { DSoundOpenPlayback, DSoundClosePlayback, + DSoundStartContext, + DSoundStopContext, DSoundOpenCapture, DSoundCloseCapture, DSoundStartCapture, -- cgit v1.2.3