Detect end of music
BlitzPlus Forums/BlitzPlus Programming/Detect end of music| 
 | ||
| I'm sure I saw someone ask a similar thing about playsound recently to no avail ... is there any way to detect the end of a music track so you can play another one!  i.e. Use playmusic, when the track stops, play the next one. thx | 
| 
 | ||
| if not channelplaying(channel) channel=playmusic("nextmusic.mp3") end if | 
| 
 | ||
| yepp, thats it. Or "channelplaying(chn)=0" See my game Cardwar that does this. | 
| 
 | ||
| Thanks guys, that's great! | 
| 
 | ||
| Just another thing, if you don't need the track to start the instant the previous one stops you don't have to poll the channel playing every game loop. I know it's obvious, but thought I'd mention it. | 
| 
 | ||
| thanks Rob but I do want it to play one after the other like a CD player.  I might program a 1-2 sec delay between each track though. I presume the same command works for samples played with PlaySound too. | 
| 
 | ||
| You presume correctly Grey Alien, as long as you assign them to a channel ;) |