SimpleMusic 0.2 --------------- Introduction ------------ SimpleMusic is a plugin for eboxy. It provides a script-accessable object which you can use to play music files (mod, midi, mp3, ogg, and many others - any that are supported by SDL_mixer). SimpleMusic is a very basic wrapper around SDL_mixer's music functions. Currently you can tell it to play, pause, stop, and automatically repeat, and that's about it. It's mostly a demo of how to write a plugin, but it happens to be useful as well. Of course, you will need SDL_mixer plus a few other libraries installed for this to work. SDL_Mixer is available from: http://www.libsdl.org/projects/SDL_mixer/ Usage ----- In the system OnLoad event of your XML file, you need to load the SimpleMusic plugin. Then somewhere else you need to tell SimpleMusic what file to load and then tell it to play (eg. in each page's OnLoad event, so that you have a different tune for each page). Do this like so: ... loadplugin "simplemusic" simplemusic.autorepeat = "true" ... ... simplemusic.file = "rock.mp3" simplemusic.play() ... simplemusic.file = "jazz.mp3" simplemusic.play() ... ... Reference --------- Properties: file The file to play. Changing this property during playback will cause playback to stop. autorepeat Controls looping - set to true to loop forever, otherwise the file is played just once. Methods: play() Sets the file browser up to use the named listbox widget. pause() Pauses playback. If playback is already paused, it is resumed. stop() Stops playback. Events: OnFinish Occurs when the file has finished playing (if autorepeat is disabled). Notes ----- - A few MP3s will not play with SimpleMusic - for some reason SDL_mixer doesn't like them. - There is a short delay between calling methods (play, pause etc) and the music actually starting. This is an issue with SDL_mixer. Changes ------- 0.2: - Updated for eboxy 0.4.0 plugin API - Calling pause() when paused now resumes playback - Added OnFinish event - Now plays audio at 44100Hz instead of 22050