NoSloppy

Untitled

Mar 14th, 2021 (edited)
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. void ChangeVolume(bool up) {
  2. if (up) {
  3. STDOUT.println("Volume up");
  4. if (dynamic_mixer.get_volume() < VOLUME) {
  5. dynamic_mixer.set_volume(std::min<int>(VOLUME + VOLUME * 0.1,
  6. dynamic_mixer.get_volume() + VOLUME * 0.10));
  7. //beeper.Beep(0.5, 2000);
  8. ::CommandParser::DoParse("play", "volchangeup.wav"); // BC Custom Spoken Volume menu
  9. STDOUT.print("Current Volume: ");
  10. STDOUT.println(dynamic_mixer.get_volume());
  11. } else {
  12. #ifdef VOLUME_MENU_CYCLE // BC Cycle through Volume Menu option
  13. if (!max_vol_) {
  14. //beeper.Beep(0.5, 3000);
  15. ::CommandParser::DoParse("play", "volmax.wav");
  16. max_vol_ = true;
  17. } else {
  18. dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
  19. dynamic_mixer.get_volume() - VOLUME * 0.90));
  20. ::CommandParser::DoParse("play", "volmin.wav");
  21. max_vol_ = false;
  22. }
  23. #else
  24. ::CommandParser::DoParse("play", "volmax.wav");
  25. #endif
  26. }
  27. } else {
  28. STDOUT.println("Volume Down");
  29. if (dynamic_mixer.get_volume() > (0.10 * VOLUME)) {
  30. dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
  31. dynamic_mixer.get_volume() - VOLUME * 0.10));
  32. //beeper.Beep(0.5, 2000);
  33. ::CommandParser::DoParse("play", "volchangedown.wav");
  34. STDOUT.print("Current Volume: ");
  35. STDOUT.println(dynamic_mixer.get_volume());
  36. } else {
  37. #ifdef VOLUME_MENU_CYCLE // BC Cycle through Volume Menu option
  38. if (!min_vol_) {
  39. //beeper.Beep(0.5, 3000);
  40. ::CommandParser::DoParse("play", "volmin.wav");
  41. min_vol_ = true;
  42. } else {
  43. dynamic_mixer.set_volume(VOLUME);
  44. ::CommandParser::DoParse("play", "volmax.wav");
  45. min_vol_ = false;
  46. }
  47. #else
  48. ::CommandParser::DoParse("play", "volmin.wav");
  49. #endif
  50.  
  51. }
  52. }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment