Successful test of full sound config window functionality.

This commit is contained in:
Matthew Budd 2020-07-02 21:05:08 -04:00
parent 021452b7f0
commit 91e5427258
2 changed files with 30 additions and 1 deletions

View File

@ -51,6 +51,8 @@ GameSndConfDialog_t::GameSndConfDialog_t(QWidget *parent)
setComboBoxFromProperty( qualitySelect, "SDL.Sound.Quality" ); setComboBoxFromProperty( qualitySelect, "SDL.Sound.Quality" );
connect(qualitySelect, SIGNAL(currentIndexChanged(int)), this, SLOT(soundQualityChanged(int)) );
hbox2->addWidget( lbl ); hbox2->addWidget( lbl );
hbox2->addWidget( qualitySelect ); hbox2->addWidget( qualitySelect );
@ -71,6 +73,8 @@ GameSndConfDialog_t::GameSndConfDialog_t(QWidget *parent)
setComboBoxFromProperty( rateSelect, "SDL.Sound.Rate" ); setComboBoxFromProperty( rateSelect, "SDL.Sound.Rate" );
connect(rateSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(soundRateChanged(int)) );
g_config->getOption ("SDL.Sound.Rate", &buf); g_config->getOption ("SDL.Sound.Rate", &buf);
hbox2->addWidget( lbl ); hbox2->addWidget( lbl );
@ -231,7 +235,7 @@ void GameSndConfDialog_t::setComboBoxFromProperty( QComboBox *cbx, const char *
for (i=0; i<cbx->count(); i++) for (i=0; i<cbx->count(); i++)
{ {
if ( pval == cbx->itemData(i) ) if ( pval == cbx->itemData(i).toInt() )
{ {
cbx->setCurrentIndex(i); break; cbx->setCurrentIndex(i); break;
} }
@ -383,3 +387,26 @@ void GameSndConfDialog_t::swapDutyCallback(int value)
g_config->save (); g_config->save ();
} }
//---------------------------------------------------- //----------------------------------------------------
void GameSndConfDialog_t::soundQualityChanged(int index)
{
//printf("Sound Quality: %i : %i \n", index, qualitySelect->itemData(index).toInt() );
g_config->setOption ("SDL.Sound.Quality", qualitySelect->itemData(index).toInt() );
// reset sound subsystem for changes to take effect
KillSound ();
InitSound ();
g_config->save ();
}
//----------------------------------------------------
void GameSndConfDialog_t::soundRateChanged(int index)
{
//printf("Sound Rate: %i : %i \n", index, rateSelect->itemData(index).toInt() );
g_config->setOption ("SDL.Sound.Rate", rateSelect->itemData(index).toInt() );
// reset sound subsystem for changes to take effect
KillSound ();
InitSound ();
g_config->save ();
}
//----------------------------------------------------

View File

@ -54,6 +54,8 @@ class GameSndConfDialog_t : public QDialog
void enaSoundStateChange(int value); void enaSoundStateChange(int value);
void enaSoundLowPassChange(int value); void enaSoundLowPassChange(int value);
void swapDutyCallback(int value); void swapDutyCallback(int value);
void soundQualityChanged(int index);
void soundRateChanged(int index);
}; };