aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/dsound.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends/dsound.c')
-rw-r--r--Alc/backends/dsound.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index feca3cfa..0eab62a4 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -392,6 +392,16 @@ static void DSoundClosePlayback(ALCdevice *device)
{
DSoundPlaybackData *pData = device->ExtraData;
+ if(pData->DSnotify)
+ IDirectSoundNotify_Release(pData->DSnotify);
+ pData->DSnotify = NULL;
+ if(pData->DSsbuffer)
+ IDirectSoundBuffer_Release(pData->DSsbuffer);
+ pData->DSsbuffer = NULL;
+ if(pData->DSpbuffer != NULL)
+ IDirectSoundBuffer_Release(pData->DSpbuffer);
+ pData->DSpbuffer = NULL;
+
IDirectSound_Release(pData->lpDS);
CloseHandle(pData->hNotifyEvent);
free(pData);
@@ -408,6 +418,16 @@ static ALCboolean DSoundResetPlayback(ALCdevice *device)
memset(&OutputType, 0, sizeof(OutputType));
+ if(pData->DSnotify)
+ IDirectSoundNotify_Release(pData->DSnotify);
+ pData->DSnotify = NULL;
+ if(pData->DSsbuffer)
+ IDirectSoundBuffer_Release(pData->DSsbuffer);
+ pData->DSsbuffer = NULL;
+ if(pData->DSpbuffer != NULL)
+ IDirectSoundBuffer_Release(pData->DSpbuffer);
+ pData->DSpbuffer = NULL;
+
switch(device->FmtType)
{
case DevFmtByte:
@@ -578,15 +598,6 @@ retry_open:
}
}
- if(SUCCEEDED(hr))
- {
- ResetEvent(pData->hNotifyEvent);
- SetDefaultWFXChannelOrder(device);
- pData->thread = StartThread(DSoundPlaybackProc, device);
- if(pData->thread == NULL)
- hr = E_FAIL;
- }
-
if(FAILED(hr))
{
if(pData->DSnotify != NULL)
@@ -601,6 +612,20 @@ retry_open:
return ALC_FALSE;
}
+ ResetEvent(pData->hNotifyEvent);
+ SetDefaultWFXChannelOrder(device);
+
+ return ALC_TRUE;
+}
+
+static ALCboolean DSoundStartPlayback(ALCdevice *device)
+{
+ DSoundPlaybackData *pData = (DSoundPlaybackData*)device->ExtraData;
+
+ pData->thread = StartThread(DSoundPlaybackProc, device);
+ if(pData->thread == NULL)
+ return ALC_FALSE;
+
return ALC_TRUE;
}
@@ -616,14 +641,7 @@ static void DSoundStopPlayback(ALCdevice *device)
pData->thread = NULL;
pData->killNow = 0;
-
- IDirectSoundNotify_Release(pData->DSnotify);
- pData->DSnotify = NULL;
- IDirectSoundBuffer_Release(pData->DSsbuffer);
- pData->DSsbuffer = NULL;
- if(pData->DSpbuffer != NULL)
- IDirectSoundBuffer_Release(pData->DSpbuffer);
- pData->DSpbuffer = NULL;
+ IDirectSoundBuffer_Stop(pData->DSsbuffer);
}
@@ -918,6 +936,7 @@ static const BackendFuncs DSoundFuncs = {
DSoundOpenPlayback,
DSoundClosePlayback,
DSoundResetPlayback,
+ DSoundStartPlayback,
DSoundStopPlayback,
DSoundOpenCapture,
DSoundCloseCapture,