diff options
author | Wohlstand <admin@wohlnet.ru> | 2020-08-24 00:04:45 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2020-08-24 00:04:45 +0300 |
commit | c9cfbda24b2ad1b1c646b8104ec86c5541d80451 (patch) | |
tree | cf0cae525e16f4e2b2fce1309059cc71cf9c1353 /src/adlmidi_cvt.hpp | |
parent | 1b4237dffce60e8546e550767b2816c1979bbb9d (diff) | |
download | libADLMIDI-c9cfbda24b2ad1b1c646b8104ec86c5541d80451.tar.gz libADLMIDI-c9cfbda24b2ad1b1c646b8104ec86c5541d80451.tar.bz2 libADLMIDI-c9cfbda24b2ad1b1c646b8104ec86c5541d80451.zip |
Another piece of removed code
Diffstat (limited to 'src/adlmidi_cvt.hpp')
-rw-r--r-- | src/adlmidi_cvt.hpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/adlmidi_cvt.hpp b/src/adlmidi_cvt.hpp index 3b2e07d..74b9f78 100644 --- a/src/adlmidi_cvt.hpp +++ b/src/adlmidi_cvt.hpp @@ -78,17 +78,11 @@ static void cvt_FMIns_to_generic(WOPLI &ins, const adlinsdata2 &in) double voice2_fine_tune = in.voice2_fine_tune; if(voice2_fine_tune != 0) { - if(voice2_fine_tune > 0 && voice2_fine_tune <= 0.000025) - ins.second_voice_detune = 1; - else if(voice2_fine_tune < 0 && voice2_fine_tune >= -0.000025) - ins.second_voice_detune = -1; - else - { - long value = static_cast<long>(round(voice2_fine_tune * (1000.0 / 15.625))); - value = (value < -128) ? -128 : value; - value = (value > +127) ? +127 : value; - ins.second_voice_detune = static_cast<int8_t>(value); - } + int m = (int)(voice2_fine_tune * 32.0); + m += 64; + m <<= 1; + m -= 128; + ins.second_voice_detune = (uint8_t)m; } ins.midi_velocity_offset = in.midi_velocity_offset; |