NoSloppy

Untitled

Oct 4th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. track_player.h
  2.  
  3. supports per font (or common) track player function
  4.  
  5. note: for each font where you want their own tracks to play, please make sure
  6. your preset has a font search path, and that you add the track folder like so:
  7.  
  8. ;font/tracks
  9.  
  10. then create your tracks folder under that font, and populate it with 00xx.wav files
  11.  
  12. note: if you want to share common tracks between fonts, try something like this:
  13.  
  14. ;common/tracks
  15.  
  16. */
  17.  
  18. // track_player uses its own button to start playing trackXX.wav files
  19. // found anywhere in the font search path (see install info above)
  20. // TRIGGER + POINT UP to play NEXT track, TRIGGER + POINT DOWN to play PREV track
  21. // the original music trigger button STOPS the new track_player
  22. // and will also start/stop the original track player
  23.  
  24. // another mode
  25.  
  26. // check when track is finished, start the other track
  27. // until all are played through, then stop
  28.  
  29. // next and previous track
  30.  
  31. if (pointing_down_)
  32. {
  33. // PREV track
  34. playNumber--;
  35. if (playNumber <1)
  36. {
  37. playNumber=10;
  38. ::CommandParser::DoParse("play", "next.wav");
  39. }
  40. else
  41. ::CommandParser::DoParse("play", "prev.wav");
  42.  
  43. }
  44. else
  45. {
  46. // NEXT track
  47. playNumber++;
  48. if (playNumber >10)
  49. {
  50. playNumber=1;
  51. ::CommandParser::DoParse("play", "prev.wav");
  52. }
  53. else
  54. ::CommandParser::DoParse("play", "next.wav");
  55. }
  56.  
  57. // track selection
  58. if (playNumber > 9)
  59. {
  60. playFile = "track10.wav";
  61. }
  62. else if (playNumber > 8)
  63. {
  64. playFile = "track09.wav";
  65. }
  66. else if (playNumber > 7)
  67. {
  68. playFile = "track08.wav";
  69. }
  70. else if (playNumber > 6)
  71. {
  72. playFile = "track07.wav";
  73. }
  74. else if (playNumber > 5)
  75. {
  76. playFile = "track06.wav";
  77. }
  78. else if (playNumber > 4)
  79. {
  80. playFile = "track05.wav";
  81. }
  82. else if (playNumber > 3)
  83. {
  84. playFile = "track04.wav";
  85. }
  86. else if (playNumber > 2)
  87. {
  88. playFile = "track03.wav";
  89. }
  90. else if (playNumber > 1)
  91. {
  92. playFile = "track02.wav";
  93. }
  94. else
  95. {
  96. playFile = "track01.wav";
  97. }
  98.  
  99. // play sequential track
  100. ::CommandParser::DoParse("play_track", playFile);
Advertisement
Add Comment
Please, Sign In to add comment