diff options
author | Boris I. Bendovsky <[email protected]> | 2022-02-08 18:20:46 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2022-02-08 08:20:46 -0800 |
commit | d42077680890fee9e8f150e99bc259435bbe5d44 (patch) | |
tree | 0606b99eba2a09c18a8b82a2b5aafe11557eba91 /al/source.cpp | |
parent | f23c7fe8ba77d4d406d37c60501f961313db7d1a (diff) |
EAX various fixes (#657)
* [EAX] Fix effect GUID validation
Only NULL and REVERB was valid.
* [EAX] Fix default FX slot flags
EAX4 and EAX5 both sets to ENVIRONMENT.
* [EAX] Set default values for legacy FX slots in the initialization
* [EAX] Fix FX slot locking policy
Fail on attempt to load an effect or change a lock for EAX4 "set" call.
Unlock legacy FX slots on any EAX5 call.
* [EAX] Allow DEFER flag for "get" calls.
* [EAX] Make speaker configuration read-only
* [EAX] Initialize speaker configuration
* [EAX] Commit EAX source on a 3D source parameter call
Reference: EAX 4.0 Programmer's Guide
* [EAX] Commit EAX source on a 3D listener parameter call
Reference: EAX 4.0 Programmer's Guide
* [EAX] Commit source when it begins to play
Reference: EAX 4.0 Programmer's Guide
Diffstat (limited to 'al/source.cpp')
-rw-r--r-- | al/source.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/al/source.cpp b/al/source.cpp index 87696147..08049bce 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -74,7 +74,6 @@ #ifdef ALSOFT_EAX #include "eax_exception.h" -#include "eax_globals.h" #endif // ALSOFT_EAX namespace { @@ -1177,6 +1176,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a CHECKVAL(values[0] >= 0.0f && values[0] <= 360.0f); Source->InnerAngle = values[0]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_CONE_OUTER_ANGLE: @@ -1184,6 +1186,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a CHECKVAL(values[0] >= 0.0f && values[0] <= 360.0f); Source->OuterAngle = values[0]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_GAIN: @@ -1198,6 +1203,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a CHECKVAL(values[0] >= 0.0f); Source->MaxDistance = values[0]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_ROLLOFF_FACTOR: @@ -1205,6 +1213,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a CHECKVAL(values[0] >= 0.0f); Source->RolloffFactor = values[0]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_REFERENCE_DISTANCE: @@ -1212,6 +1223,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a CHECKVAL(values[0] >= 0.0f); Source->RefDistance = values[0]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_MIN_GAIN: @@ -1314,6 +1328,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a Source->Position[0] = values[0]; Source->Position[1] = values[1]; Source->Position[2] = values[2]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_VELOCITY: @@ -1323,6 +1340,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a Source->Velocity[0] = values[0]; Source->Velocity[1] = values[1]; Source->Velocity[2] = values[2]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_DIRECTION: @@ -1332,6 +1352,9 @@ bool SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a Source->Direction[0] = values[0]; Source->Direction[1] = values[1]; Source->Direction[2] = values[2]; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_ORIENTATION: @@ -1410,6 +1433,9 @@ bool SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a CHECKVAL(values[0] == AL_FALSE || values[0] == AL_TRUE); Source->HeadRelative = values[0] != AL_FALSE; +#ifdef ALSOFT_EAX + Source->eax_commit(); +#endif // ALSOFT_EAX return UpdateSourceProps(Source, Context); case AL_LOOPING: @@ -3099,6 +3125,9 @@ START_API_FUNC cur = cur->mNext.load(std::memory_order_relaxed); } Voice *voice{GetSourceVoice(source, context.get())}; +#ifdef ALSOFT_EAX + auto eax_is_begins_to_play = false; +#endif // ALSOFT_EAX switch(GetSourceState(source, voice)) { case AL_PAUSED: @@ -3111,6 +3140,9 @@ START_API_FUNC cur->mSourceID = source->id; cur->mState = VChangeState::Play; source->state = AL_PLAYING; +#ifdef ALSOFT_EAX + eax_is_begins_to_play = true; +#endif // ALSOFT_EAX continue; case AL_PLAYING: @@ -3127,6 +3159,9 @@ START_API_FUNC default: assert(voice == nullptr); cur->mOldVoice = nullptr; +#ifdef ALSOFT_EAX + eax_is_begins_to_play = true; +#endif // ALSOFT_EAX break; } @@ -3173,6 +3208,11 @@ START_API_FUNC cur->mVoice = voice; cur->mSourceID = source->id; cur->mState = VChangeState::Play; + +#ifdef ALSOFT_EAX + if (eax_is_begins_to_play) + source->eax_commit(); +#endif // ALSOFT_EAX } if LIKELY(tail) SendVoiceChanges(context.get(), tail); @@ -3715,6 +3755,14 @@ void ALsource::eax_update( } } +void ALsource::eax_commit() +{ + if (!eax_is_initialized()) + return; + + eax_apply_deferred(); +} + ALsource* ALsource::eax_lookup_source( ALCcontext& al_context, ALuint source_id) noexcept |