diff options
Diffstat (limited to 'al')
-rw-r--r-- | al/source.cpp | 34 | ||||
-rw-r--r-- | al/source.h | 10 |
2 files changed, 10 insertions, 34 deletions
diff --git a/al/source.cpp b/al/source.cpp index 8e67ac64..7dc5df37 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -2675,12 +2675,6 @@ START_API_FUNC context->setError(AL_INVALID_VALUE, "Generating %d sources", n); if(n <= 0) [[unlikely]] return; -#ifdef ALSOFT_EAX - const bool has_eax{context->has_eax()}; - std::unique_lock<std::mutex> proplock{}; - if(has_eax) - proplock = std::unique_lock<std::mutex>{context->mPropLock}; -#endif std::unique_lock<std::mutex> srclock{context->mSourceLock}; ALCdevice *device{context->mALDevice.get()}; if(static_cast<ALuint>(n) > device->SourcesMax-context->mNumSources) @@ -2701,18 +2695,11 @@ START_API_FUNC sources[0] = source->id; #ifdef ALSOFT_EAX - if(has_eax) - source->eax_initialize(context.get()); + source->eax_initialize(context.get()); #endif // ALSOFT_EAX } else { -#ifdef ALSOFT_EAX - auto eax_sources = al::vector<ALsource*>{}; - if(has_eax) - eax_sources.reserve(static_cast<ALuint>(n)); -#endif // ALSOFT_EAX - al::vector<ALuint> ids; ids.reserve(static_cast<ALuint>(n)); do { @@ -2720,16 +2707,10 @@ START_API_FUNC ids.emplace_back(source->id); #ifdef ALSOFT_EAX - if(has_eax) - eax_sources.emplace_back(source); + source->eax_initialize(context.get()); #endif // ALSOFT_EAX } while(--n); std::copy(ids.cbegin(), ids.cend(), sources); - -#ifdef ALSOFT_EAX - for(auto& eax_source : eax_sources) - eax_source->eax_initialize(context.get()); -#endif // ALSOFT_EAX } } END_API_FUNC @@ -3851,10 +3832,8 @@ void ALsource::eax_initialize(ALCcontext *context) noexcept { assert(context != nullptr); eax_al_context_ = context; - eax_primary_fx_slot_id_ = eax_al_context_->eax_get_primary_fx_slot_index(); - eax_version_ = eax_al_context_->eax_get_version(); + eax_primary_fx_slot_id_ = context->eax_get_primary_fx_slot_index(); eax_set_defaults(); - eax_commit(EaxCommitType::forced); } void ALsource::eax_dispatch(const EaxCall& call) @@ -5094,12 +5073,15 @@ void ALsource::eax_commit_filters() eax_update_room_filters(); } -void ALsource::eax_commit(EaxCommitType commit_type) +void ALsource::eax_commit() { + if(!eax_version_) + return; + 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); - if(commit_type != EaxCommitType::forced && !is_primary_fx_slot_id_changed && !eax_changed_) + if(!eax_changed_ && !is_primary_fx_slot_id_changed) return; eax_primary_fx_slot_id_ = primary_fx_slot_id; diff --git a/al/source.h b/al/source.h index bcee0e18..2419df47 100644 --- a/al/source.h +++ b/al/source.h @@ -161,21 +161,16 @@ struct ALsource { public: void eax_initialize(ALCcontext *context) noexcept; void eax_dispatch(const EaxCall& call); - void eax_commit() { eax_commit(EaxCommitType::normal); } + void eax_commit(); void eax_commit_and_update(); void eax_mark_as_changed() { eax_changed_ = true; } - bool eax_is_initialized() const noexcept { return eax_al_context_ != nullptr; } + bool eax_is_initialized() const noexcept { return eax_version_ != 0; } static ALsource* eax_lookup_source(ALCcontext& al_context, ALuint source_id) noexcept; private: using Exception = EaxSourceException; - enum class EaxCommitType { - normal, - forced, - }; - static constexpr auto eax_max_speakers = 9; using EaxFxSlotIds = const GUID* [EAX_MAX_FXSLOTS]; @@ -1044,7 +1039,6 @@ private: const EaxAlLowPassParam &filter); void eax_commit_active_fx_slots(); - void eax_commit(EaxCommitType commit_type); #endif // ALSOFT_EAX }; |