Skip to content

Commit

Permalink
AGI: Change the way the mixer volume is handled in the PCjr player
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
criezy committed May 10, 2015
1 parent 830f8c4 commit 0cb0a09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions engines/agi/sound_pcjr.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0cb0a09

Please sign in to comment.