aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--al/auxeffectslot.cpp7
-rw-r--r--al/auxeffectslot.h8
-rw-r--r--alc/alc.cpp1
3 files changed, 14 insertions, 2 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 1f35b344..5f71ea97 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -310,8 +310,6 @@ START_API_FUNC
} while(--count);
std::copy(ids.cbegin(), ids.cend(), effectslots);
}
-
- AddActiveEffectSlots(effectslots, static_cast<ALuint>(n), context.get());
}
END_API_FUNC
@@ -404,6 +402,11 @@ START_API_FUNC
context->setError(err, "Effect initialization failed");
return;
}
+ if(slot->mState == SlotState::Initial)
+ {
+ AddActiveEffectSlots(&slot->id, 1, context.get());
+ slot->mState = SlotState::Playing;
+ }
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h
index 79373f45..3977b650 100644
--- a/al/auxeffectslot.h
+++ b/al/auxeffectslot.h
@@ -40,6 +40,12 @@ struct ALeffectslotProps {
};
+enum class SlotState : ALenum {
+ Initial = AL_INITIAL,
+ Playing = AL_PLAYING,
+ Stopped = AL_STOPPED,
+};
+
struct ALeffectslot {
float Gain{1.0f};
bool AuxSendAuto{true};
@@ -56,6 +62,8 @@ struct ALeffectslot {
std::atomic_flag PropsClean;
+ SlotState mState{SlotState::Initial};
+
RefCount ref{0u};
struct {
diff --git a/alc/alc.cpp b/alc/alc.cpp
index c74c1ad8..a8ec407f 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2459,6 +2459,7 @@ void ALCcontext::init()
{
auxslots = ALeffectslot::CreatePtrArray(1);
(*auxslots)[0] = mDefaultSlot.get();
+ mDefaultSlot->mState = SlotState::Playing;
}
mActiveAuxSlots.store(auxslots, std::memory_order_relaxed);