From 702f35708277c6519590778ce87010c4281d0f34 Mon Sep 17 00:00:00 2001 From: bgk Date: Sat, 1 Nov 2008 13:17:17 +0000 Subject: [PATCH] GTK : Some preparation for the future sound config dialog --- src/gtk/window.cpp | 32 ++++++++++++++++++++++++++++++++ src/gtk/window.h | 3 +++ src/gtk/windowcallbacks.cpp | 21 +++------------------ 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index efc6f06e..a625db04 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -958,6 +958,38 @@ void Window::vApplyConfigFilterIB() } } +void Window::vApplyConfigMute() +{ + bool bMute = m_poSoundConfig->oGetKey("mute"); + if (bMute) + { + soundSetEnable(0x000); + } + else + { + soundSetEnable(0x30f); + } +} + +void Window::vApplyConfigVolume() +{ + float fSoundVolume = m_poSoundConfig->oGetKey("volume"); + soundSetVolume(fSoundVolume); +} + +void Window::vApplyConfigSoundQuality() +{ + m_eSoundQuality = (ESoundQuality)m_poSoundConfig->oGetKey("quality"); + if (m_eCartridge == CartridgeGBA) + { + soundSetQuality(m_eSoundQuality); + } + else if (m_eCartridge == CartridgeGB) + { + gbSoundSetQuality(m_eSoundQuality); + } +} + void Window::vHistoryAdd(const std::string & _rsFile) { std::string sURL = "file://" + _rsFile; diff --git a/src/gtk/window.h b/src/gtk/window.h index 32bfa3e0..9515d985 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -79,6 +79,9 @@ public: void vApplyConfigFilter(); void vApplyConfigFilterIB(); void vApplyConfigScreenArea(); + void vApplyConfigMute(); + void vApplyConfigVolume(); + void vApplyConfigSoundQuality(); void vUpdateScreen(); inline ECartridge eGetCartridge() const { return m_eCartridge; } diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index f03e8c30..0db4d82b 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -474,15 +474,8 @@ void Window::vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize) void Window::vOnSoundMuteToggled(Gtk::CheckMenuItem * _poCMI) { bool bMute = _poCMI->get_active(); - if (bMute) - { - soundSetEnable(0x000); - } - else - { - soundSetEnable(0x30f); - } m_poSoundConfig->vSetKey("mute", bMute); + vApplyConfigMute(); } void Window::vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality) @@ -492,16 +485,8 @@ void Window::vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQual return; } - m_eSoundQuality = (ESoundQuality)_iSoundQuality; - if (m_eCartridge == CartridgeGBA) - { - soundSetQuality(_iSoundQuality); - } - else if (m_eCartridge == CartridgeGB) - { - gbSoundSetQuality(_iSoundQuality); - } m_poSoundConfig->vSetKey("quality", _iSoundQuality); + vApplyConfigSoundQuality(); } void Window::vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, float _fSoundVolume) @@ -511,8 +496,8 @@ void Window::vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, float _fSoundVol return; } - soundSetVolume(_fSoundVolume); m_poSoundConfig->vSetKey("volume", _fSoundVolume); + vApplyConfigVolume(); } void Window::vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI)