void USoundMix::BeginDestroy() { if (!GExitPurge && GEngine) { FAudioDeviceManager* AudioDeviceManager = GEngine->GetAudioDeviceManager(); if (AudioDeviceManager) { AudioDeviceManager->RemoveSoundMix(this); } } Super::BeginDestroy(); }
void FAudioDeviceManager::RemoveSoundMix(USoundMix* SoundMix) { if (!IsInAudioThread()) { DECLARE_CYCLE_STAT(TEXT("FAudioThreadTask.RemoveSoundMix"), STAT_AudioRemoveSoundMix, STATGROUP_AudioThreadCommands); FAudioDeviceManager* AudioDeviceManager = this; FAudioThread::RunCommandOnAudioThread([AudioDeviceManager, SoundMix]() { AudioDeviceManager->RemoveSoundMix(SoundMix); }, GET_STATID(STAT_AudioRemoveSoundMix)); return; } for (FAudioDevice* AudioDevice : Devices) { if (AudioDevice) { AudioDevice->RemoveSoundMix(SoundMix); } } }