changed volume hotkey handling

changing volume also enables sound
changing phoshor also enables phosphor mode
This commit is contained in:
Thomas Jentzsch 2019-02-14 11:07:17 +01:00
parent fa66711c8a
commit 7215f2bbeb
2 changed files with 41 additions and 38 deletions

View File

@ -194,23 +194,19 @@ bool SoundSDL2::mute(bool state)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundSDL2::toggleMute()
{
bool oldstate = SDL_GetAudioDeviceStatus(myDevice) == SDL_AUDIO_PAUSED;
if(myIsInitializedFlag)
{
string message;
bool enabled = myAudioSettings.enabled();
SDL_PauseAudioDevice(myDevice, oldstate ? 0 : 1);
setEnabled(!enabled);
myOSystem.console().initializeAudio();
message = "Sound ";
message += oldstate ? "unmuted" : "muted";
string message = "Sound ";
message += !enabled ? "unmuted" : "muted";
myOSystem.frameBuffer().showMessage(message);
}
return oldstate;
return enabled;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL2::setVolume(uInt32 percent)
{
@ -243,6 +239,15 @@ void SoundSDL2::adjustVolume(Int8 direction)
setVolume(percent);
// enabled audio if it is currently disabled
bool enabled = myAudioSettings.enabled();
if (percent > 0 && !enabled)
{
setEnabled(!enabled);
myOSystem.console().initializeAudio();
}
// Now show an onscreen message
strval << percent;
message = "Volume set to ";

View File

@ -562,13 +562,13 @@ void Console::changePhosphor(int direction)
{
int blend = atoi(myProperties.get(Display_PPBlend).c_str());
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
{
if(direction == +1) // increase blend
{
if(blend >= 100)
{
myOSystem.frameBuffer().showMessage("Phosphor blend at maximum");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, 100);
return;
}
else
@ -579,6 +579,7 @@ void Console::changePhosphor(int direction)
if(blend <= 2)
{
myOSystem.frameBuffer().showMessage("Phosphor blend at minimum");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, 0);
return;
}
else
@ -593,9 +594,6 @@ void Console::changePhosphor(int direction)
myOSystem.frameBuffer().showMessage("Phosphor blend " + val.str());
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true, blend);
}
else
myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::setProperties(const Properties& props)