# Play two audio from C++ one after another

**URL:** <https://forums.unrealengine.com/t/play-two-audio-from-c-one-after-another/116420>\
**Category:** Audio\
**Tags:** unreal-engine\
**Created:** [September 18, 2018, 4:54am UTC](https://forums.unrealengine.com/t/play-two-audio-from-c-one-after-another/116420 "2018-09-18T04:54:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![meetakshay99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@meetakshay99](https://forums.unrealengine.com/u/meetakshay99)\
**Post date:** [September 18, 2018, 4:54am UTC](https://forums.unrealengine.com/t/play-two-audio-from-c-one-after-another/116420/1 "2018-09-18T04:54:38Z")

</div>

Hello,

I am downloading audio data from server and creating USoundWaveProcedural objects and playing them via UAudioComponent as follows:

```auto

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,  
Akshay Shah.
