diff options
author | Wohlstand <admin@wohlnet.ru> | 2017-11-04 13:01:18 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2017-11-04 13:01:18 +0300 |
commit | 79a4100777d99c00e983ee78b4539acc349bd148 (patch) | |
tree | cd20074405f9ef42fbf83d5f579e33c317876b9f /utils | |
parent | 3d04ebe23175c0b723d4bde8ecdecc57b31f3ad6 (diff) | |
download | libADLMIDI-79a4100777d99c00e983ee78b4539acc349bd148.tar.gz libADLMIDI-79a4100777d99c00e983ee78b4539acc349bd148.tar.bz2 libADLMIDI-79a4100777d99c00e983ee78b4539acc349bd148.zip |
Don't use force difference for pseudo-4op voices in GenAdlData
Diffstat (limited to 'utils')
-rw-r--r-- | utils/gen_adldata/file_formats/load_wopl.h | 4 | ||||
-rw-r--r-- | utils/gen_adldata/progs_cache.h | 13 |
2 files changed, 13 insertions, 4 deletions
diff --git a/utils/gen_adldata/file_formats/load_wopl.h b/utils/gen_adldata/file_formats/load_wopl.h index 300a3a0..08efecb 100644 --- a/utils/gen_adldata/file_formats/load_wopl.h +++ b/utils/gen_adldata/file_formats/load_wopl.h @@ -125,7 +125,7 @@ static bool LoadWopl(const char *fn, unsigned bank, const char *prefix) tmp2.pseudo4op = (flags & 0x02) != 0; tmp2.voice2_fine_tune = 0; tmp[0].diff = false; - tmp[1].diff = tmp2.pseudo4op; + tmp[1].diff = false;//tmp2.pseudo4op; int8_t fine_tune = (int8_t)data[offset + 37]; if(fine_tune != 0) @@ -220,7 +220,7 @@ static bool LoadWopl(const char *fn, unsigned bank, const char *prefix) tmp2.pseudo4op = (flags & 0x02) != 0; tmp2.voice2_fine_tune = 0; tmp[0].diff = false; - tmp[1].diff = tmp2.pseudo4op; + tmp[1].diff = false;//tmp2.pseudo4op; int8_t fine_tune = (int8_t)data[offset + 37]; if(fine_tune != 0) diff --git a/utils/gen_adldata/progs_cache.h b/utils/gen_adldata/progs_cache.h index d652b9e..96dfe32 100644 --- a/utils/gen_adldata/progs_cache.h +++ b/utils/gen_adldata/progs_cache.h @@ -9,6 +9,8 @@ #include <cstdint> #include <string> #include <vector> +#include <limits> +#include <cmath> struct insdata { @@ -37,6 +39,13 @@ struct insdata } }; +inline bool equal_approx(double const a, double const b) +{ + double const epsilon(std::numeric_limits<double>::epsilon() * 100); + double const scale(1.0); + return std::fabs(a - b) < epsilon * (scale + (std::max)(std::fabs(a), std::fabs(b))); +} + struct ins { size_t insno1, insno2; @@ -50,7 +59,7 @@ struct ins && insno1 == b.insno1 && insno2 == b.insno2 && pseudo4op == b.pseudo4op - && voice2_fine_tune == b.voice2_fine_tune; + && equal_approx(voice2_fine_tune, b.voice2_fine_tune); } bool operator< (const ins &b) const { @@ -58,7 +67,7 @@ struct ins if(insno2 != b.insno2) return insno2 < b.insno2; if(notenum != b.notenum) return notenum < b.notenum; if(pseudo4op != b.pseudo4op) return pseudo4op < b.pseudo4op; - if(voice2_fine_tune != b.voice2_fine_tune) return voice2_fine_tune < b.voice2_fine_tune; + if(!equal_approx(voice2_fine_tune, b.voice2_fine_tune)) return voice2_fine_tune < b.voice2_fine_tune; return 0; } bool operator!=(const ins &b) const |