How to know when a song is done?

BlitzMax Forums/BlitzMax Programming/How to know when a song is done?

Bremer(Posted 2007) [#1]
I am working on a kiosk like program for my own use. And with this program I am looking to play music as mp3 files picked from a list of albums.

I have most of the interface working, but now I am looking to find a way of knowing when a track is done playing?

Can this be done within bmax itself with current audio options? And if so, how would you go about it?


GfK(Posted 2007) [#2]
tChannel.Playing() or ChannelPlaying(tChannel)


Bremer(Posted 2007) [#3]
Would this work with eg. openAL?

And could someone please post a very basic openAL example. I have searched the forum for examples, but have not found anything simple.

I did found some indication about having to pick the openAL driver. The reason I am asking is that the following code does not work with mp3, so it looks like more work is needed.

sound = LoadSound ("music.mp3")
channel=PlaySound (sound)
While ChannelPlaying(channel)
	Print ChannelPlaying(channel)
Wend



ziggy(Posted 2007) [#4]
mp3 is not supported by BlitzMax due license issues, use ogg instead, it sounds much better.


Bremer(Posted 2007) [#5]
Yes, I have found out that mp3 is not supported directly from bmax, but surely there must be some options available. I do not really feel like re-encoding my entire cd collection, it would take months and I would have to get the cds out of storage.

If someone have a small example of how this can be done, or a link to examples, I would appreciate it.


GfK(Posted 2007) [#6]
If you need to use MP3 then you should consider REDi's MaxMod since it directly supports MP3 format (among others).

Unfortunately his site's been down for ages.


Bremer(Posted 2007) [#7]
Thanks for the help so far. I came across the BASS dll (found here: http://www.un4seen.com/) and by looking at the code that comes with the package I managed to put something together that lets me do what I needed.