aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/options.cpp9
-rw-r--r--sound/rate.cpp11
2 files changed, 11 insertions, 9 deletions
diff --git a/gui/options.cpp b/gui/options.cpp
index 9bb21499d0..93ff0ccc96 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -26,11 +26,12 @@
#include "gui/PopUpWidget.h"
#include "gui/TabWidget.h"
-#include "backends/fs/fs.h"
#include "base/gameDetector.h"
+#include "backends/fs/fs.h"
#include "common/config-manager.h"
#include "common/scaler.h"
#include "sound/mididrv.h"
+#include "sound/mixer.h"
#if (!( defined(__PALM_OS__) || defined(__DC__) || defined(__GP32__)) && !defined(_MSC_VER))
#include <sys/param.h>
@@ -328,19 +329,19 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) {
// Volume controllers
_musicVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Music volume: ", 100, kMusicVolumeChanged);
_musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
- _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(255);
+ _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(SoundMixer::kMaxMixerVolume);
_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
_sfxVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged);
_sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
- _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255);
+ _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(SoundMixer::kMaxMixerVolume);
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
_speechVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Speech volume: ", 100, kSpeechVolumeChanged);
_speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
- _speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(255);
+ _speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(SoundMixer::kMaxMixerVolume);
_speechVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16;
diff --git a/sound/rate.cpp b/sound/rate.cpp
index 68fedb1812..1b5ceecf86 100644
--- a/sound/rate.cpp
+++ b/sound/rate.cpp
@@ -28,8 +28,9 @@
*/
#include "stdafx.h"
-#include "sound/rate.h"
#include "sound/audiostream.h"
+#include "sound/rate.h"
+#include "sound/mixer.h"
/**
* The precision of the fractional computations used by the rate converter.
@@ -166,10 +167,10 @@ int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp
}
// output left channel
- clampedAdd(*obuf++, (out[0] * (int)vol_l) >> 8);
+ clampedAdd(*obuf++, (out[0] * (int)vol_l) / SoundMixer::kMaxMixerVolume);
// output right channel
- clampedAdd(*obuf++, (out[1] * (int)vol_r) >> 8);
+ clampedAdd(*obuf++, (out[1] * (int)vol_r) / SoundMixer::kMaxMixerVolume);
// Increment output position
unsigned long tmp = opos_frac + opos_inc_frac;
@@ -236,10 +237,10 @@ public:
}
// output left channel
- clampedAdd(*obuf++, (tmp0 * (int)vol_l) >> 8);
+ clampedAdd(*obuf++, (tmp0 * (int)vol_l) / SoundMixer::kMaxMixerVolume);
// output right channel
- clampedAdd(*obuf++, (tmp1 * (int)vol_r) >> 8);
+ clampedAdd(*obuf++, (tmp1 * (int)vol_r) / SoundMixer::kMaxMixerVolume);
}
return (ST_SUCCESS);
}