diff options
author | Max Horn | 2003-10-06 13:02:06 +0000 |
---|---|---|
committer | Max Horn | 2003-10-06 13:02:06 +0000 |
commit | 5a1bd7574afa9e094a138c7b4e4eb17c196cd61b (patch) | |
tree | 6646b50bae5935b404b5c1916cf6af3b7ec00b35 /backends/midi/ym2612.cpp | |
parent | ca13989959ffda548060678043a3777d97fd814b (diff) | |
download | scummvm-rg350-5a1bd7574afa9e094a138c7b4e4eb17c196cd61b.tar.gz scummvm-rg350-5a1bd7574afa9e094a138c7b4e4eb17c196cd61b.tar.bz2 scummvm-rg350-5a1bd7574afa9e094a138c7b4e4eb17c196cd61b.zip |
some more tweaks
svn-id: r10637
Diffstat (limited to 'backends/midi/ym2612.cpp')
-rw-r--r-- | backends/midi/ym2612.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/backends/midi/ym2612.cpp b/backends/midi/ym2612.cpp index 804be02a8f..8f9c4dfa79 100644 --- a/backends/midi/ym2612.cpp +++ b/backends/midi/ym2612.cpp @@ -324,6 +324,7 @@ void Operator2612::nextTick(uint16 rate, const int *phasebuf, int *outbuf, int b int32 target; State next_state; const int32 zero_level = ((int32)0x7f << 15); + const int phaseIncrement = (_multiple > 0) ? (_frequency * _multiple) : (_frequency / 2); while (buflen) { switch (_state) { @@ -355,19 +356,13 @@ void Operator2612::nextTick(uint16 rate, const int *phasebuf, int *outbuf, int b if (next_state == _s_attacking) { // Attack phase ++_tickCount; - if (_attackTime <= 0) { + int i = (int) (_tickCount * _attackTime); + if (i >= 1024) { _currentLevel = 0; _state = _s_decaying; switching = true; } else { - int i = (int) (_tickCount * _attackTime); - if (i >= 1024) { - _currentLevel = 0; - _state = _s_decaying; - switching = true; - } else { - _currentLevel = attackOut[i] << (31 - 8 - 16); - } + _currentLevel = (attackOut[i] << (31 - 8 - 16)); } } else { // Decay, Sustain and Release phases @@ -402,12 +397,7 @@ void Operator2612::nextTick(uint16 rate, const int *phasebuf, int *outbuf, int b // Result varies from original code by max of 8. output = ((output >> 4) * (powtbl[511-((level>>9)&511)] >> 3)) / 1024; - if (_multiple > 0) -// _phase += (_frequency * _multiple) / rate; - _phase += _frequency * _multiple; // / rate; already included - else -// _phase += _frequency / (rate << 1); - _phase += _frequency / 2; + _phase += phaseIncrement; } _lastOutput = output; |