--- a/QTfrontend/game.cpp Thu Jan 29 17:27:43 2009 +0000
+++ b/QTfrontend/game.cpp Fri Jan 30 14:56:27 2009 +0000
@@ -272,7 +272,7 @@
arguments << (config->vid_Fullscreen() ? "1" : "0");
arguments << (config->isSoundEnabled() ? "1" : "0");
arguments << tr("en.txt");
- arguments << "128"; // sound volume
+ arguments << QString::number(config->volume()); // sound volume
arguments << QString::number(config->timerInterval());
arguments << datadir->absolutePath();
arguments << (config->isShowFPSEnabled() ? "1" : "0");
--- a/QTfrontend/gameuiconfig.cpp Thu Jan 29 17:27:43 2009 +0000
+++ b/QTfrontend/gameuiconfig.cpp Fri Jan 30 14:56:27 2009 +0000
@@ -46,6 +46,7 @@
Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
+ Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
Form->ui.pageOptions->editNetNick->setText(value("net/nick", QLineEdit::tr("unnamed")).toString());
@@ -99,6 +100,7 @@
setValue("audio/sound", isSoundEnabled());
setValue("audio/music", isMusicEnabled());
+ setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
setValue("net/nick", netNick());
setValue("net/ip", *netHost);
@@ -174,3 +176,8 @@
{
return Form->ui.pageOptions->editNetNick->text();
}
+
+quint8 GameUIConfig::volume()
+{
+ return Form->ui.pageOptions->volumeBox->value() * 128 / 100;
+}
--- a/QTfrontend/gameuiconfig.h Thu Jan 29 17:27:43 2009 +0000
+++ b/QTfrontend/gameuiconfig.h Fri Jan 30 14:56:27 2009 +0000
@@ -40,6 +40,7 @@
bool isShowFPSEnabled();
bool isAltDamageEnabled();
bool appendDateTimeToRecordName();
+ quint8 volume();
quint8 timerInterval();
quint8 bitDepth();
QString netNick();
--- a/QTfrontend/pages.cpp Thu Jan 29 17:27:43 2009 +0000
+++ b/QTfrontend/pages.cpp Fri Jan 30 14:56:27 2009 +0000
@@ -399,6 +399,17 @@
CBEnableMusic->setText(QCheckBox::tr("Enable music"));
GBAlayout->addWidget(CBEnableMusic);
+ QHBoxLayout * GBAvollayout = new QHBoxLayout(0);
+ QLabel * vol = new QLabel(AGGroupBox);
+ vol->setText(QLabel::tr("Initial sound volume"));
+ GBAvollayout->addWidget(vol);
+ GBAlayout->addLayout(GBAvollayout);
+ volumeBox = new QSpinBox(AGGroupBox);
+ volumeBox->setRange(0, 100);
+ volumeBox->setSingleStep(5);
+ GBAvollayout->addWidget(volumeBox);
+
+
CBShowFPS = new QCheckBox(AGGroupBox);
CBShowFPS->setText(QCheckBox::tr("Show FPS"));
GBAlayout->addWidget(CBShowFPS);
--- a/QTfrontend/pages.h Thu Jan 29 17:27:43 2009 +0000
+++ b/QTfrontend/pages.h Fri Jan 30 14:56:27 2009 +0000
@@ -214,6 +214,7 @@
FPSEdit *fpsedit;
QPushButton *BtnSaveOptions;
QLabel *labelNN;
+ QSpinBox * volumeBox;
QLineEdit *editNetNick;
};
--- a/hedgewars/uSound.pas Thu Jan 29 17:27:43 2009 +0000
+++ b/hedgewars/uSound.pas Fri Jan 30 14:56:27 2009 +0000
@@ -77,9 +77,8 @@
Mix_AllocateChannels(Succ(chanTPU));
if isMusicEnabled then Mix_VolumeMusic(50);
-Volume:= cInitVolume;
-if Volume < 0 then Volume:= 0;
-Volume:= Mix_Volume(-1, Volume)
+Volume:= 0;
+ChangeVolume(cInitVolume)
end;
procedure ReleaseSound;