diff options
author | Chris Robinson <[email protected]> | 2023-03-16 04:40:10 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-03-16 04:56:08 -0700 |
commit | 24508c3901ad9df62b264d5c0d8b7294bb0e218f (patch) | |
tree | 2a924d7d38693796e2a6a78ced0a6c7863d2c9a9 | |
parent | ef5373611fb0411be0e29c463f0e525481011eb0 (diff) |
Rename some member functions and variables for consistency
-rw-r--r-- | al/listener.cpp | 2 | ||||
-rw-r--r-- | al/source.cpp | 204 | ||||
-rw-r--r-- | al/source.h | 35 | ||||
-rw-r--r-- | alc/context.cpp | 172 | ||||
-rw-r--r-- | alc/context.h | 64 |
5 files changed, 237 insertions, 240 deletions
diff --git a/al/listener.cpp b/al/listener.cpp index 2a9f2cb3..06d7c370 100644 --- a/al/listener.cpp +++ b/al/listener.cpp @@ -53,7 +53,7 @@ inline void CommitAndUpdateProps(ALCcontext *context) if(!context->mDeferUpdates) { #ifdef ALSOFT_EAX - if(context->eax_needs_commit()) + if(context->eaxNeedsCommit()) { context->mPropsDirty = true; context->applyAllUpdates(); diff --git a/al/source.cpp b/al/source.cpp index 17a3a0ae..b1406326 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -1317,8 +1317,8 @@ void CommitAndUpdateSourceProps(ALsource *source, ALCcontext *context) { if(!context->mDeferUpdates) { - if(context->has_eax()) - source->eax_commit(); + if(context->hasEax()) + source->eaxCommit(); if(Voice *voice{GetSourceVoice(source, context)}) { UpdateSourceProps(source, voice, context); @@ -2745,8 +2745,8 @@ void StartSources(ALCcontext *const context, const al::span<ALsource*> srchandle cur->mState = VChangeState::Play; source->state = AL_PLAYING; #ifdef ALSOFT_EAX - if(context->has_eax()) - source->eax_commit(); + if(context->hasEax()) + source->eaxCommit(); #endif // ALSOFT_EAX continue; @@ -2765,8 +2765,8 @@ void StartSources(ALCcontext *const context, const al::span<ALsource*> srchandle assert(voice == nullptr); cur->mOldVoice = nullptr; #ifdef ALSOFT_EAX - if(context->has_eax()) - source->eax_commit(); + if(context->hasEax()) + source->eaxCommit(); #endif // ALSOFT_EAX break; } @@ -2853,7 +2853,7 @@ START_API_FUNC sources[0] = source->id; #ifdef ALSOFT_EAX - source->eax_initialize(context.get()); + source->eaxInitialize(context.get()); #endif // ALSOFT_EAX } else @@ -2865,7 +2865,7 @@ START_API_FUNC ids.emplace_back(source->id); #ifdef ALSOFT_EAX - source->eax_initialize(context.get()); + source->eaxInitialize(context.get()); #endif // ALSOFT_EAX } while(--n); std::copy(ids.cbegin(), ids.cend(), sources); @@ -3961,25 +3961,25 @@ SourceSubList::~SourceSubList() constexpr const ALsource::EaxFxSlotIds ALsource::eax4_fx_slot_ids; constexpr const ALsource::EaxFxSlotIds ALsource::eax5_fx_slot_ids; -void ALsource::eax_initialize(ALCcontext *context) noexcept +void ALsource::eaxInitialize(ALCcontext *context) noexcept { assert(context != nullptr); - eax_al_context_ = context; + mEaxAlContext = context; - eax_primary_fx_slot_id_ = context->eax_get_primary_fx_slot_index(); + mEaxPrimaryFxSlotId = context->eaxGetPrimaryFxSlotIndex(); eax_set_defaults(); - eax1_translate(eax1_.i, eax_); - eax_version_ = 1; - eax_changed_ = true; + eax1_translate(mEax1.i, mEax); + mEaxVersion = 1; + mEaxChanged = true; } -void ALsource::eax_dispatch(const EaxCall& call) +void ALsource::eaxDispatch(const EaxCall& call) { call.is_get() ? eax_get(call) : eax_set(call); } -ALsource* ALsource::eax_lookup_source(ALCcontext& al_context, ALuint source_id) noexcept +ALsource* ALsource::EaxLookupSource(ALCcontext& al_context, ALuint source_id) noexcept { return LookupSource(&al_context, source_id); } @@ -4032,8 +4032,8 @@ void ALsource::eax1_set_defaults(Eax1Props& props) noexcept void ALsource::eax1_set_defaults() noexcept { - eax1_set_defaults(eax1_.i); - eax1_.d = eax1_.i; + eax1_set_defaults(mEax1.i); + mEax1.d = mEax1.i; } void ALsource::eax2_set_defaults(Eax2Props& props) noexcept @@ -4055,8 +4055,8 @@ void ALsource::eax2_set_defaults(Eax2Props& props) noexcept void ALsource::eax2_set_defaults() noexcept { - eax2_set_defaults(eax2_.i); - eax2_.d = eax2_.i; + eax2_set_defaults(mEax2.i); + mEax2.d = mEax2.i; } void ALsource::eax3_set_defaults(Eax3Props& props) noexcept @@ -4083,8 +4083,8 @@ void ALsource::eax3_set_defaults(Eax3Props& props) noexcept void ALsource::eax3_set_defaults() noexcept { - eax3_set_defaults(eax3_.i); - eax3_.d = eax3_.i; + eax3_set_defaults(mEax3.i); + mEax3.d = mEax3.i; } void ALsource::eax4_set_sends_defaults(EaxSends& sends) noexcept @@ -4099,10 +4099,10 @@ void ALsource::eax4_set_active_fx_slots_defaults(EAX40ACTIVEFXSLOTS& slots) noex void ALsource::eax4_set_defaults() noexcept { - eax3_set_defaults(eax4_.i.source); - eax4_set_sends_defaults(eax4_.i.sends); - eax4_set_active_fx_slots_defaults(eax4_.i.active_fx_slots); - eax4_.d = eax4_.i; + eax3_set_defaults(mEax4.i.source); + eax4_set_sends_defaults(mEax4.i.sends); + eax4_set_active_fx_slots_defaults(mEax4.i.active_fx_slots); + mEax4.d = mEax4.i; } void ALsource::eax5_set_source_defaults(EAX50SOURCEPROPERTIES& props) noexcept @@ -4140,8 +4140,8 @@ void ALsource::eax5_set_defaults(Eax5Props& props) noexcept void ALsource::eax5_set_defaults() noexcept { - eax5_set_defaults(eax5_.i); - eax5_.d = eax5_.i; + eax5_set_defaults(mEax5.i); + mEax5.d = mEax5.i; } void ALsource::eax_set_defaults() noexcept @@ -4275,42 +4275,42 @@ float ALsource::eax_calculate_dst_occlusion_mb( EaxAlLowPassParam ALsource::eax_create_direct_filter_param() const noexcept { auto gain_mb = - static_cast<float>(eax_.source.lDirect) + - (static_cast<float>(eax_.source.lObstruction) * eax_.source.flObstructionLFRatio) + + static_cast<float>(mEax.source.lDirect) + + (static_cast<float>(mEax.source.lObstruction) * mEax.source.flObstructionLFRatio) + eax_calculate_dst_occlusion_mb( - eax_.source.lOcclusion, - eax_.source.flOcclusionDirectRatio, - eax_.source.flOcclusionLFRatio); + mEax.source.lOcclusion, + mEax.source.flOcclusionDirectRatio, + mEax.source.flOcclusionLFRatio); - const auto has_source_occlusion = (eax_.source.lOcclusion != 0); + const auto has_source_occlusion = (mEax.source.lOcclusion != 0); auto gain_hf_mb = - static_cast<float>(eax_.source.lDirectHF) + - static_cast<float>(eax_.source.lObstruction); + static_cast<float>(mEax.source.lDirectHF) + + static_cast<float>(mEax.source.lObstruction); for (auto i = std::size_t{}; i < EAX_MAX_FXSLOTS; ++i) { - if(!eax_active_fx_slots_[i]) + if(!mEaxActiveFxSlots[i]) continue; if(has_source_occlusion) { - const auto& fx_slot = eax_al_context_->eax_get_fx_slot(i); + const auto& fx_slot = mEaxAlContext->eaxGetFxSlot(i); const auto& fx_slot_eax = fx_slot.eax_get_eax_fx_slot(); const auto is_environmental_fx = ((fx_slot_eax.ulFlags & EAXFXSLOTFLAGS_ENVIRONMENT) != 0); - const auto is_primary = (eax_primary_fx_slot_id_.value_or(-1) == fx_slot.eax_get_index()); + const auto is_primary = (mEaxPrimaryFxSlotId.value_or(-1) == fx_slot.eax_get_index()); const auto is_listener_environment = (is_environmental_fx && is_primary); if(is_listener_environment) { gain_mb += eax_calculate_dst_occlusion_mb( - eax_.source.lOcclusion, - eax_.source.flOcclusionDirectRatio, - eax_.source.flOcclusionLFRatio); + mEax.source.lOcclusion, + mEax.source.flOcclusionDirectRatio, + mEax.source.flOcclusionLFRatio); - gain_hf_mb += static_cast<float>(eax_.source.lOcclusion) * eax_.source.flOcclusionDirectRatio; + gain_hf_mb += static_cast<float>(mEax.source.lOcclusion) * mEax.source.flOcclusionDirectRatio; } } - const auto& send = eax_.sends[i]; + const auto& send = mEax.sends[i]; if(send.lOcclusion != 0) { gain_mb += eax_calculate_dst_occlusion_mb( @@ -4335,36 +4335,36 @@ EaxAlLowPassParam ALsource::eax_create_room_filter_param( { const auto& fx_slot_eax = fx_slot.eax_get_eax_fx_slot(); const auto is_environmental_fx = ((fx_slot_eax.ulFlags & EAXFXSLOTFLAGS_ENVIRONMENT) != 0); - const auto is_primary = (eax_primary_fx_slot_id_.value_or(-1) == fx_slot.eax_get_index()); + const auto is_primary = (mEaxPrimaryFxSlotId.value_or(-1) == fx_slot.eax_get_index()); const auto is_listener_environment = (is_environmental_fx && is_primary); const auto gain_mb = (static_cast<float>(fx_slot_eax.lOcclusion) * fx_slot_eax.flOcclusionLFRatio) + - static_cast<float>((is_environmental_fx ? eax_.source.lRoom : 0) + send.lSend) + + static_cast<float>((is_environmental_fx ? mEax.source.lRoom : 0) + send.lSend) + (is_listener_environment ? eax_calculate_dst_occlusion_mb( - eax_.source.lOcclusion, - eax_.source.flOcclusionRoomRatio, - eax_.source.flOcclusionLFRatio) : + mEax.source.lOcclusion, + mEax.source.flOcclusionRoomRatio, + mEax.source.flOcclusionLFRatio) : 0.0f) + eax_calculate_dst_occlusion_mb( send.lOcclusion, send.flOcclusionRoomRatio, send.flOcclusionLFRatio) + (is_listener_environment ? - (static_cast<float>(eax_.source.lExclusion) * eax_.source.flExclusionLFRatio) : + (static_cast<float>(mEax.source.lExclusion) * mEax.source.flExclusionLFRatio) : 0.0f) + (static_cast<float>(send.lExclusion) * send.flExclusionLFRatio); const auto gain_hf_mb = static_cast<float>(fx_slot_eax.lOcclusion) + - static_cast<float>((is_environmental_fx ? eax_.source.lRoomHF : 0) + send.lSendHF) + + static_cast<float>((is_environmental_fx ? mEax.source.lRoomHF : 0) + send.lSendHF) + (is_listener_environment ? - ((static_cast<float>(eax_.source.lOcclusion) * eax_.source.flOcclusionRoomRatio)) : + ((static_cast<float>(mEax.source.lOcclusion) * mEax.source.flOcclusionRoomRatio)) : 0.0f) + (static_cast<float>(send.lOcclusion) * send.flOcclusionRoomRatio) + (is_listener_environment ? - static_cast<float>(eax_.source.lExclusion + send.lExclusion) : + static_cast<float>(mEax.source.lExclusion + send.lExclusion) : 0.0f); const auto al_low_pass_param = EaxAlLowPassParam{ @@ -4388,11 +4388,11 @@ void ALsource::eax_update_direct_filter() void ALsource::eax_update_room_filters() { for (auto i = size_t{}; i < EAX_MAX_FXSLOTS; ++i) { - if (!eax_active_fx_slots_[i]) + if (!mEaxActiveFxSlots[i]) continue; - auto& fx_slot = eax_al_context_->eax_get_fx_slot(i); - const auto& send = eax_.sends[i]; + auto& fx_slot = mEaxAlContext->eaxGetFxSlot(i); + const auto& send = mEax.sends[i]; const auto& room_param = eax_create_room_filter_param(fx_slot, send); eax_set_al_source_send(&fx_slot, i, room_param); } @@ -4401,44 +4401,44 @@ void ALsource::eax_update_room_filters() void ALsource::eax_set_efx_outer_gain_hf() { OuterGainHF = clamp( - level_mb_to_gain(static_cast<float>(eax_.source.lOutsideVolumeHF)), + level_mb_to_gain(static_cast<float>(mEax.source.lOutsideVolumeHF)), AL_MIN_CONE_OUTER_GAINHF, AL_MAX_CONE_OUTER_GAINHF); } void ALsource::eax_set_efx_doppler_factor() { - DopplerFactor = eax_.source.flDopplerFactor; + DopplerFactor = mEax.source.flDopplerFactor; } void ALsource::eax_set_efx_rolloff_factor() { - RolloffFactor2 = eax_.source.flRolloffFactor; + RolloffFactor2 = mEax.source.flRolloffFactor; } void ALsource::eax_set_efx_room_rolloff_factor() { - RoomRolloffFactor = eax_.source.flRoomRolloffFactor; + RoomRolloffFactor = mEax.source.flRoomRolloffFactor; } void ALsource::eax_set_efx_air_absorption_factor() { - AirAbsorptionFactor = eax_.source.flAirAbsorptionFactor; + AirAbsorptionFactor = mEax.source.flAirAbsorptionFactor; } void ALsource::eax_set_efx_dry_gain_hf_auto() { - DryGainHFAuto = ((eax_.source.ulFlags & EAXSOURCEFLAGS_DIRECTHFAUTO) != 0); + DryGainHFAuto = ((mEax.source.ulFlags & EAXSOURCEFLAGS_DIRECTHFAUTO) != 0); } void ALsource::eax_set_efx_wet_gain_auto() { - WetGainAuto = ((eax_.source.ulFlags & EAXSOURCEFLAGS_ROOMAUTO) != 0); + WetGainAuto = ((mEax.source.ulFlags & EAXSOURCEFLAGS_ROOMAUTO) != 0); } void ALsource::eax_set_efx_wet_gain_hf_auto() { - WetGainHFAuto = ((eax_.source.ulFlags & EAXSOURCEFLAGS_ROOMHFAUTO) != 0); + WetGainHFAuto = ((mEax.source.ulFlags & EAXSOURCEFLAGS_ROOMHFAUTO) != 0); } void ALsource::eax1_set(const EaxCall& call, Eax1Props& props) @@ -4775,15 +4775,15 @@ void ALsource::eax_set(const EaxCall& call) const auto eax_version = call.get_version(); switch(eax_version) { - case 1: eax1_set(call, eax1_.d); break; - case 2: eax2_set(call, eax2_.d); break; - case 3: eax3_set(call, eax3_.d); break; - case 4: eax4_set(call, eax4_.d); break; - case 5: eax5_set(call, eax5_.d); break; + case 1: eax1_set(call, mEax1.d); break; + case 2: eax2_set(call, mEax2.d); break; + case 3: eax3_set(call, mEax3.d); break; + case 4: eax4_set(call, mEax4.d); break; + case 5: eax5_set(call, mEax5.d); break; default: eax_fail_unknown_property_id(); } - eax_changed_ = true; - eax_version_ = eax_version; + mEaxChanged = true; + mEaxVersion = eax_version; } void ALsource::eax_get_active_fx_slot_id(const EaxCall& call, const GUID* ids, size_t max_count) @@ -5135,11 +5135,11 @@ void ALsource::eax5_get(const EaxCall& call, const Eax5Props& props) void ALsource::eax_get(const EaxCall& call) { switch (call.get_version()) { - case 1: eax1_get(call, eax1_.i); break; - case 2: eax2_get(call, eax2_.i); break; - case 3: eax3_get(call, eax3_.i); break; - case 4: eax4_get(call, eax4_.i); break; - case 5: eax5_get(call, eax5_.i); break; + case 1: eax1_get(call, mEax1.i); break; + case 2: eax2_get(call, mEax2.i); break; + case 3: eax3_get(call, mEax3.i); break; + case 4: eax4_get(call, mEax4.i); break; + case 5: eax5_get(call, mEax5.i); break; default: eax_fail_unknown_version(); } } @@ -5168,10 +5168,10 @@ void ALsource::eax_set_al_source_send(ALeffectslot *slot, size_t sendidx, const void ALsource::eax_commit_active_fx_slots() { // Clear all slots to an inactive state. - eax_active_fx_slots_.fill(false); + mEaxActiveFxSlots.fill(false); // Mark the set slots as active. - for(const auto& slot_id : eax_.active_fx_slots.guidActiveFXSlots) + for(const auto& slot_id : mEax.active_fx_slots.guidActiveFXSlots) { if(slot_id == EAX_NULL_GUID) { @@ -5179,24 +5179,24 @@ void ALsource::eax_commit_active_fx_slots() else if(slot_id == EAX_PrimaryFXSlotID) { // Mark primary FX slot as active. - if(eax_primary_fx_slot_id_.has_value()) - eax_active_fx_slots_[*eax_primary_fx_slot_id_] = true; + if(mEaxPrimaryFxSlotId.has_value()) + mEaxActiveFxSlots[*mEaxPrimaryFxSlotId] = true; } else if(slot_id == EAXPROPERTYID_EAX50_FXSlot0) - eax_active_fx_slots_[0] = true; + mEaxActiveFxSlots[0] = true; else if(slot_id == EAXPROPERTYID_EAX50_FXSlot1) - eax_active_fx_slots_[1] = true; + mEaxActiveFxSlots[1] = true; else if(slot_id == EAXPROPERTYID_EAX50_FXSlot2) - eax_active_fx_slots_[2] = true; + mEaxActiveFxSlots[2] = true; else if(slot_id == EAXPROPERTYID_EAX50_FXSlot3) - eax_active_fx_slots_[3] = true; + mEaxActiveFxSlots[3] = true; } // Deactivate EFX auxiliary effect slots for inactive slots. Active slots // will be updated with the room filters. for(auto i = size_t{}; i < EAX_MAX_FXSLOTS; ++i) { - if(!eax_active_fx_slots_[i]) + if(!mEaxActiveFxSlots[i]) eax_set_al_source_send(nullptr, i, EaxAlLowPassParam{1.0f, 1.0f}); } } @@ -5207,38 +5207,38 @@ void ALsource::eax_commit_filters() eax_update_room_filters(); } -void ALsource::eax_commit() +void ALsource::eaxCommit() { - const auto primary_fx_slot_id = eax_al_context_->eax_get_primary_fx_slot_index(); - const auto is_primary_fx_slot_id_changed = (eax_primary_fx_slot_id_ != primary_fx_slot_id); + const auto primary_fx_slot_id = mEaxAlContext->eaxGetPrimaryFxSlotIndex(); + const auto is_primary_fx_slot_id_changed = (mEaxPrimaryFxSlotId != primary_fx_slot_id); - if(!eax_changed_ && !is_primary_fx_slot_id_changed) + if(!mEaxChanged && !is_primary_fx_slot_id_changed) return; - eax_primary_fx_slot_id_ = primary_fx_slot_id; - eax_changed_ = false; + mEaxPrimaryFxSlotId = primary_fx_slot_id; + mEaxChanged = false; - switch(eax_version_) + switch(mEaxVersion) { case 1: - eax1_.i = eax1_.d; - eax1_translate(eax1_.i, eax_); + mEax1.i = mEax1.d; + eax1_translate(mEax1.i, mEax); break; case 2: - eax2_.i = eax2_.d; - eax2_translate(eax2_.i, eax_); + mEax2.i = mEax2.d; + eax2_translate(mEax2.i, mEax); break; case 3: - eax3_.i = eax3_.d; - eax3_translate(eax3_.i, eax_); + mEax3.i = mEax3.d; + eax3_translate(mEax3.i, mEax); break; case 4: - eax4_.i = eax4_.d; - eax4_translate(eax4_.i, eax_); + mEax4.i = mEax4.d; + eax4_translate(mEax4.i, mEax); break; case 5: - eax5_.i = eax5_.d; - eax_ = eax5_.d; + mEax5.i = mEax5.d; + mEax = mEax5.d; break; } diff --git a/al/source.h b/al/source.h index 9dffbff7..0882288c 100644 --- a/al/source.h +++ b/al/source.h @@ -159,12 +159,12 @@ struct ALsource { #ifdef ALSOFT_EAX public: - void eax_initialize(ALCcontext *context) noexcept; - void eax_dispatch(const EaxCall& call); - void eax_commit(); - void eax_mark_as_changed() { eax_changed_ = true; } + void eaxInitialize(ALCcontext *context) noexcept; + void eaxDispatch(const EaxCall& call); + void eaxCommit(); + void eaxMarkAsChanged() noexcept { mEaxChanged = true; } - static ALsource* eax_lookup_source(ALCcontext& al_context, ALuint source_id) noexcept; + static ALsource* EaxLookupSource(ALCcontext& al_context, ALuint source_id) noexcept; private: using Exception = EaxSourceException; @@ -192,21 +192,18 @@ private: using EaxSends = std::array<EAXSOURCEALLSENDPROPERTIES, EAX_MAX_FXSLOTS>; using Eax1Props = EAXBUFFER_REVERBPROPERTIES; - struct Eax1State { Eax1Props i; // Immediate. Eax1Props d; // Deferred. }; using Eax2Props = EAX20BUFFERPROPERTIES; - struct Eax2State { Eax2Props i; // Immediate. Eax2Props d; // Deferred. }; using Eax3Props = EAX30SOURCEPROPERTIES; - struct Eax3State { Eax3Props i; // Immediate. Eax3Props d; // Deferred. @@ -245,17 +242,17 @@ private: Eax5Props d; // Deferred. }; - ALCcontext* eax_al_context_{}; - EaxFxSlotIndex eax_primary_fx_slot_id_{}; - EaxActiveFxSlots eax_active_fx_slots_{}; - int eax_version_{}; - bool eax_changed_{}; - Eax1State eax1_{}; - Eax2State eax2_{}; - Eax3State eax3_{}; - Eax4State eax4_{}; - Eax5State eax5_{}; - Eax5Props eax_{}; + ALCcontext* mEaxAlContext{}; + EaxFxSlotIndex mEaxPrimaryFxSlotId{}; + EaxActiveFxSlots mEaxActiveFxSlots{}; + int mEaxVersion{}; + bool mEaxChanged{}; + Eax1State mEax1{}; + Eax2State mEax2{}; + Eax3State mEax3{}; + Eax4State mEax4{}; + Eax5State mEax5{}; + Eax5Props mEax{}; // ---------------------------------------------------------------------- // Source validators diff --git a/alc/context.cpp b/alc/context.cpp index b5a9b6f9..cb2410f4 100644 --- a/alc/context.cpp +++ b/alc/context.cpp @@ -129,7 +129,7 @@ ALCcontext::~ALCcontext() mNumSources = 0; #ifdef ALSOFT_EAX - eax_uninitialize(); + eaxUninitialize(); #endif // ALSOFT_EAX mDefaultSlot = nullptr; @@ -265,8 +265,8 @@ void ALCcontext::applyAllUpdates() } #ifdef ALSOFT_EAX - if(eax_needs_commit_) - eax_commit(); + if(mEaxNeedsCommit) + eaxCommit(); #endif if(std::exchange(mPropsDirty, false)) @@ -302,19 +302,19 @@ void ForEachSource(ALCcontext *context, F func) } // namespace -bool ALCcontext::eax_is_capable() const noexcept +bool ALCcontext::eaxIsCapable() const noexcept { return eax_has_enough_aux_sends(); } -void ALCcontext::eax_uninitialize() noexcept +void ALCcontext::eaxUninitialize() noexcept { - if(!eax_is_initialized_) + if(!mEaxIsInitialized) return; - eax_is_initialized_ = false; - eax_is_tried_ = false; - eax_fx_slots_.uninitialize(); + mEaxIsInitialized = false; + mEaxIsTried = false; + mEaxFxSlots.uninitialize(); } ALenum ALCcontext::eax_eax_set( @@ -349,11 +349,11 @@ ALenum ALCcontext::eax_eax_set( default: eax_fail_unknown_property_set_id(); } - eax_needs_commit_ = true; + mEaxNeedsCommit = true; if(!call.is_deferred()) { - eax_commit(); + eaxCommit(); if(!mDeferUpdates) applyAllUpdates(); } @@ -397,9 +397,9 @@ ALenum ALCcontext::eax_eax_get( return AL_NO_ERROR; } -void ALCcontext::eax_set_last_error() noexcept +void ALCcontext::eaxSetLastError() noexcept { - eax_last_error_ = EAXERR_INVALID_OPERATION; + mEaxLastError = EAXERR_INVALID_OPERATION; } [[noreturn]] void ALCcontext::eax_fail(const char* message) @@ -441,41 +441,41 @@ void ALCcontext::eax_initialize_extensions() std::strlen(eax5_ext_name) + 1 + std::strlen(eax_x_ram_ext_name) + 1; - eax_extension_list_.reserve(string_max_capacity); + mEaxExtensionList.reserve(string_max_capacity); - if(eax_is_capable()) { - eax_extension_list_ += eax1_ext_name; - eax_extension_list_ += ' '; + if(eaxIsCapable()) { + mEaxExtensionList += eax1_ext_name; + mEaxExtensionList += ' '; - eax_extension_list_ += eax2_ext_name; - eax_extension_list_ += ' '; + mEaxExtensionList += eax2_ext_name; + mEaxExtensionList += ' '; - eax_extension_list_ += eax3_ext_name; - eax_extension_list_ += ' '; + mEaxExtensionList += eax3_ext_name; + mEaxExtensionList += ' '; - eax_extension_list_ += eax4_ext_name; - eax_extension_list_ += ' '; + mEaxExtensionList += eax4_ext_name; + mEaxExtensionList += ' '; - eax_extension_list_ += eax5_ext_name; - eax_extension_list_ += ' '; + mEaxExtensionList += eax5_ext_name; + mEaxExtensionList += ' '; } - eax_extension_list_ += eax_x_ram_ext_name; - eax_extension_list_ += ' '; + mEaxExtensionList += eax_x_ram_ext_name; + mEaxExtensionList += ' '; - eax_extension_list_ += mExtensionList; - mExtensionList = eax_extension_list_.c_str(); + mEaxExtensionList += mExtensionList; + mExtensionList = mEaxExtensionList.c_str(); } void ALCcontext::eax_initialize() { - if(eax_is_initialized_) + if(mEaxIsInitialized) return; - if(eax_is_tried_) + if(mEaxIsTried) eax_fail("No EAX."); - eax_is_tried_ = true; + mEaxIsTried = true; if(!eax_g_is_enabled) eax_fail("EAX disabled by a configuration."); @@ -486,7 +486,7 @@ void ALCcontext::eax_initialize() eax_update_speaker_configuration(); eax_initialize_fx_slots(); - eax_is_initialized_ = true; + mEaxIsInitialized = true; } bool ALCcontext::eax_has_no_default_effect_slot() const noexcept @@ -558,18 +558,18 @@ unsigned long ALCcontext::eax_detect_speaker_configuration() const void ALCcontext::eax_update_speaker_configuration() { - eax_speaker_config_ = eax_detect_speaker_configuration(); + mEaxSpeakerConfig = eax_detect_speaker_configuration(); } void ALCcontext::eax_set_last_error_defaults() noexcept { - eax_last_error_ = EAX_OK; + mEaxLastError = EAX_OK; } void ALCcontext::eax_session_set_defaults() noexcept { - eax_session_.ulEAXVersion = EAXCONTEXT_DEFAULTEAXSESSION; - eax_session_.ulMaxActiveSends = EAXCONTEXT_DEFAULTMAXACTIVESENDS; + mEaxSession.ulEAXVersion = EAXCONTEXT_DEFAULTEAXSESSION; + mEaxSession.ulMaxActiveSends = EAXCONTEXT_DEFAULTMAXACTIVESENDS; } void ALCcontext::eax4_context_set_defaults(Eax4Props& props) noexcept @@ -603,12 +603,12 @@ void ALCcontext::eax5_context_set_defaults(Eax5State& state) noexcept void ALCcontext::eax_context_set_defaults() { - eax5_context_set_defaults(eax123_); - eax4_context_set_defaults(eax4_); - eax5_context_set_defaults(eax5_); - eax_ = eax5_.i; - eax_version_ = 5; - eax_df_ = EaxDirtyFlags{}; + eax5_context_set_defaults(mEax123); + eax4_context_set_defaults(mEax4); + eax5_context_set_defaults(mEax5); + mEax = mEax5.i; + mEaxVersion = 5; + mEaxDf = EaxDirtyFlags{}; } void ALCcontext::eax_set_defaults() @@ -624,11 +624,11 @@ void ALCcontext::eax_dispatch_fx_slot(const EaxCall& call) if(!fx_slot_index.has_value()) eax_fail("Invalid fx slot index."); - auto& fx_slot = eax_get_fx_slot(*fx_slot_index); + auto& fx_slot = eaxGetFxSlot(*fx_slot_index); if(fx_slot.eax_dispatch(call)) { std::lock_guard<std::mutex> source_lock{mSourceLock}; - ForEachSource(this, [](ALsource& source){ source.eax_mark_as_changed(); }); + ForEachSource(this, std::mem_fn(&ALsource::eaxMarkAsChanged)); } } @@ -636,12 +636,12 @@ void ALCcontext::eax_dispatch_source(const EaxCall& call) { const auto source_id = call.get_property_al_name(); std::lock_guard<std::mutex> source_lock{mSourceLock}; - const auto source = ALsource::eax_lookup_source(*this, source_id); + const auto source = ALsource::EaxLookupSource(*this, source_id); if (source == nullptr) eax_fail("Source not found."); - source->eax_dispatch(call); + source->eaxDispatch(call); } void ALCcontext::eax_get_misc(const EaxCall& call) @@ -651,13 +651,13 @@ void ALCcontext::eax_get_misc(const EaxCall& call) case EAXCONTEXT_NONE: break; case EAXCONTEXT_LASTERROR: - call.set_value<ContextException>(eax_last_error_); + call.set_value<ContextException>(mEaxLastError); break; case EAXCONTEXT_SPEAKERCONFIG: - call.set_value<ContextException>(eax_speaker_config_); + call.set_value<ContextException>(mEaxSpeakerConfig); break; case EAXCONTEXT_EAXSESSION: - call.set_value<ContextException>(eax_session_); + call.set_value<ContextException>(mEaxSession); break; default: eax_fail_unknown_property_id(); @@ -721,29 +721,29 @@ void ALCcontext::eax_get(const EaxCall& call) { switch(call.get_version()) { - case 4: eax4_get(call, eax4_.i); break; - case 5: eax5_get(call, eax5_.i); break; + case 4: eax4_get(call, mEax4.i); break; + case 5: eax5_get(call, mEax5.i); break; default: eax_fail_unknown_version(); } } void ALCcontext::eax_context_commit_primary_fx_slot_id() { - eax_primary_fx_slot_index_ = eax_.guidPrimaryFXSlotID; + mEaxPrimaryFxSlotIndex = mEax.guidPrimaryFXSlotID; } void ALCcontext::eax_context_commit_distance_factor() { - if(mListener.mMetersPerUnit == eax_.flDistanceFactor) + if(mListener.mMetersPerUnit == mEax.flDistanceFactor) return; - mListener.mMetersPerUnit = eax_.flDistanceFactor; + mListener.mMetersPerUnit = mEax.flDistanceFactor; mPropsDirty = true; } void ALCcontext::eax_context_commit_air_absorbtion_hf() { - const auto new_value = level_mb_to_gain(eax_.flAirAbsorptionHF); + const auto new_value = level_mb_to_gain(mEax.flAirAbsorptionHF); if(mAirAbsorptionGainHF == new_value) return; @@ -764,15 +764,15 @@ void ALCcontext::eax_context_commit_macro_fx_factor() void ALCcontext::eax_initialize_fx_slots() { - eax_fx_slots_.initialize(*this); - eax_primary_fx_slot_index_ = eax_.guidPrimaryFXSlotID; + mEaxFxSlots.initialize(*this); + mEaxPrimaryFxSlotIndex = mEax.guidPrimaryFXSlotID; } void ALCcontext::eax_update_sources() { std::unique_lock<std::mutex> source_lock{mSourceLock}; auto update_source = [](ALsource &source) - { source.eax_commit(); }; + { source.eaxCommit(); }; ForEachSource(this, update_source); } @@ -783,10 +783,10 @@ void ALCcontext::eax_set_misc(const EaxCall& call) case EAXCONTEXT_NONE: break; case EAXCONTEXT_SPEAKERCONFIG: - eax_set<Eax5SpeakerConfigValidator>(call, eax_speaker_config_); + eax_set<Eax5SpeakerConfigValidator>(call, mEaxSpeakerConfig); break; case EAXCONTEXT_EAXSESSION: - eax_set<Eax5SessionAllValidator>(call, eax_session_); + eax_set<Eax5SessionAllValidator>(call, mEaxSession); break; default: eax_fail_unknown_property_id(); @@ -802,16 +802,16 @@ void ALCcontext::eax4_defer_all(const EaxCall& call, Eax4State& state) dst_d = src; if(dst_i.guidPrimaryFXSlotID != dst_d.guidPrimaryFXSlotID) - eax_df_ |= eax_primary_fx_slot_id_dirty_bit; + mEaxDf |= eax_primary_fx_slot_id_dirty_bit; if(dst_i.flDistanceFactor != dst_d.flDistanceFactor) - eax_df_ |= eax_distance_factor_dirty_bit; + mEaxDf |= eax_distance_factor_dirty_bit; if(dst_i.flAirAbsorptionHF != dst_d.flAirAbsorptionHF) - eax_df_ |= eax_air_absorption_hf_dirty_bit; + mEaxDf |= eax_air_absorption_hf_dirty_bit; if(dst_i.flHFReference != dst_d.flHFReference) - eax_df_ |= eax_hf_reference_dirty_bit; + mEaxDf |= eax_hf_reference_dirty_bit; } void ALCcontext::eax4_defer(const EaxCall& call, Eax4State& state) @@ -852,19 +852,19 @@ void ALCcontext::eax5_defer_all(const EaxCall& call, Eax5State& state) dst_d = src; if(dst_i.guidPrimaryFXSlotID != dst_d.guidPrimaryFXSlotID) - eax_df_ |= eax_primary_fx_slot_id_dirty_bit; + mEaxDf |= eax_primary_fx_slot_id_dirty_bit; if(dst_i.flDistanceFactor != dst_d.flDistanceFactor) - eax_df_ |= eax_distance_factor_dirty_bit; + mEaxDf |= eax_distance_factor_dirty_bit; if(dst_i.flAirAbsorptionHF != dst_d.flAirAbsorptionHF) - eax_df_ |= eax_air_absorption_hf_dirty_bit; + mEaxDf |= eax_air_absorption_hf_dirty_bit; if(dst_i.flHFReference != dst_d.flHFReference) - eax_df_ |= eax_hf_reference_dirty_bit; + mEaxDf |= eax_hf_reference_dirty_bit; if(dst_i.flMacroFXFactor != dst_d.flMacroFXFactor) - eax_df_ |= eax_macro_fx_factor_dirty_bit; + mEaxDf |= eax_macro_fx_factor_dirty_bit; } void ALCcontext::eax5_defer(const EaxCall& call, Eax5State& state) @@ -905,18 +905,18 @@ void ALCcontext::eax_set(const EaxCall& call) const auto version = call.get_version(); switch(version) { - case 4: eax4_defer(call, eax4_); break; - case 5: eax5_defer(call, eax5_); break; + case 4: eax4_defer(call, mEax4); break; + case 5: eax5_defer(call, mEax5); break; default: eax_fail_unknown_version(); } - if(version != eax_version_) - eax_df_ = ~EaxDirtyFlags(); - eax_version_ = version; + if(version != mEaxVersion) + mEaxDf = ~EaxDirtyFlags(); + mEaxVersion = version; } void ALCcontext::eax4_context_commit(Eax4State& state, EaxDirtyFlags& dst_df) { - if(eax_df_ == EaxDirtyFlags{}) + if(mEaxDf == EaxDirtyFlags{}) return; eax_context_commit_property<eax_primary_fx_slot_id_dirty_bit>( @@ -928,12 +928,12 @@ void ALCcontext::eax4_context_commit(Eax4State& state, EaxDirtyFlags& dst_df) eax_context_commit_property<eax_hf_reference_dirty_bit>( state, dst_df, &EAX40CONTEXTPROPERTIES::flHFReference); - eax_df_ = EaxDirtyFlags{}; + mEaxDf = EaxDirtyFlags{}; } void ALCcontext::eax5_context_commit(Eax5State& state, EaxDirtyFlags& dst_df) { - if(eax_df_ == EaxDirtyFlags{}) + if(mEaxDf == EaxDirtyFlags{}) return; eax_context_commit_property<eax_primary_fx_slot_id_dirty_bit>( @@ -947,25 +947,25 @@ void ALCcontext::eax5_context_commit(Eax5State& state, EaxDirtyFlags& dst_df) eax_context_commit_property<eax_macro_fx_factor_dirty_bit>( state, dst_df, &EAX50CONTEXTPROPERTIES::flMacroFXFactor); - eax_df_ = EaxDirtyFlags{}; + mEaxDf = EaxDirtyFlags{}; } void ALCcontext::eax_context_commit() { auto dst_df = EaxDirtyFlags{}; - switch(eax_version_) + switch(mEaxVersion) { case 1: case 2: case 3: - eax5_context_commit(eax123_, dst_df); + eax5_context_commit(mEax123, dst_df); break; case 4: - eax4_context_commit(eax4_, dst_df); + eax4_context_commit(mEax4, dst_df); break; case 5: - eax5_context_commit(eax5_, dst_df); + eax5_context_commit(mEax5, dst_df); break; } @@ -991,11 +991,11 @@ void ALCcontext::eax_context_commit() eax_update_sources(); } -void ALCcontext::eax_commit() +void ALCcontext::eaxCommit() { - eax_needs_commit_ = false; + mEaxNeedsCommit = false; eax_context_commit(); - eax_commit_fx_slots(); + eaxCommitFxSlots(); eax_update_sources(); } diff --git a/alc/context.h b/alc/context.h index 941a3d80..926a76a4 100644 --- a/alc/context.h +++ b/alc/context.h @@ -185,10 +185,10 @@ public: #ifdef ALSOFT_EAX public: - bool has_eax() const noexcept { return eax_is_initialized_; } - bool eax_is_capable() const noexcept; + bool hasEax() const noexcept { return mEaxIsInitialized; } + bool eaxIsCapable() const noexcept; - void eax_uninitialize() noexcept; + void eaxUninitialize() noexcept; ALenum eax_eax_set( const GUID* property_set_id, @@ -204,21 +204,21 @@ public: ALvoid* property_value, ALuint property_value_size); - void eax_set_last_error() noexcept; + void eaxSetLastError() noexcept; - EaxFxSlotIndex eax_get_primary_fx_slot_index() const noexcept - { return eax_primary_fx_slot_index_; } + EaxFxSlotIndex eaxGetPrimaryFxSlotIndex() const noexcept + { return mEaxPrimaryFxSlotIndex; } - const ALeffectslot& eax_get_fx_slot(EaxFxSlotIndexValue fx_slot_index) const - { return eax_fx_slots_.get(fx_slot_index); } - ALeffectslot& eax_get_fx_slot(EaxFxSlotIndexValue fx_slot_index) - { return eax_fx_slots_.get(fx_slot_index); } + const ALeffectslot& eaxGetFxSlot(EaxFxSlotIndexValue fx_slot_index) const + { return mEaxFxSlots.get(fx_slot_index); } + ALeffectslot& eaxGetFxSlot(EaxFxSlotIndexValue fx_slot_index) + { return mEaxFxSlots.get(fx_slot_index); } - bool eax_needs_commit() const noexcept { return eax_needs_commit_; } - void eax_commit(); + bool eaxNeedsCommit() const noexcept { return mEaxNeedsCommit; } + void eaxCommit(); - void eax_commit_fx_slots() - { eax_fx_slots_.commit(); } + void eaxCommitFxSlots() + { mEaxFxSlots.commit(); } private: static constexpr auto eax_primary_fx_slot_id_dirty_bit = EaxDirtyFlags{1} << 0; @@ -383,25 +383,25 @@ private: } }; - bool eax_is_initialized_{}; - bool eax_is_tried_{}; + bool mEaxIsInitialized{}; + bool mEaxIsTried{}; - long eax_last_error_{}; - unsigned long eax_speaker_config_{}; + long mEaxLastError{}; + unsigned long mEaxSpeakerConfig{}; - EaxFxSlotIndex eax_primary_fx_slot_index_{}; - EaxFxSlots eax_fx_slots_{}; + EaxFxSlotIndex mEaxPrimaryFxSlotIndex{}; + EaxFxSlots mEaxFxSlots{}; - int eax_version_{}; // Current EAX version. - bool eax_needs_commit_{}; - EaxDirtyFlags eax_df_{}; // Dirty flags for the current EAX version. - Eax5State eax123_{}; // EAX1/EAX2/EAX3 state. - Eax4State eax4_{}; // EAX4 state. - Eax5State eax5_{}; // EAX5 state. - Eax5Props eax_{}; // Current EAX state. - EAXSESSIONPROPERTIES eax_session_{}; + int mEaxVersion{}; // Current EAX version. + bool mEaxNeedsCommit{}; + EaxDirtyFlags mEaxDf{}; // Dirty flags for the current EAX version. + Eax5State mEax123{}; // EAX1/EAX2/EAX3 state. + Eax4State mEax4{}; // EAX4 state. + Eax5State mEax5{}; // EAX5 state. + Eax5Props mEax{}; // Current EAX state. + EAXSESSIONPROPERTIES mEaxSession{}; - std::string eax_extension_list_{}; + std::string mEaxExtensionList{}; [[noreturn]] static void eax_fail(const char* message); [[noreturn]] static void eax_fail_unknown_property_set_id(); @@ -439,7 +439,7 @@ private: dst_d = src; if(dst_i != dst_d) - eax_df_ |= TDirtyBit; + mEaxDf |= TDirtyBit; } template< @@ -450,12 +450,12 @@ private: void eax_context_commit_property(TState& state, EaxDirtyFlags& dst_df, TMemberResult TProps::*member) noexcept { - if((eax_df_ & TDirtyBit) != EaxDirtyFlags{}) + if((mEaxDf & TDirtyBit) != EaxDirtyFlags{}) { dst_df |= TDirtyBit; const auto& src_d = state.d.*member; state.i.*member = src_d; - eax_.*member = src_d; + mEax.*member = src_d; } } |