2013-06-08 12:56:58 +00:00
|
|
|
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2013-09-29 11:44:04 +00:00
|
|
|
#include "stdpch.h"
|
2013-06-08 12:56:58 +00:00
|
|
|
#include "sound_settings_widget.h"
|
2013-09-29 11:47:30 +00:00
|
|
|
|
2013-06-08 12:56:58 +00:00
|
|
|
#include "system.h"
|
|
|
|
|
|
|
|
CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) :
|
|
|
|
CWidgetBase( parent )
|
|
|
|
{
|
|
|
|
setupUi( this );
|
|
|
|
load();
|
|
|
|
|
|
|
|
connect( tracksSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTracksSliderChange() ) );
|
|
|
|
connect( soundCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
|
|
|
connect( eaxCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
|
|
|
connect( softwareCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
|
|
|
connect( fmodCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
CSoundSettingsWidget::~CSoundSettingsWidget()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSoundSettingsWidget::onTracksSliderChange()
|
|
|
|
{
|
|
|
|
updateTracksLabel();
|
|
|
|
emit changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSoundSettingsWidget::load()
|
|
|
|
{
|
|
|
|
CSystem &s = CSystem::GetInstance();
|
|
|
|
|
|
|
|
if( s.config.getInt( "SoundOn" ) == 1 )
|
|
|
|
soundCheckBox->setChecked( true );
|
|
|
|
|
|
|
|
if( s.config.getInt( "UseEax" ) == 1 )
|
|
|
|
eaxCheckBox->setChecked( true );
|
|
|
|
|
|
|
|
if( s.config.getInt( "SoundForceSoftwareBuffer" ) == 1 )
|
|
|
|
softwareCheckBox->setChecked( true );
|
|
|
|
|
|
|
|
sint32 tracks = s.config.getInt( "MaxTrack" );
|
|
|
|
if( tracks < 4 )
|
|
|
|
tracks = 4;
|
|
|
|
if( tracks > 32 )
|
|
|
|
tracks = 32;
|
|
|
|
tracksSlider->setValue( tracks / 4 );
|
|
|
|
|
2015-12-06 18:43:27 +00:00
|
|
|
updateTracksLabel();
|
|
|
|
|
2013-06-08 12:56:58 +00:00
|
|
|
if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 )
|
|
|
|
fmodCheckBox->setChecked( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSoundSettingsWidget::save()
|
|
|
|
{
|
|
|
|
CSystem &s = CSystem::GetInstance();
|
|
|
|
|
|
|
|
if( soundCheckBox->isChecked() )
|
|
|
|
s.config.setInt( "SoundOn", 1 );
|
|
|
|
|
|
|
|
if( eaxCheckBox->isChecked() )
|
|
|
|
s.config.setInt( "UseEax", 1 );
|
|
|
|
|
|
|
|
if( softwareCheckBox->isChecked() )
|
|
|
|
s.config.setInt( "SoundForceSoftwareBuffer", 1 );
|
|
|
|
|
|
|
|
s.config.setInt( "MaxTrack", tracksSlider->value() * 4 );
|
|
|
|
|
|
|
|
if( fmodCheckBox->isChecked() )
|
|
|
|
s.config.setString( "DriverSound", std::string( "FMod" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSoundSettingsWidget::updateTracksLabel()
|
|
|
|
{
|
|
|
|
tracksLabel->setText( tr( "%1 tracks" ).arg( tracksSlider->value() * 4 ) );
|
2012-03-15 23:50:04 +00:00
|
|
|
}
|