Merge pull request #1782 from FL-dolphinemu/master
Issue 7968: Added keybinds for increasing, decreasing, and muting audio.
This commit is contained in:
commit
25c6f6e6a1
|
@ -27,6 +27,9 @@ static bool s_audio_dump_start = false;
|
|||
|
||||
namespace AudioCommon
|
||||
{
|
||||
static const int AUDIO_VOLUME_MIN = 0;
|
||||
static const int AUDIO_VOLUME_MAX = 100;
|
||||
|
||||
SoundStream* InitSoundStream()
|
||||
{
|
||||
CMixer *mixer = new CMixer(48000);
|
||||
|
@ -140,11 +143,13 @@ namespace AudioCommon
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateSoundStream()
|
||||
{
|
||||
if (g_sound_stream)
|
||||
{
|
||||
g_sound_stream->SetVolume(SConfig::GetInstance().m_Volume);
|
||||
int volume = SConfig::GetInstance().m_IsMuted ? 0 : SConfig::GetInstance().m_Volume;
|
||||
g_sound_stream->SetVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,4 +196,31 @@ namespace AudioCommon
|
|||
g_sound_stream->GetMixer()->StopLogDSPAudio();
|
||||
s_audio_dump_start = false;
|
||||
}
|
||||
|
||||
void IncreaseVolume(unsigned short offset)
|
||||
{
|
||||
SConfig::GetInstance().m_IsMuted = false;
|
||||
int& currentVolume = SConfig::GetInstance().m_Volume;
|
||||
currentVolume += offset;
|
||||
if (currentVolume > AUDIO_VOLUME_MAX)
|
||||
currentVolume = AUDIO_VOLUME_MAX;
|
||||
UpdateSoundStream();
|
||||
}
|
||||
|
||||
void DecreaseVolume(unsigned short offset)
|
||||
{
|
||||
SConfig::GetInstance().m_IsMuted = false;
|
||||
int& currentVolume = SConfig::GetInstance().m_Volume;
|
||||
currentVolume -= offset;
|
||||
if (currentVolume < AUDIO_VOLUME_MIN)
|
||||
currentVolume = AUDIO_VOLUME_MIN;
|
||||
UpdateSoundStream();
|
||||
}
|
||||
|
||||
void ToggleMuteVolume()
|
||||
{
|
||||
bool& isMuted = SConfig::GetInstance().m_IsMuted;
|
||||
isMuted = !isMuted;
|
||||
UpdateSoundStream();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,7 @@ namespace AudioCommon
|
|||
void SendAIBuffer(short* samples, unsigned int num_samples);
|
||||
void StartAudioDump();
|
||||
void StopAudioDump();
|
||||
void IncreaseVolume(unsigned short offset);
|
||||
void DecreaseVolume(unsigned short offset);
|
||||
void ToggleMuteVolume();
|
||||
}
|
||||
|
|
|
@ -62,6 +62,11 @@ static const struct
|
|||
{ "Wiimote4Connect", 347 /* WXK_F8 */, 1 /* wxMOD_ALT */ },
|
||||
{ "BalanceBoardConnect",348 /* WXK_F9 */, 1 /* wxMOD_ALT */ },
|
||||
#endif
|
||||
|
||||
{ "VolumeUp", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "VolumeDown", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "VolumeToggleMute", 0, 0 /* wxMOD_NONE */ },
|
||||
|
||||
{ "ToggleIR", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "ToggleAspectRatio", 0, 0 /* wxMOD_NONE */ },
|
||||
{ "ToggleEFBCopies", 0, 0 /* wxMOD_NONE */ },
|
||||
|
@ -611,6 +616,8 @@ void SConfig::LoadDSPSettings(IniFile& ini)
|
|||
#endif
|
||||
dsp->Get("Volume", &m_Volume, 100);
|
||||
dsp->Get("CaptureLog", &m_DSPCaptureLog, false);
|
||||
|
||||
m_IsMuted = false;
|
||||
}
|
||||
|
||||
void SConfig::LoadInputSettings(IniFile& ini)
|
||||
|
|
|
@ -102,6 +102,7 @@ struct SConfig : NonCopyable
|
|||
bool m_DSPEnableJIT;
|
||||
bool m_DSPCaptureLog;
|
||||
bool m_DumpAudio;
|
||||
bool m_IsMuted;
|
||||
int m_Volume;
|
||||
std::string sBackend;
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ enum Hotkey
|
|||
HK_WIIMOTE4_CONNECT,
|
||||
HK_BALANCEBOARD_CONNECT,
|
||||
|
||||
HK_VOLUME_UP,
|
||||
HK_VOLUME_DOWN,
|
||||
HK_VOLUME_TOGGLE_MUTE,
|
||||
|
||||
HK_TOGGLE_IR,
|
||||
HK_TOGGLE_AR,
|
||||
HK_TOGGLE_EFBCOPIES,
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <wx/aui/auibook.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
|
||||
#include "AudioCommon/AudioCommon.h"
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/Thread.h"
|
||||
|
@ -1059,6 +1061,12 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||
Core::SaveScreenShot();
|
||||
else if (IsHotkey(event, HK_EXIT))
|
||||
wxPostEvent(this, wxCommandEvent(wxID_EXIT));
|
||||
else if (IsHotkey(event, HK_VOLUME_UP))
|
||||
AudioCommon::IncreaseVolume(3);
|
||||
else if (IsHotkey(event, HK_VOLUME_DOWN))
|
||||
AudioCommon::DecreaseVolume(3);
|
||||
else if (IsHotkey(event, HK_VOLUME_TOGGLE_MUTE))
|
||||
AudioCommon::ToggleMuteVolume();
|
||||
// Wiimote connect and disconnect hotkeys
|
||||
else if (IsHotkey(event, HK_WIIMOTE1_CONNECT))
|
||||
WiimoteId = 0;
|
||||
|
|
|
@ -219,6 +219,10 @@ void HotkeyConfigDialog::CreateHotkeyGUIControls()
|
|||
_("Connect Wiimote 4"),
|
||||
_("Connect Balance Board"),
|
||||
|
||||
_("Volume Up"),
|
||||
_("Volume Down"),
|
||||
_("Volume Toggle Mute"),
|
||||
|
||||
_("Toggle IR"),
|
||||
_("Toggle Aspect Ratio"),
|
||||
_("Toggle EFB Copies"),
|
||||
|
|
Loading…
Reference in New Issue