diff options
author | Eugene Sandulenko | 2004-10-23 20:33:39 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-10-23 20:33:39 +0000 |
commit | 0b07a5f484c6ec602625f8919df95ecbe4839b83 (patch) | |
tree | f63880076166b54e80f8d0360f3fcb541c63bad3 /backends/midi/emumidi.h | |
parent | d168ce9394ade21ac39740dfca1aa61f3566250b (diff) | |
download | scummvm-rg350-0b07a5f484c6ec602625f8919df95ecbe4839b83.tar.gz scummvm-rg350-0b07a5f484c6ec602625f8919df95ecbe4839b83.tar.bz2 scummvm-rg350-0b07a5f484c6ec602625f8919df95ecbe4839b83.zip |
o Turn BASE_FREQ constant into variable. MT-32 has to be run in lesser time slices.
o Attempt to fix mi2, but that cure for symptom, not the cause. Under dosbox header is always valid, but here we get 0x41001612 instead of 0x41101612.
svn-id: r15669
Diffstat (limited to 'backends/midi/emumidi.h')
-rw-r--r-- | backends/midi/emumidi.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/backends/midi/emumidi.h b/backends/midi/emumidi.h index a7b3821e82..cdff7051d1 100644 --- a/backends/midi/emumidi.h +++ b/backends/midi/emumidi.h @@ -23,7 +23,6 @@ #include "sound/mididrv.h" #include "sound/mixer.h" -#define BASE_FREQ 250 #define FIXP_SHIFT 16 class MidiDriver_Emulated : public AudioStream, public MidiDriver { @@ -42,6 +41,8 @@ protected: virtual void generate_samples(int16 *buf, int len) = 0; virtual void on_timer() {} + int _baseFreq; + public: MidiDriver_Emulated(SoundMixer *mixer) : _mixer(mixer) { _isOpen = false; @@ -51,18 +52,20 @@ public: _next_tick = 0; _samples_per_tick = 0; + + _baseFreq = 250; } int open() { _isOpen = true; - int d = getRate() / BASE_FREQ; - int r = getRate() % BASE_FREQ; + int d = getRate() / _baseFreq; + int r = getRate() % _baseFreq; // This is equivalent to (getRate() << FIXP_SHIFT) / BASE_FREQ // but less prone to arithmetic overflow. - _samples_per_tick = (d << FIXP_SHIFT) + (r << FIXP_SHIFT) / BASE_FREQ; + _samples_per_tick = (d << FIXP_SHIFT) + (r << FIXP_SHIFT) / _baseFreq; return 0; } @@ -71,7 +74,7 @@ public: _timer_param = timer_param; } - uint32 getBaseTempo() { return 1000000 / BASE_FREQ; } + uint32 getBaseTempo() { return 1000000 / _baseFreq; } // AudioStream API |