diff options
author | Walter van Niftrik | 2010-01-09 02:17:17 +0000 |
---|---|---|
committer | Walter van Niftrik | 2010-01-09 02:17:17 +0000 |
commit | ac7458f91608d89c5921f0de6581ac1f139c68bd (patch) | |
tree | e0f7dcf8648dd9e0de653ab0cd4356dc4526daaa | |
parent | 6e991dc73ec44165cce1c49f2e72a5a97893fc12 (diff) | |
download | scummvm-rg350-ac7458f91608d89c5921f0de6581ac1f139c68bd.tar.gz scummvm-rg350-ac7458f91608d89c5921f0de6581ac1f139c68bd.tar.bz2 scummvm-rg350-ac7458f91608d89c5921f0de6581ac1f139c68bd.zip |
SCI: Fix handling of output rate in PCJr driver
svn-id: r47193
-rw-r--r-- | engines/sci/sound/softseq/pcjr.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/engines/sci/sound/softseq/pcjr.cpp b/engines/sci/sound/softseq/pcjr.cpp index 8b3df58737..3dc5af3be5 100644 --- a/engines/sci/sound/softseq/pcjr.cpp +++ b/engines/sci/sound/softseq/pcjr.cpp @@ -27,7 +27,6 @@ namespace Sci { -#define FREQUENCY 44100 #define VOLUME_SHIFT 3 #define BASE_NOTE 129 // A10 @@ -163,6 +162,7 @@ void MidiDriver_PCJr::generateSamples(int16 *data, int len) { int i; int chan; int freq[kMaxChannels]; + int frequency = getRate(); for (chan = 0; chan < _channels_nr; chan++) freq[chan] = get_freq(_notes[chan]); @@ -176,20 +176,20 @@ void MidiDriver_PCJr::generateSamples(int16 *data, int len) { >> VOLUME_SHIFT; _freq_count[chan] += freq[chan]; - while (_freq_count[chan] >= (FREQUENCY << 1)) - _freq_count[chan] -= (FREQUENCY << 1); + while (_freq_count[chan] >= (frequency << 1)) + _freq_count[chan] -= (frequency << 1); if (_freq_count[chan] - freq[chan] < 0) { /* Unclean rising edge */ int l = volume << 1; result += -volume + (l * _freq_count[chan]) / freq[chan]; - } else if (_freq_count[chan] >= FREQUENCY - && _freq_count[chan] - freq[chan] < FREQUENCY) { + } else if (_freq_count[chan] >= frequency + && _freq_count[chan] - freq[chan] < frequency) { /* Unclean falling edge */ int l = volume << 1; - result += volume - (l * (_freq_count[chan] - FREQUENCY)) / freq[chan]; + result += volume - (l * (_freq_count[chan] - frequency)) / freq[chan]; } else { - if (_freq_count[chan] < FREQUENCY) + if (_freq_count[chan] < frequency) result += volume; else result += -volume; |