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
This commit is contained in:
bgk 2008-08-27 12:18:38 +00:00
parent eef1c300a5
commit 195cb65225
4 changed files with 36 additions and 11 deletions

View File

@ -905,6 +905,18 @@
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="SoundMenu_menu">
<child>
<widget class="GtkCheckMenuItem" id="SoundMute">
<property name="visible">True</property>
<property name="label" translatable="yes">Mute</property>
<property name="use_underline">True</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator11">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="Sound11Khz">
<property name="visible">True</property>

View File

@ -509,6 +509,13 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
// Sound menu
//
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget("SoundMute"));
poCMI->set_active(m_poSoundConfig->oGetKey<bool>("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<int>("quality");
iAdjusted = CLAMP(iValue, m_iSoundQualityMin, m_iSoundQualityMax);
if (iValue != iAdjusted)

View File

@ -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);

View File

@ -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())