Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- music_player.h
- supports per font (or common) music player function
- note: for each font where you want their own music to play, please make sure
- your preset has a font search path, and that you add the track folder like so:
- ;font/music
- then create your music folder under that font, and populate it with 00xx.wav files
- note: if you want to share common music between fonts, try something like this:
- ;common/music
- */
- // music_player uses its own button to start playing musicXX.wav files
- // found anywhere in the font search path (see install info above)
- // TRIGGER + POINT UP to play NEXT music, TRIGGER + POINT DOWN to play PREV music
- // the original music trigger button STOPS the new music_player
- // and will also start/stop the original track player
- // TODO: add another mode that
- // checks when music is finished, then starts the other music
- // until all are played through, then stop
- // next and previous music
- case EVENTID(BUTTON_POWER, EVENT_HELD_LONG, MODE_OFF):
- // Edit to whatever button action you want to activate the music, saber off or on or both.
- if (!mode_volume_)
- {
- if (pointing_down_)
- {
- // PREV music
- playNumber--;
- if (playNumber <1)
- {
- playNumber=10;
- ::CommandParser::DoParse("play", "next.wav");
- }
- else
- ::CommandParser::DoParse("play", "prev.wav");
- }
- else
- {
- // NEXT music
- playNumber++;
- if (playNumber >10)
- {
- playNumber=1;
- ::CommandParser::DoParse("play", "prev.wav");
- }
- else
- ::CommandParser::DoParse("play", "next.wav");
- }
- // music selection
- if (playNumber > 9)
- {
- playFile = "music10.wav";
- }
- else if (playNumber > 8)
- {
- playFile = "music09.wav";
- }
- else if (playNumber > 7)
- {
- playFile = "music08.wav";
- }
- else if (playNumber > 6)
- {
- playFile = "music07.wav";
- }
- else if (playNumber > 5)
- {
- playFile = "music06.wav";
- }
- else if (playNumber > 4)
- {
- playFile = "music05.wav";
- }
- else if (playNumber > 3)
- {
- playFile = "music04.wav";
- }
- else if (playNumber > 2)
- {
- playFile = "music03.wav";
- }
- else if (playNumber > 1)
- {
- playFile = "music02.wav";
- }
- else
- {
- playFile = "music01.wav";
- }
- // play sequential music
- ::CommandParser::DoParse("play_track", playFile);
- }
- return true;
Advertisement
Add Comment
Please, Sign In to add comment