We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSound,  Music Libraries › [Minim] Tell if an AudioPlayer finishes playing
Page Index Toggle Pages: 1
[Minim] Tell if an AudioPlayer finishes playing? (Read 780 times)
[Minim] Tell if an AudioPlayer finishes playing?
Apr 28th, 2008, 5:29am
 
Hello,

This may be a newb question, but I haven't been able to find a ready answer to it.  So, sorry if it steals your time.

I'm trying to play a series of audio files in succession in a single AudioPlayer (though this problem would still be present were I using multiple instances of AudioPlayer), loading a new song every time the AudioPlayer finishes the current song.  My issue is detecting when the AudioPlayer has finished the current play, since I haven't found an easy description of how to do so in the documentation. I have tried two possible methods to solve this problem based on my current information, with bad results:

a) comparing the values for length() and position().  This is a possible solution, since in my limited set of test cases at the end of the track the difference between these two values is always 26, but I am surprised that the difference is present at all and so am wary about using such a comparison as any kind of permanent solution.

b) using the isPlaying() status.  Since I want to support pausing, just checking isPlaying() will not work, but additionally, as noted in the minim documentation, isPlaying() will not return false at the end of the track unless you make the AudioPlayer loop the song; I have tried a hack of using loop(0) but with mixed results (seemed to work, then didn't).

Thanks much in advance for any notes or advice.
Re: [Minim] Tell if an AudioPlayer finishes playin
Reply #1 - Apr 30th, 2008, 5:17am
 
Yah, you are right that this is an issue in the current release and I'm pretty sure I've fixed it already, but haven't worked on the library in a while so my memory is a bit hazy on that one. In any event, when I do the next release if you still find this to be a problem you can contact me to directly to complain. Smiley
Page Index Toggle Pages: 1