aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Crozat2015-05-10 16:04:26 +0100
committerThierry Crozat2015-05-10 16:14:55 +0100
commit0cb0a09c02f20626bbcf2bb89341b02b7b3ff12c (patch)
tree165b7437ee302cbd5aa97b6ea1fcafdfdd0a8ff6
parent830f8c42f51016ca7056b391478359453473042c (diff)
downloadscummvm-rg350-0cb0a09c02f20626bbcf2bb89341b02b7b3ff12c.tar.gz
scummvm-rg350-0cb0a09c02f20626bbcf2bb89341b02b7b3ff12c.tar.bz2
scummvm-rg350-0cb0a09c02f20626bbcf2bb89341b02b7b3ff12c.zip
AGI: Change the way the mixer volume is handled in the PCjr player
Instead of factoring the volume into the tone attenuation it now scales the volume table. This way it still uses the full table when playing at a low volume and therefore keeps the 16 attenuation levels. Also use kMusicSoundType instead of kSFXSoundType to be coherent with what the MIDI output is doing (volume for both music and SFX is controlled by the Music volume slider).
-rw-r--r--engines/agi/sound_pcjr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index 83adcac747..17370cb32f 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -205,7 +205,6 @@ int SoundGenPCJr::volumeCalc(SndGenChan *chan) {
chan->attenuationCopy = attenuation;
attenuation &= 0x0F;
- attenuation += (16 - _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 17);
if (attenuation > 0x0F)
attenuation = 0x0F;
}
@@ -475,8 +474,9 @@ int SoundGenPCJr::fillSquare(ToneChan *t, int16 *buf, int len) {
count = len;
+ int16 amp = (int16)(volTable[t->atten] * _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / Audio::Mixer::kMaxMixerVolume);
while (count > 0) {
- *(buf++) = t->sign ? volTable[t->atten] : -volTable[t->atten];
+ *(buf++) = t->sign ? amp : -amp;
count--;
// get next sample
@@ -513,8 +513,9 @@ int SoundGenPCJr::fillNoise(ToneChan *t, int16 *buf, int len) {
count = len;
+ int16 amp = (int16)(volTable[t->atten] * _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / Audio::Mixer::kMaxMixerVolume);
while (count > 0) {
- *(buf++) = t->sign ? volTable[t->atten] : -volTable[t->atten];
+ *(buf++) = t->sign ? amp : -amp;
count--;
// get next sample