diff options
-rw-r--r-- | Alc/alc.cpp | 40 | ||||
-rw-r--r-- | Alc/backends/wave.cpp | 4 | ||||
-rw-r--r-- | Alc/panning.cpp | 8 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 26 |
4 files changed, 34 insertions, 44 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index d15b6e00..af81dd55 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1847,8 +1847,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(schans == ALC_BFORMAT3D_SOFT) { device->mAmbiOrder = aorder; - device->mAmbiLayout = static_cast<enum AmbiLayout>(alayout); - device->mAmbiScale = static_cast<enum AmbiNorm>(ascale); + device->mAmbiLayout = static_cast<AmbiLayout>(alayout); + device->mAmbiScale = static_cast<AmbiNorm>(ascale); } if(numMono > INT_MAX-numStereo) @@ -3189,10 +3189,10 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC if(device->FmtChans == DevFmtAmbi3D) { values[i++] = ALC_AMBISONIC_LAYOUT_SOFT; - values[i++] = device->mAmbiLayout; + values[i++] = static_cast<ALCint>(device->mAmbiLayout); values[i++] = ALC_AMBISONIC_SCALING_SOFT; - values[i++] = device->mAmbiScale; + values[i++] = static_cast<ALCint>(device->mAmbiScale); values[i++] = ALC_AMBISONIC_ORDER_SOFT; values[i++] = device->mAmbiOrder; @@ -3294,7 +3294,7 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC alcSetError(device, ALC_INVALID_DEVICE); return 0; } - values[0] = device->mAmbiLayout; + values[0] = static_cast<ALCint>(device->mAmbiLayout); return 1; case ALC_AMBISONIC_SCALING_SOFT: @@ -3303,7 +3303,7 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC alcSetError(device, ALC_INVALID_DEVICE); return 0; } - values[0] = device->mAmbiScale; + values[0] = static_cast<ALCint>(device->mAmbiScale); return 1; case ALC_AMBISONIC_ORDER_SOFT: @@ -3426,10 +3426,10 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, if(device->FmtChans == DevFmtAmbi3D) { values[i++] = ALC_AMBISONIC_LAYOUT_SOFT; - values[i++] = device->mAmbiLayout; + values[i++] = static_cast<ALCint64SOFT>(device->mAmbiLayout); values[i++] = ALC_AMBISONIC_SCALING_SOFT; - values[i++] = device->mAmbiScale; + values[i++] = static_cast<ALCint64SOFT>(device->mAmbiScale); values[i++] = ALC_AMBISONIC_ORDER_SOFT; values[i++] = device->mAmbiOrder; @@ -3867,9 +3867,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; device->Frequency = DEFAULT_OUTPUT_RATE; - device->IsHeadphones = AL_FALSE; - device->mAmbiLayout = AmbiLayout_Default; - device->mAmbiScale = AmbiNorm_Default; device->LimiterState = ALC_TRUE; device->NumUpdates = 3; device->UpdateSize = 1024; @@ -3991,18 +3988,18 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { if(strcasecmp(fmt, "fuma") == 0) { - device->mAmbiLayout = AmbiLayout_FuMa; - device->mAmbiScale = AmbiNorm_FuMa; + device->mAmbiLayout = AmbiLayout::FuMa; + device->mAmbiScale = AmbiNorm::FuMa; } else if(strcasecmp(fmt, "acn+sn3d") == 0) { - device->mAmbiLayout = AmbiLayout_ACN; - device->mAmbiScale = AmbiNorm_SN3D; + device->mAmbiLayout = AmbiLayout::ACN; + device->mAmbiScale = AmbiNorm::SN3D; } else if(strcasecmp(fmt, "acn+n3d") == 0) { - device->mAmbiLayout = AmbiLayout_ACN; - device->mAmbiScale = AmbiNorm_N3D; + device->mAmbiLayout = AmbiLayout::ACN; + device->mAmbiScale = AmbiNorm::N3D; } else ERR("Unsupported ambi-format: %s\n", fmt); @@ -4011,7 +4008,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { ALCdevice *head{DeviceList.load()}; do { - ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + device->next.store(head, std::memory_order_relaxed); } while(!DeviceList.compare_exchange_weak(head, device)); } @@ -4104,10 +4101,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, return nullptr; } device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST; - device->IsHeadphones = AL_FALSE; - device->mAmbiOrder = 0; - device->mAmbiLayout = AmbiLayout_Default; - device->mAmbiScale = AmbiNorm_Default; device->UpdateSize = samples; device->NumUpdates = 1; @@ -4275,9 +4268,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->Frequency = DEFAULT_OUTPUT_RATE; device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; - device->IsHeadphones = AL_FALSE; - device->mAmbiLayout = AmbiLayout_Default; - device->mAmbiScale = AmbiNorm_Default; ConfigValueUInt(nullptr, nullptr, "sources", &device->SourcesMax); if(device->SourcesMax == 0) device->SourcesMax = 256; diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp index 83af40a8..d1356338 100644 --- a/Alc/backends/wave.cpp +++ b/Alc/backends/wave.cpp @@ -289,8 +289,8 @@ ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break; case DevFmtAmbi3D: /* .amb output requires FuMa */ - device->mAmbiLayout = AmbiLayout_FuMa; - device->mAmbiScale = AmbiNorm_FuMa; + device->mAmbiLayout = AmbiLayout::FuMa; + device->mAmbiScale = AmbiNorm::FuMa; isbformat = 1; chanmask = 0; break; diff --git a/Alc/panning.cpp b/Alc/panning.cpp index aface673..806486a3 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -513,10 +513,10 @@ static void InitPanning(ALCdevice *device) if(device->FmtChans == DevFmtAmbi3D) { const char *devname = device->DeviceName.c_str(); - const ALsizei *acnmap = (device->mAmbiLayout == AmbiLayout_FuMa) ? FuMa2ACN : ACN2ACN; - const ALfloat *n3dscale = (device->mAmbiScale == AmbiNorm_FuMa) ? FuMa2N3DScale : - (device->mAmbiScale == AmbiNorm_SN3D) ? SN3D2N3DScale : - /*(device->mAmbiScale == AmbiNorm_N3D) ?*/ N3D2N3DScale; + const ALsizei *acnmap = (device->mAmbiLayout == AmbiLayout::FuMa) ? FuMa2ACN : ACN2ACN; + const ALfloat *n3dscale = (device->mAmbiScale == AmbiNorm::FuMa) ? FuMa2N3DScale : + (device->mAmbiScale == AmbiNorm::SN3D) ? SN3D2N3DScale : + /*(device->mAmbiScale == AmbiNorm::N3D) ?*/ N3D2N3DScale; ALfloat nfc_delay = 0.0f; count = (device->mAmbiOrder == 3) ? 16 : diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 0770ee89..c7bdcc2a 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -464,19 +464,19 @@ inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType ty return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); } -enum AmbiLayout { - AmbiLayout_FuMa = ALC_FUMA_SOFT, /* FuMa channel order */ - AmbiLayout_ACN = ALC_ACN_SOFT, /* ACN channel order */ +enum class AmbiLayout { + FuMa = ALC_FUMA_SOFT, /* FuMa channel order */ + ACN = ALC_ACN_SOFT, /* ACN channel order */ - AmbiLayout_Default = AmbiLayout_ACN + Default = ACN }; -enum AmbiNorm { - AmbiNorm_FuMa = ALC_FUMA_SOFT, /* FuMa normalization */ - AmbiNorm_SN3D = ALC_SN3D_SOFT, /* SN3D normalization */ - AmbiNorm_N3D = ALC_N3D_SOFT, /* N3D normalization */ +enum class AmbiNorm { + FuMa = ALC_FUMA_SOFT, /* FuMa normalization */ + SN3D = ALC_SN3D_SOFT, /* SN3D normalization */ + N3D = ALC_N3D_SOFT, /* N3D normalization */ - AmbiNorm_Default = AmbiNorm_SN3D + Default = SN3D }; @@ -601,13 +601,13 @@ struct ALCdevice_struct { ALuint NumUpdates{}; DevFmtChannels FmtChans{}; DevFmtType FmtType{}; - ALboolean IsHeadphones{}; - ALsizei mAmbiOrder{}; + ALboolean IsHeadphones{AL_FALSE}; + ALsizei mAmbiOrder{0}; /* For DevFmtAmbi* output only, specifies the channel order and * normalization. */ - AmbiLayout mAmbiLayout{}; - AmbiNorm mAmbiScale{}; + AmbiLayout mAmbiLayout{AmbiLayout::Default}; + AmbiNorm mAmbiScale{AmbiNorm::Default}; ALCenum LimiterState{ALC_DONT_CARE_SOFT}; |