Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SA22C Volume Menu
- void VolumeUp() {
- STDOUT.println("Volume up");
- if (dynamic_mixer.get_volume() < VOLUME) {
- dynamic_mixer.set_volume(std::min<int>(VOLUME + VOLUME * 0.1,
- dynamic_mixer.get_volume() + VOLUME * 0.10));
- //beeper.Beep(0.5, 2000);
- ::CommandParser::DoParse("play", "volchangeup.wav"); // BC Custom Spoken Volume menu
- STDOUT.print("Current Volume: ");
- STDOUT.println(dynamic_mixer.get_volume());
- } else {
- #ifdef VOLUME_MENU_CYCLE // BC Cycle through Volume Menu option
- if (!max_vol_) {
- //beeper.Beep(0.5, 3000);
- ::CommandParser::DoParse("play", "volmax.wav");
- STDOUT.print("Current Volume: ");
- max_vol_ = true;
- } else {
- dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
- dynamic_mixer.get_volume() - VOLUME * 0.90));
- ::CommandParser::DoParse("play", "volmin.wav");
- STDOUT.print("Current Volume: ");
- max_vol_ = false;
- }
- #else
- ::CommandParser::DoParse("play", "volmax.wav");
- STDOUT.print("Current Volume: ");
- #endif
- }
- }
- void VolumeDown() {
- STDOUT.println("Volume Down");
- if (dynamic_mixer.get_volume() > (0.10 * VOLUME)) {
- dynamic_mixer.set_volume(std::max<int>(VOLUME * 0.1,
- dynamic_mixer.get_volume() - VOLUME * 0.10));
- //beeper.Beep(0.5, 2000);
- ::CommandParser::DoParse("play", "volchangedown.wav");
- STDOUT.print("Current Volume: ");
- STDOUT.println(dynamic_mixer.get_volume());
- } else {
- #ifdef VOLUME_MENU_CYCLE
- if (!min_vol_) {
- //beeper.Beep(0.5, 3000);
- ::CommandParser::DoParse("play", "volmin.wav");
- STDOUT.print("Current Volume: ");
- min_vol_ = true;
- } else {
- dynamic_mixer.set_volume(VOLUME);
- ::CommandParser::DoParse("play", "volmax.wav");
- STDOUT.print("Current Volume: ");
- min_vol_ = false;
- }
- #else
- ::CommandParser::DoParse("play", "volmin.wav");
- STDOUT.print("Current Volume: ");
- #endif
- }
- }
- //-------------------
- // add to private:
- //--------------------
- bool max_vol_ = false;
- bool min_vol_ = false;
Advertisement
Add Comment
Please, Sign In to add comment