Audioplayer StopFcn is executed even when I pause my audioplayer
Show older comments
Hey everyone,
I should start by saying that I am fairly new to MATLAB.
I am using the audioplayer object in my matlab application to play an audio track. I want to perform certain actions when the audio track comes to an end. I did some searching and found out that I can make use of Audioplayer's StopFcn and use a callback function along with it.
Here is my code:
app.SoundPlayer.StopFcn = createCallbackFcn(app, @PlayerStoppedFcn, false);
function PlayerStoppedFcn(app)
disp("player stopped or paused")
end
Within my application I have start, stop, pause and resume buttons. I had the assumption that the StopFcn would only execute when the track ends or stops. However, even when I pause my audioplayer using the pause function, my callback function is called.
I wanted to know if there is a way around this? I only want my actions to take place at the very end of the track and not when it is paused, etc.
Thanks in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!