How can handle audio file

Hello Guys,
How can stop audio file. I am loading “.wav” audio file and play it.
Now, “ProcessBlock” function continuous running. So, how can i stop audio file to play?

Add a flag variable into your code that determines if the file playback should be running or not?

Its like funny, i have used it and working fine. But will it good to use means is there any issue if we use flags. Because we can handle some functionality like play, stop, mute by using simple flags, but “ProcessBlock” function running continuously.

The host application determines how it runs processBlock. Some will run it continuously, others might stop doing the calls when the host transport is stopped or if a track is muted etc. This is just something you have to take into account when developing plugins. What exactly are you trying to do?

Thanks Xenakios,
Actually, my application is to operate audio files when particular button pressed like as below:
Open button- browse and load audio file.
Play button- play loaded file.
Stop button- stop loaded file.
Mute/unmute button- mute/unmute audio file.
Save button- record and save current loaded file(not whole file, but particular portion).

So, use flags is better idea or we have to use something else. Because ProcessBlock will continue run once we load any file.

Hello Xenakios,
Should we have to continue with flags or we have to use another options?