Minor coreaudio fix, and make sure to set the device name

This commit is contained in:
Chris Robinson 2012-03-13 13:48:42 -07:00
parent 5c59e6e704
commit 3b165809cc

View File

@ -162,14 +162,12 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
} }
data = calloc(1, sizeof(*data)); data = calloc(1, sizeof(*data));
device->ExtraData = data;
err = OpenAComponent(comp, &data->audioUnit); err = OpenAComponent(comp, &data->audioUnit);
if(err != noErr) if(err != noErr)
{ {
ERR("OpenAComponent failed\n"); ERR("OpenAComponent failed\n");
free(data); free(data);
device->ExtraData = NULL;
return ALC_INVALID_VALUE; return ALC_INVALID_VALUE;
} }
@ -180,10 +178,11 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
ERR("AudioUnitInitialize failed\n"); ERR("AudioUnitInitialize failed\n");
CloseComponent(data->audioUnit); CloseComponent(data->audioUnit);
free(data); free(data);
device->ExtraData = NULL; return ALC_INVALID_VALUE;
return ALC_FALSE;
} }
device->szDeviceName = strdup(deviceName);
device->ExtraData = data;
return ALC_NO_ERROR; return ALC_NO_ERROR;
} }