From f5c7bb5d288de7347aede5df08b69058af60219a Mon Sep 17 00:00:00 2001 From: bgk Date: Wed, 27 Aug 2008 11:47:52 +0000 Subject: [PATCH] GTK : Fixed build by removing obsolete sound options SDL : Still broken --- CMakeLists.txt | 1 + src/gtk/vba.glade | 102 ------------------------------- src/gtk/window.cpp | 118 ++++++------------------------------ src/gtk/window.h | 23 ++----- src/gtk/windowcallbacks.cpp | 93 +--------------------------- 5 files changed, 27 insertions(+), 310 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0fe0ed1..93baa868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,6 +232,7 @@ INCLUDE_DIRECTORIES( IF( CAN_BUILD_GVBAM ) INCLUDE_DIRECTORIES( ${GTKMM_INCLUDE_DIRS} + ${GTKGLMM_INCLUDE_DIRS} ${GLADEMM_INCLUDE_DIRS} ) ENDIF( CAN_BUILD_GVBAM ) diff --git a/src/gtk/vba.glade b/src/gtk/vba.glade index 3c98bc94..6b95e3b6 100644 --- a/src/gtk/vba.glade +++ b/src/gtk/vba.glade @@ -905,108 +905,6 @@ True - - - True - O_ff - True - True - - - - - True - _Mute - True - SoundOff - - - - - True - _On - True - SoundOff - - - - - True - - - - - True - Echo - True - - - - - True - Low pass filter - True - - - - - True - Reverse stereo - True - - - - - True - - - - - True - Channel _1 - True - - - - - True - Channel _2 - True - - - - - True - Channel _3 - True - - - - - True - Channel _4 - True - - - - - True - Channel _A - True - - - - - True - Channel _B - True - - - - - True - - True diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 366c55e2..81296e1d 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -78,8 +78,8 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : m_iSaveTypeMax (SaveNone), m_iSoundQualityMin(Sound44K), m_iSoundQualityMax(Sound11K), - m_iSoundVolumeMin (Sound100), - m_iSoundVolumeMax (Sound50), + m_fSoundVolumeMin (0.50f), + m_fSoundVolumeMax (4.00f), m_iEmulatorTypeMin(EmulatorAuto), m_iEmulatorTypeMax(EmulatorSGB2), m_iFilter2xMin (FirstFilter), @@ -509,85 +509,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : // Sound menu // - std::string sDefaultSoundStatus = m_poSoundConfig->sGetKey("status"); - - poCMI = dynamic_cast(_poXml->get_widget("SoundOff")); - if (sDefaultSoundStatus == "off") - { - poCMI->set_active(); - vOnSoundStatusToggled(poCMI, SoundOff); - } - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundStatusToggled), - poCMI, SoundOff)); - m_poSoundOffItem = poCMI; - - poCMI = dynamic_cast(_poXml->get_widget("SoundMute")); - if (sDefaultSoundStatus == "mute") - { - poCMI->set_active(); - vOnSoundStatusToggled(poCMI, SoundMute); - } - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundStatusToggled), - poCMI, SoundMute)); - - poCMI = dynamic_cast(_poXml->get_widget("SoundOn")); - if (sDefaultSoundStatus == "on") - { - poCMI->set_active(); - vOnSoundStatusToggled(poCMI, SoundOn); - } - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundStatusToggled), - poCMI, SoundOn)); - - poCMI = dynamic_cast(_poXml->get_widget("SoundEcho")); - poCMI->set_active(m_poSoundConfig->oGetKey("echo")); - vOnSoundEchoToggled(poCMI); - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundEchoToggled), - poCMI)); - - poCMI = dynamic_cast(_poXml->get_widget("SoundLowPass")); - poCMI->set_active(m_poSoundConfig->oGetKey("low_pass")); - vOnSoundLowPassToggled(poCMI); - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundLowPassToggled), - poCMI)); - - poCMI = dynamic_cast(_poXml->get_widget("SoundReverseStereo")); - poCMI->set_active(m_poSoundConfig->oGetKey("reverse_stereo")); - vOnSoundReverseToggled(poCMI); - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundReverseToggled), - poCMI)); - - struct - { - const char * m_csName; - const char * m_csKey; - const int m_iSoundChannel; - } - astSoundChannel[] = - { - { "SoundChannel1", "channel_1", 0 }, - { "SoundChannel2", "channel_2", 1 }, - { "SoundChannel3", "channel_3", 2 }, - { "SoundChannel4", "channel_4", 3 }, - { "SoundChannelA", "channel_A", 4 }, - { "SoundChannelB", "channel_B", 5 } - }; - for (guint i = 0; i < G_N_ELEMENTS(astSoundChannel); i++) - { - poCMI = dynamic_cast(_poXml->get_widget(astSoundChannel[i].m_csName)); - poCMI->set_active(m_poSoundConfig->oGetKey(astSoundChannel[i].m_csKey)); - vOnSoundChannelToggled(poCMI, astSoundChannel[i].m_iSoundChannel); - poCMI->signal_toggled().connect(sigc::bind( - sigc::mem_fun(*this, &Window::vOnSoundChannelToggled), - poCMI, astSoundChannel[i].m_iSoundChannel)); - } - struct { const char * m_csName; @@ -618,29 +539,29 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr & _poXml) : struct { const char * m_csName; - const ESoundVolume m_eSoundVolume; + const float m_fSoundVolume; } astSoundVolume[] = { - { "Volume25", Sound25 }, - { "Volume50", Sound50 }, - { "Volume100", Sound100 }, - { "Volume200", Sound200 }, - { "Volume300", Sound300 }, - { "Volume400", Sound400 } + { "Volume25", 0.25f }, + { "Volume50", 0.50f }, + { "Volume100", 1.00f }, + { "Volume200", 2.00f }, + { "Volume300", 3.00f }, + { "Volume400", 4.00f } }; - ESoundVolume eDefaultSoundVolume = (ESoundVolume)m_poSoundConfig->oGetKey("volume"); + float fDefaultSoundVolume = m_poSoundConfig->oGetKey("volume"); for (guint i = 0; i < G_N_ELEMENTS(astSoundVolume); i++) { poCMI = dynamic_cast(_poXml->get_widget(astSoundVolume[i].m_csName)); - if (astSoundVolume[i].m_eSoundVolume == eDefaultSoundVolume) + if (astSoundVolume[i].m_fSoundVolume == fDefaultSoundVolume) { poCMI->set_active(); - vOnSoundVolumeToggled(poCMI, eDefaultSoundVolume); + vOnSoundVolumeToggled(poCMI, fDefaultSoundVolume); } poCMI->signal_toggled().connect(sigc::bind( sigc::mem_fun(*this, &Window::vOnSoundVolumeToggled), - poCMI, astSoundVolume[i].m_eSoundVolume)); + poCMI, astSoundVolume[i].m_fSoundVolume)); } // Gameboy menu @@ -934,7 +855,6 @@ void Window::vInitSystem() systemVerbose = 0; systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; systemFrameSkip = 2; - soundOffFlag = true; systemRenderedFrames = 0; systemFPS = 0; @@ -1031,7 +951,7 @@ void Window::vInitConfig() m_poSoundConfig->vSetKey("channel_A", true ); m_poSoundConfig->vSetKey("channel_B", true ); m_poSoundConfig->vSetKey("quality", Sound22K ); - m_poSoundConfig->vSetKey("volume", Sound100 ); + m_poSoundConfig->vSetKey("volume", 1.00f ); // Input section // @@ -1067,6 +987,8 @@ void Window::vCheckConfig() { int iValue; int iAdjusted; + float fValue; + float fAdjusted; std::string sValue; // Directories section @@ -1204,11 +1126,11 @@ void Window::vCheckConfig() m_poSoundConfig->vSetKey("quality", iAdjusted); } - iValue = m_poSoundConfig->oGetKey("volume"); - iAdjusted = CLAMP(iValue, m_iSoundVolumeMin, m_iSoundVolumeMax); - if (iValue != iAdjusted) + fValue = m_poSoundConfig->oGetKey("volume"); + fAdjusted = CLAMP(fValue, m_fSoundVolumeMin, m_fSoundVolumeMax); + if (fValue != fAdjusted) { - m_poSoundConfig->vSetKey("volume", iAdjusted); + m_poSoundConfig->vSetKey("volume", fAdjusted); } // Input section diff --git a/src/gtk/window.h b/src/gtk/window.h index cdcedb87..1067e859 100644 --- a/src/gtk/window.h +++ b/src/gtk/window.h @@ -111,17 +111,7 @@ protected: Sound11K = 4 }; - enum ESoundVolume - { - Sound100, - Sound200, - Sound300, - Sound400, - Sound25, - Sound50 - }; - - enum EEmulatorType + enum EEmulatorType { EmulatorAuto, EmulatorCGB, @@ -168,13 +158,8 @@ 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 vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus); - virtual void vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI); - virtual void vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI); - virtual void vOnSoundReverseToggled(Gtk::CheckMenuItem * _poCMI); - virtual void vOnSoundChannelToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundChannel); virtual void vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality); - virtual void vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundVolume); + virtual void vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, float _fSoundVolume); virtual void vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnGBPrinterToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnEmulatorTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iEmulatorType); @@ -212,8 +197,8 @@ private: const int m_iSaveTypeMax; const int m_iSoundQualityMin; const int m_iSoundQualityMax; - const int m_iSoundVolumeMin; - const int m_iSoundVolumeMax; + const float m_fSoundVolumeMin; + const float m_fSoundVolumeMax; const int m_iEmulatorTypeMin; const int m_iEmulatorTypeMax; const int m_iFilter2xMin; diff --git a/src/gtk/windowcallbacks.cpp b/src/gtk/windowcallbacks.cpp index 63dec8eb..25340d22 100644 --- a/src/gtk/windowcallbacks.cpp +++ b/src/gtk/windowcallbacks.cpp @@ -752,95 +752,6 @@ void Window::vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize) m_poCoreConfig->vSetKey("flash_size", _iFlashSize); } -void Window::vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus) -{ - if (! _poCMI->get_active()) - { - return; - } - - std::string sSoundStatus; - switch (_iSoundStatus) - { - case SoundOff: - soundOffFlag = true; - if (systemSoundOn) - { - soundShutdown(); - } - sSoundStatus = "off"; - break; - case SoundMute: - soundDisable(0x30f); - sSoundStatus = "mute"; - break; - case SoundOn: - if (soundOffFlag) - { - soundOffFlag = false; - if (! soundInit()) - { - m_poSoundOffItem->set_active(); - return; - } - } - soundEnable(0x30f); - sSoundStatus = "on"; - break; - } - m_poSoundConfig->vSetKey("status", sSoundStatus); -} - -void Window::vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI) -{ - soundEcho = _poCMI->get_active(); - m_poSoundConfig->vSetKey("echo", soundEcho); -} - -void Window::vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI) -{ - soundLowPass = _poCMI->get_active(); - m_poSoundConfig->vSetKey("low_pass", soundLowPass); -} - -void Window::vOnSoundReverseToggled(Gtk::CheckMenuItem * _poCMI) -{ - soundReverse = _poCMI->get_active(); - m_poSoundConfig->vSetKey("reverse_stereo", soundReverse); -} - -void Window::vOnSoundChannelToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundChannel) -{ - int iShift = _iSoundChannel; - if (_iSoundChannel > 3) - { - iShift += 4; - } - int iFlag = 1 << iShift; - int iActive = soundGetEnable() & 0x30f; - if (_poCMI->get_active()) - { - iActive |= iFlag; - } - else - { - iActive &= ~iFlag; - } - soundEnable(iActive); - soundDisable(~iActive & 0x30f); - - const char * acsChannels[] = - { - "channel_1", - "channel_2", - "channel_3", - "channel_4", - "channel_A", - "channel_B" - }; - m_poSoundConfig->vSetKey(acsChannels[_iSoundChannel], _poCMI->get_active()); -} - void Window::vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality) { if (! _poCMI->get_active()) @@ -860,14 +771,14 @@ void Window::vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQual m_poSoundConfig->vSetKey("quality", _iSoundQuality); } -void Window::vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundVolume) +void Window::vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, float _iSoundVolume) { if (! _poCMI->get_active()) { return; } - soundVolume = _iSoundVolume; + soundSetVolume(_iSoundVolume); m_poSoundConfig->vSetKey("volume", _iSoundVolume); }