aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-24 08:58:18 -0700
committerChris Robinson <[email protected]>2018-03-24 09:25:49 -0700
commite5e3b0501504036ecc9c5a8a6478d7ac55447955 (patch)
tree615ce6092e3900fcc2bf4793b559b919ec9f22e9 /Alc
parenteccf679ca933704a675811003eb8d7606cc8de1e (diff)
Fix capture device closing in the CoreAudio backend
Diffstat (limited to 'Alc')
-rw-r--r--Alc/backends/coreaudio.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c
index eeb19dab..a8787f7b 100644
--- a/Alc/backends/coreaudio.c
+++ b/Alc/backends/coreaudio.c
@@ -331,7 +331,6 @@ typedef struct ALCcoreAudioCapture {
static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *device);
static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self);
static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar *name);
-static void ALCcoreAudioCapture_close(ALCcoreAudioCapture *self);
static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, ALCboolean, reset)
static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self);
static void ALCcoreAudioCapture_stop(ALCcoreAudioCapture *self);
@@ -372,10 +371,32 @@ static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *
ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device);
SET_VTABLE2(ALCcoreAudioCapture, ALCbackend, self);
+ self->audioUnit = 0;
+ self->audioConverter = NULL;
+ self->bufferList = NULL;
+ self->resampleBuffer = NULL;
+ self->ring = NULL;
}
static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self)
{
+ ll_ringbuffer_free(self->ring);
+ self->ring = NULL;
+
+ free(self->resampleBuffer);
+ self->resampleBuffer = NULL;
+
+ destroy_buffer_list(self->bufferList);
+ self->bufferList = NULL;
+
+ if(self->audioConverter)
+ AudioConverterDispose(self->audioConverter);
+ self->audioConverter = NULL;
+
+ if(self->audioUnit)
+ AudioComponentInstanceDispose(self->audioUnit);
+ self->audioUnit = 0;
+
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
}
@@ -651,30 +672,21 @@ error:
ll_ringbuffer_free(self->ring);
self->ring = NULL;
free(self->resampleBuffer);
+ self->resampleBuffer = NULL;
destroy_buffer_list(self->bufferList);
+ self->bufferList = NULL;
if(self->audioConverter)
AudioConverterDispose(self->audioConverter);
+ self->audioConverter = NULL;
if(self->audioUnit)
AudioComponentInstanceDispose(self->audioUnit);
+ self->audioUnit = 0;
return ALC_INVALID_VALUE;
}
-static void ALCcoreAudioCapture_close(ALCcoreAudioCapture *self)
-{
- ll_ringbuffer_free(self->ring);
- self->ring = NULL;
-
- free(self->resampleBuffer);
-
- destroy_buffer_list(self->bufferList);
-
- AudioConverterDispose(self->audioConverter);
- AudioComponentInstanceDispose(self->audioUnit);
-}
-
static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self)
{
OSStatus err = AudioOutputUnitStart(self->audioUnit);