summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/pulseaudio.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index a9fcb3df..2faf0ea5 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -206,21 +206,12 @@ static ALCboolean pulse_open(ALCdevice *device, ALCchar *device_name) //{{{
pulse_data *data = ppa_xmalloc0(sizeof(pulse_data));
data->device = device;
- data->samples = device->BufferSize;
- data->frame_size = aluBytesFromFormat(device->Format) *
- aluChannelsFromFormat(device->Format);
if(ppa_get_binary_name(data->path_name, sizeof(data->path_name)))
data->context_name = ppa_path_get_filename(data->path_name);
else
data->context_name = "OpenAL Soft";
- if(!(data->ring = CreateRingBuffer(data->frame_size, data->samples)))
- {
- ppa_xfree(data);
- return ALC_FALSE;
- }
-
device->ExtraData = data;
device->szDeviceName = device_name;
@@ -291,7 +282,6 @@ out:
}
device->ExtraData = NULL;
device->szDeviceName = NULL;
- DestroyRingBuffer(data->ring);
ppa_xfree(data);
return ALC_FALSE;
@@ -352,6 +342,10 @@ static ALCboolean pulse_start_context(ALCdevice *device, ALCcontext *context) //
ppa_threaded_mainloop_lock(data->loop);
+ data->samples = device->BufferSize;
+ data->frame_size = aluBytesFromFormat(device->Format) *
+ aluChannelsFromFormat(device->Format);
+
device->UpdateSize = device->BufferSize / 4;
data->attr.minreq = -1;
@@ -469,6 +463,17 @@ static ALCboolean pulse_open_capture(ALCdevice *device, const ALCchar *device_na
data = device->ExtraData;
ppa_threaded_mainloop_lock(data->loop);
+ data->samples = device->BufferSize;
+ data->frame_size = aluBytesFromFormat(device->Format) *
+ aluChannelsFromFormat(device->Format);
+
+ if(!(data->ring = CreateRingBuffer(data->frame_size, data->samples)))
+ {
+ ppa_threaded_mainloop_unlock(data->loop);
+ pulse_close(device);
+ return ALC_FALSE;
+ }
+
data->attr.minreq = -1;
data->attr.prebuf = -1;
data->attr.maxlength = -1;