mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-26 12:48:16 +00:00
EMI: Remap volumes from the range 0-100 to the range 0-255 for the audio mixer.
This commit is contained in:
parent
d5355e6713
commit
029b57e3ab
@ -53,9 +53,9 @@ class EMISound {
|
||||
public:
|
||||
EMISound(int fps);
|
||||
~EMISound();
|
||||
bool startVoice(const Common::String &soundName, int volume = 127, int pan = 64);
|
||||
bool startSfx(const Common::String &soundName, int volume = 127, int pan = 64);
|
||||
bool startSfxFrom(const Common::String &soundName, const Math::Vector3d &pos, int volume = 127);
|
||||
bool startVoice(const Common::String &soundName, int volume = 100, int pan = 64);
|
||||
bool startSfx(const Common::String &soundName, int volume = 100, int pan = 64);
|
||||
bool startSfxFrom(const Common::String &soundName, const Math::Vector3d &pos, int volume = 100);
|
||||
bool getSoundStatus(const Common::String &soundName);
|
||||
void stopSound(const Common::String &soundName);
|
||||
int32 getPosIn16msTicks(const Common::String &soundName);
|
||||
|
@ -39,7 +39,7 @@ SoundTrack::SoundTrack() {
|
||||
_paused = false;
|
||||
_positioned = false;
|
||||
_balance = 0;
|
||||
_volume = Audio::Mixer::kMaxChannelVolume;
|
||||
_volume = 100;
|
||||
_disposeAfterPlaying = DisposeAfterUse::YES;
|
||||
_sync = 0;
|
||||
_fadeMode = FadeNone;
|
||||
@ -64,6 +64,9 @@ void SoundTrack::setSoundName(const Common::String &name) {
|
||||
}
|
||||
|
||||
void SoundTrack::setVolume(int volume) {
|
||||
if (volume > 100) {
|
||||
volume = 100;
|
||||
}
|
||||
_volume = volume;
|
||||
if (_handle) {
|
||||
g_system->getMixer()->setChannelVolume(*_handle, (byte)getEffectiveVolume());
|
||||
@ -146,7 +149,8 @@ void SoundTrack::setFade(float fade) {
|
||||
}
|
||||
|
||||
int SoundTrack::getEffectiveVolume() {
|
||||
return _volume * _attenuation * _fade;
|
||||
int mixerVolume = _volume * Audio::Mixer::kMaxChannelVolume / 100;
|
||||
return mixerVolume * _attenuation * _fade;
|
||||
}
|
||||
|
||||
} // end of namespace Grim
|
||||
|
Loading…
x
Reference in New Issue
Block a user