I am downloading audio data from server and creating USoundWaveProcedural objects and playing them via UAudioComponent as follows:
this->audioComponent = FindComponentByClass<UAudioComponent>(); this->audioComponent->OnAudioFinished.AddDynamic(this, &AStudioManager::handleAudioFinish); USoundWaveProcedural *audio = NewObject<USoundWaveProcedural>(); audio->SetSampleRate(sampleRate); audio->NumChannels = numberOfChannels; audio->Duration = INDEFINITELY_LOOPING_DURATION; audio->SoundGroup = SOUNDGROUP_Voice; audio->bLooping = false; audio->QueueAudio(reqdAudioData, audioData.size()); this->audioComponent->SetSound((USoundBase*)audio); this->audioComponent->Play();
It works fine.
However, my handleAudioFinish method is not called because the duration is set to INDEFINITELY_LOOPING_DURATION. I tried to not set the Duration at all and also tried setting to 0.0 but it did not help.
What can I do to make the handleAudioFinish method get called after the audio being played is finished irrespective of the audio length?
Thanks in Advance,