aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-02-05 10:34:21 -0800
committerChris Robinson <[email protected]>2023-02-05 10:34:21 -0800
commitd7cabd2c57025c7f3dad81c22c397ac27183102e (patch)
treed47ce186a916ed5bf0181c8d014e494a6e7048ca /al/source.cpp
parent70c14cd560db819f180073052f4c2bfae5cf3c31 (diff)
Don't set an EAX version by default for sources
Presuming sources start in a neutral state for EAX effects, that is they're not affected by EAX by default, there's no need to set an active EAX state for one until the app sets an EAX property on it. Since the deferred and immediate properties are stored independently per-version, they can always be set to defaults, and simply not have a particular version committed as active until the app sets an EAX property, which will inherently set the active version.
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp34
1 files changed, 8 insertions, 26 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;