From c9cfbda24b2ad1b1c646b8104ec86c5541d80451 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Mon, 24 Aug 2020 00:04:45 +0300 Subject: Another piece of removed code --- src/adlmidi_cvt.hpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/adlmidi_cvt.hpp') 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(round(voice2_fine_tune * (1000.0 / 15.625))); - value = (value < -128) ? -128 : value; - value = (value > +127) ? +127 : value; - ins.second_voice_detune = static_cast(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; -- cgit v1.2.3