Audioplayer StopFcn is executed even when I pause my audioplayer
显示 更早的评论
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!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!