Hello!
I’ve been knocking up blueprint nodes to stop / start specific sound cues as required by scripting from Blueprint - I have however encountered an issue in that FActiveSound::Stop doesn’t appear to work when I’m calling it, though it works as expected when a sound cue that is currently playing ends - I’m not sure why this is the case?
Where FActiveSound::Stop should iterate over the waveform instances and stop the owning source, the iterator fails completely. I’m not entirely sure why this would be the case.
Sample code (AudioData is a TArray of FManagedAudioData):
struct FManagedAudioData
{
FActiveSound* Sound;
FVector Location;
float VolumeMultiplier;
float PitchMultiplier;
class USoundAttenuation* AttenuationSettings;
float ElapsedTime;
};
void ARedAudioManager::StopManagedAudio(bool bPermanentlyStop)
{
for (int i = 0; i < AudioData.Num(); i++)
{
FAudioDevice* AudioDevice = GEngine->GetAudioDevice();
if (AudioDevice)
AudioData[i].Sound->Stop(AudioDevice);
}
}
Thanks!