NoSloppy

revo1-volmenu

Jul 13th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. // Make these sounds what you want
  2. // vmbegin.wav
  3. // vmend.wav
  4. // voldown.wav
  5. // volup.wav
  6. // volmax.wav
  7. // volmin.wav
  8. // Then put them in the font folder or in a common folder and use Font Search paths functionality by
  9. // making your preset start like { "font;common",
  10.  
  11. // Add these to the prop file with the others that look the same:
  12.  
  13. EFFECT(volup); // for increse volume
  14. EFFECT(voldown); // for decrease volume
  15. EFFECT(volmin); // for minimum volume reached
  16. EFFECT(volmax); // for maximum volume reached
  17.  
  18.  
  19.  
  20. // Replace the existing volume section with this:
  21.  
  22. // SA22C Volume Menu
  23. void VolumeUp() {
  24. if (dynamic_mixer.get_volume() < VOLUME) {
  25. dynamic_mixer.set_volume(std::min<int>(VOLUME + VOLUME * 0.1,
  26. dynamic_mixer.get_volume() + VOLUME * 0.10));
  27. if (SFX_volup) {
  28. hybrid_font.PlayCommon(&SFX_volup);
  29. } else {
  30. beeper.Beep(0.5, 2000);
  31. }
  32. STDOUT.print("Volume Up - Current Volume: ");
  33. STDOUT.println(dynamic_mixer.get_volume());
  34. } else {
  35. // Cycle through Volume Menu option
  36. #ifdef VOLUME_MENU_CYCLE
  37. if (!max_vol_reached_) {
  38. if (SFX_volmax) {
  39. hybrid_font.PlayCommon(&SFX_volmax);
  40. } else {
  41. beeper.Beep(0.5, 3000);
  42. }
  43. STDOUT.print("Maximum Volume \n");
  44. max_vol_reached_ = true;
  45. } else {
  46. dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
  47. dynamic_mixer.get_volume() - VOLUME * 0.90));
  48. if (SFX_volmin) {
  49. hybrid_font.PlayCommon(&SFX_volmin);
  50. } else {
  51. beeper.Beep(0.5, 1000);
  52. }
  53. STDOUT.print("Minimum Volume \n");
  54. max_vol_reached_ = false;
  55. }
  56. #else
  57. if (SFX_volmax) {
  58. hybrid_font.PlayCommon(&SFX_volmax);
  59. } else {
  60. beeper.Beep(0.5, 3000);
  61. }
  62. STDOUT.print("Maximum Volume \n");
  63. #endif
  64. }
  65. }
  66.  
  67. void VolumeDown() {
  68. if (dynamic_mixer.get_volume() > (0.10 * VOLUME)) {
  69. dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
  70. dynamic_mixer.get_volume() - VOLUME * 0.10));
  71. if (SFX_voldown) {
  72. hybrid_font.PlayCommon(&SFX_voldown);
  73. } else {
  74. beeper.Beep(0.5, 2000);
  75. }
  76. STDOUT.print("Volume Down - Current Volume: ");
  77. STDOUT.println(dynamic_mixer.get_volume());
  78. } else {
  79. #ifdef VOLUME_MENU_CYCLE
  80. if (!min_vol_reached_) {
  81. if (SFX_volmin) {
  82. hybrid_font.PlayCommon(&SFX_volmin);
  83. } else {
  84. beeper.Beep(0.5, 1000);
  85. }
  86. STDOUT.print("Minimum Volume \n");
  87. min_vol_reached_ = true;
  88. } else {
  89. dynamic_mixer.set_volume(VOLUME);
  90. if (SFX_volmax) {
  91. hybrid_font.PlayCommon(&SFX_volmax);
  92. } else {
  93. beeper.Beep(0.5, 3000);
  94. }
  95. STDOUT.print("Maximum Volume \n");
  96. min_vol_reached_ = false;
  97. }
  98. #else
  99. if (SFX_volmin) {
  100. hybrid_font.PlayCommon(&SFX_volmin);
  101. } else {
  102. beeper.Beep(0.5, 1000);
  103. }
  104. STDOUT.print("Minimum Volume \n");
  105. #endif
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment