implemented mute Hotkey (TODO: default key)

small improvement for Amiga mouse detection
minor Windows project file fix
This commit is contained in:
thrust26 2019-02-13 20:03:58 +01:00
parent 9857fa888b
commit b5fce21b2f
10 changed files with 56 additions and 4 deletions

View File

@ -1516,6 +1516,12 @@
<td>Cmd + ]</td>
</tr>
<tr>
<td>Toggle sound on/off (*)</td>
<td>Alt + '</td>
<td>Cmd + '</td>
</tr>
<tr>
<td>Switch display format in <i>increasing</i> order (NTSC/PAL/SECAM etc.)</td>
<td>Control + f</td>

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -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)

View File

@ -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,

View File

@ -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 },

View File

@ -363,7 +363,7 @@ class EventHandler
enum {
kComboSize = 16,
kEventsPerCombo = 8,
kEmulActionListSize = 80 + kComboSize,
kEmulActionListSize = 81 + kComboSize,
kMenuActionListSize = 14
};

View File

@ -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

View File

@ -808,7 +808,6 @@
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="Source.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\AudioQueue.hxx" />