emily99

DMap OGG Looping

Jun 17th, 2021 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. dmapdata script oggLoop //start
  2. {
  3. enum file_id
  4. {
  5. FID_NONE,
  6. FID_METROID,
  7. FID_METROID2
  8. };
  9.  
  10. //start helper functions
  11. void get_fname(char32 f, file_id fid)
  12. {
  13. switch(fid)
  14. {
  15. case FID_NONE:
  16. break;
  17. case FID_METROID:
  18. strcpy(f, "metroid.ogg");
  19. break;
  20. case FID_METROID2:
  21. strcpy(f, "metroid2.ogg");
  22. break;
  23. }
  24. }
  25. int get_loopstart(file_id fid)
  26. {
  27. switch(fid)
  28. {
  29. case FID_NONE:
  30. return 0;
  31. case FID_METROID:
  32. return 0;
  33. case FID_METROID2:
  34. return 0;
  35. }
  36. }
  37. int get_loopend(file_id fid)
  38. {
  39. switch(fid)
  40. {
  41. case FID_NONE:
  42. return 0;
  43. case FID_METROID:
  44. return 0;
  45. case FID_METROID2:
  46. return 0;
  47. }
  48. }
  49. //end helper functions
  50.  
  51. void run(file_id fid) //start
  52. {
  53. char32 filename[256];
  54. get_fname(filename, fid);
  55. int loopStart = get_loopstart(fid), loopEnd = get_loopend(fid);
  56. if(Audio->PlayOgg(filename, 1))
  57. {
  58. while(true)
  59. {
  60. if(Audio->GetOggPos() >= loopEnd) Audio->SetOggPos(loopStart);
  61. Waitframe();
  62. }
  63. }
  64. } //end
  65. } //end
  66.  
Add Comment
Please, Sign In to add comment