From 195cb6522588211c222ac49aaef32c20eed90fa7 Mon Sep 17 00:00:00 2001 From: bgk Date: Wed, 27 Aug 2008 12:18:38 +0000 Subject: [PATCH] GTK : Readded the sound mute option using the new API git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@645 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/gtk/vba.glade | 12 ++++++++++++ src/gtk/window.cpp | 18 ++++++++---------- src/gtk/window.h | 3 ++- src/gtk/windowcallbacks.cpp | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/gtk/vba.glade b/src/gtk/vba.glade index 6b95e3b6..b02dcfba 100644 --- a/src/gtk/vba.glade +++ b/src/gtk/vba.glade @@ -905,6 +905,18 @@ True + + + True + Mute + True + + + + + True + + True diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 81296e1d..fbf0e25e 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -509,6 +509,13 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : // Sound menu // + poCMI = dynamic_cast(_poXml->get_widget("SoundMute")); + poCMI->set_active(m_poSoundConfig->oGetKey("mute")); + vOnSoundMuteToggled(poCMI); + poCMI->signal_toggled().connect(sigc::bind( + sigc::mem_fun(*this, &Window::vOnSoundMuteToggled), + poCMI)); + struct { const char * m_csName; @@ -940,10 +947,7 @@ void Window::vInitConfig() // Sound section // m_poSoundConfig = m_oConfig.poAddSection("Sound"); - m_poSoundConfig->vSetKey("status", "on" ); - m_poSoundConfig->vSetKey("echo", false ); - m_poSoundConfig->vSetKey("low_pass", false ); - m_poSoundConfig->vSetKey("reverse_stereo", false ); + m_poSoundConfig->vSetKey("mute", false ); m_poSoundConfig->vSetKey("channel_1", true ); m_poSoundConfig->vSetKey("channel_2", true ); m_poSoundConfig->vSetKey("channel_3", true ); @@ -1113,12 +1117,6 @@ void Window::vCheckConfig() // Sound section // - sValue = m_poSoundConfig->sGetKey("status"); - if (sValue != "off" && sValue != "on" && sValue != "mute") - { - m_poSoundConfig->vSetKey("status", "on"); - } - iValue = m_poSoundConfig->oGetKey("quality"); iAdjusted = CLAMP(iValue, m_iSoundQualityMin, m_iSoundQualityMax); if (iValue != iAdjusted) diff --git a/src/gtk/window.h b/src/gtk/window.h index 1067e859..75d4a63c 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -111,7 +111,7 @@ protected: Sound11K = 4 }; - enum EEmulatorType + enum EEmulatorType { EmulatorAuto, EmulatorCGB, @@ -158,6 +158,7 @@ protected: virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed); virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType); virtual void vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize); + virtual void vOnSoundMuteToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality); virtual void vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, float _fSoundVolume); virtual void vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI); diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index 25340d22..0ac9f4c9 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -752,6 +752,20 @@ void Window::vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize) m_poCoreConfig->vSetKey("flash_size", _iFlashSize); } +void Window::vOnSoundMuteToggled(Gtk::CheckMenuItem * _poCMI) +{ + bool bMute = _poCMI->get_active(); + if (bMute) + { + soundSetEnable(0x000); + } + else + { + soundSetEnable(0x30f); + } + m_poSoundConfig->vSetKey("mute", bMute); +} + void Window::vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality) { if (! _poCMI->get_active())