Use SoundMixer::kMaxMixerVolume

svn-id: r16351
This commit is contained in:
Max Horn 2004-12-27 23:58:04 +00:00
parent 53ff19eccb
commit 48e70acbaa
2 changed files with 11 additions and 9 deletions

View File

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

View File

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