diff options
author | Chris Robinson <[email protected]> | 2018-03-03 09:00:14 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-03-03 09:00:14 -0800 |
commit | 4bd02eada65a9c9140c0c62524692038165e9a31 (patch) | |
tree | 734d575ae9087b876fe9e75d391148b69bfcd0db /Alc | |
parent | bd32a682f7476e7bdd8240e0244adff047d99f49 (diff) |
Init more stuff in InitDevice
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 27 |
1 files changed, 9 insertions, 18 deletions
@@ -2361,10 +2361,15 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) } -static void InitDevice(ALCdevice *device) +static void InitDevice(ALCdevice *device, enum DeviceType type) { ALsizei i; + InitRef(&device->ref, 1); + ATOMIC_INIT(&device->Connected, ALC_TRUE); + device->Type = type; + ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); + device->Flags = 0; device->Render_Mode = NormalRender; device->AvgSpeakerDist = 0.0f; @@ -4031,12 +4036,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) } //Validate device - InitRef(&device->ref, 1); - ATOMIC_INIT(&device->Connected, ALC_TRUE); - device->Type = Playback; - ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); - - InitDevice(device); + InitDevice(device, Playback); //Set output format device->FmtChans = DevFmtChannelsDefault; @@ -4284,11 +4284,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, } //Validate device - InitRef(&device->ref, 1); - ATOMIC_INIT(&device->Connected, ALC_TRUE); - device->Type = Capture; - - InitDevice(device); + InitDevice(device, Capture); device->Frequency = frequency; device->Flags |= DEVICE_FREQUENCY_REQUEST; @@ -4465,12 +4461,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN } //Validate device - InitRef(&device->ref, 1); - ATOMIC_INIT(&device->Connected, ALC_TRUE); - device->Type = Loopback; - ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); - - InitDevice(device); + InitDevice(device, Loopback); device->SourcesMax = 256; device->AuxiliaryEffectSlotMax = 64; |