diff options
author | Wohlstand <admin@wohlnet.ru> | 2017-11-19 21:15:25 +0300 |
---|---|---|
committer | Wohlstand <admin@wohlnet.ru> | 2017-11-19 21:15:25 +0300 |
commit | 7c9e90eb6b6e2b7459f056a9c76a1e3a12c27880 (patch) | |
tree | 2a4bcf00bd0c6741cb257033bab05b8d4f0bb13b /utils | |
parent | 1ebfef778e67329d221d82eb11592a50b0b49b6a (diff) | |
download | libADLMIDI-7c9e90eb6b6e2b7459f056a9c76a1e3a12c27880.tar.gz libADLMIDI-7c9e90eb6b6e2b7459f056a9c76a1e3a12c27880.tar.bz2 libADLMIDI-7c9e90eb6b6e2b7459f056a9c76a1e3a12c27880.zip |
Upgrated support for WOPL bank format to v3
Diffstat (limited to 'utils')
-rw-r--r-- | utils/gen_adldata/file_formats/load_wopl.h | 21 | ||||
-rw-r--r-- | utils/gen_adldata/measurer.cpp | 4 |
2 files changed, 19 insertions, 6 deletions
diff --git a/utils/gen_adldata/file_formats/load_wopl.h b/utils/gen_adldata/file_formats/load_wopl.h index 311b742..d573283 100644 --- a/utils/gen_adldata/file_formats/load_wopl.h +++ b/utils/gen_adldata/file_formats/load_wopl.h @@ -5,7 +5,10 @@ #include "../midi_inst_list.h" #include "common.h" -static const uint8_t wopl_latest_version = 2; +static const uint8_t wopl_latest_version = 3; + +#define WOPL_INST_SIZE_V2 62 +#define WOPL_INST_SIZE_V3 66 enum class WOPL_Flags { @@ -82,6 +85,10 @@ static bool LoadWopl(const char *fn, unsigned bank, const char *prefix) } } + size_t insSize = WOPL_INST_SIZE_V2; + if(version >= 3) + insSize = WOPL_INST_SIZE_V3; + uint32_t melodic_offset = 0; uint32_t percussion_offset = 0; if(version < 2) @@ -89,7 +96,7 @@ static bool LoadWopl(const char *fn, unsigned bank, const char *prefix) else melodic_offset = 0x13 + 34 * mbanks_count + 34 * pbanks_count; - percussion_offset = melodic_offset + (62 * 128 * mbanks_count); + percussion_offset = melodic_offset + (insSize * 128 * mbanks_count); uint32_t root_offsets[2] = {melodic_offset, percussion_offset}; @@ -98,11 +105,11 @@ static bool LoadWopl(const char *fn, unsigned bank, const char *prefix) bool is_percussion = (bset == 1); for(uint32_t bankno = 0; bankno < 1; bankno++) // only first melodic bank (Until multi-banks support will be implemented) { - uint32_t bank_offset = root_offsets[bset] + (bankno * 62 * 128); + uint32_t bank_offset = root_offsets[bset] + (bankno * insSize * 128); for(uint32_t i = 0; i < 128; i++) { - uint32_t offset = bank_offset + uint32_t(i * 62); + uint32_t offset = bank_offset + uint32_t(i * insSize); std::string name; insdata tmp[2]; @@ -147,6 +154,12 @@ static bool LoadWopl(const char *fn, unsigned bank, const char *prefix) tmp[1].data[8] = data[offset + 52 + 6]; tmp[1].data[9] = data[offset + 52 + 1]; tmp[1].data[10] = data[offset + 41]; + /* + * We will don't read two millisecond delays on tail of instrument + * as there are will be re-calculated by measurer here. + * Those fields are made for hot-loading while runtime, but not + * for generation of embedded banks database. + */ tmp[0].finetune = int8_t(toSint16BE((const uint8_t *)data.data() + offset + 32)); tmp[1].finetune = int8_t(toSint16BE((const uint8_t *)data.data() + offset + 34)); diff --git a/utils/gen_adldata/measurer.cpp b/utils/gen_adldata/measurer.cpp index 4789b43..f7108f6 100644 --- a/utils/gen_adldata/measurer.cpp +++ b/utils/gen_adldata/measurer.cpp @@ -223,8 +223,8 @@ DurationInfo MeasureDurations(const ins &in) result.quarter_amplitude_time = (double)quarter_amplitude_time; result.keyoff_out_time = (double)keyoff_out_time; - result.ms_sound_kon = (long)(quarter_amplitude_time * 1000.0 / interval); - result.ms_sound_koff = (long)(keyoff_out_time * 1000.0 / interval); + result.ms_sound_kon = (int64_t)(quarter_amplitude_time * 1000.0 / interval); + result.ms_sound_koff = (int64_t)(keyoff_out_time * 1000.0 / interval); result.nosound = (peak_amplitude_value < 0.5); return result; } |