diff --git a/docs/index.html b/docs/index.html index cd6a1bb04..42426983e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1516,6 +1516,12 @@ Cmd + ] + + Toggle sound on/off (*) + Alt + ' + Cmd + ' + + Switch display format in increasing order (NTSC/PAL/SECAM etc.) Control + f diff --git a/src/common/SoundNull.hxx b/src/common/SoundNull.hxx index ab0f6fc86..9660e6a59 100644 --- a/src/common/SoundNull.hxx +++ b/src/common/SoundNull.hxx @@ -76,6 +76,13 @@ class SoundNull : public Sound */ bool mute(bool state) override { return true; } + /** + Toggles the sound mute state. While muted no sound is played. + + @return The previous (old) mute state + */ + bool toggleMute() override { } + /** Sets the volume of the sound device to the specified level. The volume is given as a percentage from 0 to 100. Values outside diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index efe2ab254..419b6611a 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -191,6 +191,26 @@ bool SoundSDL2::mute(bool state) return oldstate; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool SoundSDL2::toggleMute() +{ + bool oldstate = SDL_GetAudioDeviceStatus(myDevice) == SDL_AUDIO_PAUSED; + if(myIsInitializedFlag) + { + string message; + + SDL_PauseAudioDevice(myDevice, oldstate ? 0 : 1); + + message = "Sound "; + message += oldstate ? "unmuted" : "muted"; + + myOSystem.frameBuffer().showMessage(message); + } + + return oldstate; +} + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SoundSDL2::setVolume(uInt32 percent) { diff --git a/src/common/SoundSDL2.hxx b/src/common/SoundSDL2.hxx index 5f0c58b4b..47568da5e 100644 --- a/src/common/SoundSDL2.hxx +++ b/src/common/SoundSDL2.hxx @@ -79,6 +79,13 @@ class SoundSDL2 : public Sound */ bool mute(bool state) override; + /** + Toggles the sound mute state. While muted no sound is played. + + @return The previous (old) mute state + */ + bool toggleMute(); + /** Sets the volume of the sound device to the specified level. The volume is given as a percentage from 0 to 100. Values outside diff --git a/src/emucore/ControllerDetector.cxx b/src/emucore/ControllerDetector.cxx index a58a59e49..fb8b89ab4 100644 --- a/src/emucore/ControllerDetector.cxx +++ b/src/emucore/ControllerDetector.cxx @@ -403,12 +403,13 @@ bool ControllerDetector::isProbablyAtariMouse(const uInt8* image, uInt32 size) bool ControllerDetector::isProbablyAmigaMouse(const uInt8* image, uInt32 size) { // check for Amiga Mouse tables - const int NUM_SIGS = 3; + const int NUM_SIGS = 4; const int SIG_SIZE = 6; uInt8 signature[NUM_SIGS][SIG_SIZE] = { { 0b1100, 0b1000, 0b0100, 0b0000, 0b1101, 0b1001/*, 0b0101, 0b0001*/ }, // NextTrackTbl (T. Jentzsch) { 0x00, 0x88, 0x07, 0x01, 0x08, 0x00/*, 0x7f, 0x07*/ }, // .MovementTab_1 (Omegamatrix, SMX7) { 0x00, 0x82, 0x01, 0x03, 0x02, 0x00 }, // .MovementTab_1 (Omegamatrix) + { 0b100, 0b000, 0b000, 0b000, 0b101, 0b001} // NextTrackTbl (T. Jentzsch, MCTB) }; // all pattern checked, only Amiga Mouse matches for(uInt32 i = 0; i < NUM_SIGS; ++i) diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index a7284be75..784c93c94 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -74,7 +74,7 @@ class Event ChangeState, LoadState, SaveState, TakeSnapshot, Quit, PauseMode, OptionsMenuMode, CmdMenuMode, TimeMachineMode, DebuggerMode, LauncherMode, - Fry, VolumeDecrease, VolumeIncrease, + Fry, VolumeDecrease, VolumeIncrease, SoundToggle, UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown, UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir, diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index fb3c48106..edc6ec7a2 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -373,6 +373,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 state) if(state) myOSystem.sound().adjustVolume(+1); return; + case Event::SoundToggle: + if(state) myOSystem.sound().toggleMute(); + return; + case Event::SaveState: if(state) myOSystem.state().saveState(); return; @@ -1261,6 +1265,7 @@ EventHandler::ActionList EventHandler::ourEmulActionList[kEmulActionListSize] = { Event::Fry, "Fry cartridge", "", false }, { Event::VolumeDecrease, "Decrease volume", "", false }, { Event::VolumeIncrease, "Increase volume", "", false }, + { Event::SoundToggle, "Toggle sound", "", false }, { Event::PauseMode, "Pause", "", false }, { Event::OptionsMenuMode, "Enter options menu UI", "", false }, { Event::CmdMenuMode, "Toggle command menu UI", "", false }, diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 8fa9f01dc..5d6e86234 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -363,7 +363,7 @@ class EventHandler enum { kComboSize = 16, kEventsPerCombo = 8, - kEmulActionListSize = 80 + kComboSize, + kEmulActionListSize = 81 + kComboSize, kMenuActionListSize = 14 }; diff --git a/src/emucore/Sound.hxx b/src/emucore/Sound.hxx index 086986f63..8f892a2db 100644 --- a/src/emucore/Sound.hxx +++ b/src/emucore/Sound.hxx @@ -69,6 +69,13 @@ class Sound */ virtual bool mute(bool state) = 0; + /** + Toggles the sound mute state. While muted no sound is played. + + @return The previous (old) mute state + */ + virtual bool toggleMute() = 0; + /** Sets the volume of the sound device to the specified level. The volume is given as a percentage from 0 to 100. Values outside