MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / FreeSource

Function FreeSource

Engine/lib/openal-soft/al/source.cpp:726–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726void FreeSource(ALCcontext *context, ALsource *source)
727{
728 const ALuint id{source->id - 1};
729 const size_t lidx{id >> 6};
730 const ALuint slidx{id & 0x3f};
731
732 if(IsPlayingOrPaused(source))
733 {
734 if(Voice *voice{GetSourceVoice(source, context)})
735 {
736 VoiceChange *vchg{GetVoiceChanger(context)};
737
738 voice->mPendingChange.store(true, std::memory_order_relaxed);
739 vchg->mVoice = voice;
740 vchg->mSourceID = source->id;
741 vchg->mState = VChangeState::Stop;
742
743 SendVoiceChanges(context, vchg);
744 }
745 }
746
747 al::destroy_at(source);
748
749 context->mSourceList[lidx].FreeMask |= 1_u64 << slidx;
750 context->mNumSources--;
751}
752
753
754inline ALsource *LookupSource(ALCcontext *context, ALuint id) noexcept

Callers 1

source.cppFile · 0.85

Calls 5

IsPlayingOrPausedFunction · 0.85
GetSourceVoiceFunction · 0.85
GetVoiceChangerFunction · 0.85
SendVoiceChangesFunction · 0.85
destroy_atFunction · 0.85

Tested by

no test coverage detected