aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-03 09:00:14 -0800
committerChris Robinson <[email protected]>2018-03-03 09:00:14 -0800
commit4bd02eada65a9c9140c0c62524692038165e9a31 (patch)
tree734d575ae9087b876fe9e75d391148b69bfcd0db /Alc
parentbd32a682f7476e7bdd8240e0244adff047d99f49 (diff)
Init more stuff in InitDevice
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 3cc50e8c..3fd3ab8f 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -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;