From 86d471c8d664f0c6921f30f0fce4e8d2a7cab77d Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Thu, 6 Jun 2019 21:27:19 +0300 Subject: Added IBK and C++98 support for generated database --- src/adlmidi_db.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/adlmidi_db.h (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h new file mode 100644 index 0000000..7294c6d --- /dev/null +++ b/src/adlmidi_db.h @@ -0,0 +1,52 @@ +#include +#include +#include + +extern const size_t g_embeddedBanksCount; + +struct BanksDump +{ + struct BankEntry + { + uint16_t bankSetup; + uint16_t banksMelodicCount; + uint16_t banksPercussionCount; + const char *title; + uint16_t banksOffsetMelodic; + uint16_t banksOffsetPercussive; + }; + + struct MidiBank + { + uint8_t msb; + uint8_t lsb; + int16_t insts[128]; + }; + + struct InstrumentEntry + { + int16_t noteOffset1; + int16_t noteOffset2; + int8_t midiVelocityOffset; + uint8_t percussionKeyNumber; + uint8_t instFlags; + int8_t secondVoiceDetune; + uint16_t fbConn; + uint16_t delay_on_ms; + uint16_t delay_off_ms; + int16_t ops[4]; + }; + + struct Operator + { + uint32_t d_E862; + uint8_t d_40; + }; +}; + +extern const BanksDump::BankEntry g_embeddedBanks[]; +extern const size_t g_embeddedBanksMidiIndex[]; +extern const BanksDump::MidiBank g_embeddedBanksMidi[]; +extern const BanksDump::InstrumentEntry g_embeddedBanksInstruments[]; +extern const BanksDump::Operator g_embeddedBanksOperators[]; + -- cgit v1.2.3 From c011f08e4487935d7a523009b380963c508a2c9f Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Thu, 6 Jun 2019 21:36:08 +0300 Subject: Pack database structures to reduce binary size --- src/adlmidi_db.h | 82 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 37 deletions(-) (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h index 7294c6d..eb6ba87 100644 --- a/src/adlmidi_db.h +++ b/src/adlmidi_db.h @@ -2,46 +2,54 @@ #include #include +#ifndef _MSC_VER +#define ATTRIB_PACKED __attribute__((__packed__)) +#else +#define ATTRIB_PACKED +#endif + extern const size_t g_embeddedBanksCount; -struct BanksDump +namespace BanksDump +{ + +struct BankEntry +{ + uint16_t bankSetup; + uint16_t banksMelodicCount; + uint16_t banksPercussionCount; + const char *title; + uint16_t banksOffsetMelodic; + uint16_t banksOffsetPercussive; +} ATTRIB_PACKED; + +struct MidiBank { - struct BankEntry - { - uint16_t bankSetup; - uint16_t banksMelodicCount; - uint16_t banksPercussionCount; - const char *title; - uint16_t banksOffsetMelodic; - uint16_t banksOffsetPercussive; - }; - - struct MidiBank - { - uint8_t msb; - uint8_t lsb; - int16_t insts[128]; - }; - - struct InstrumentEntry - { - int16_t noteOffset1; - int16_t noteOffset2; - int8_t midiVelocityOffset; - uint8_t percussionKeyNumber; - uint8_t instFlags; - int8_t secondVoiceDetune; - uint16_t fbConn; - uint16_t delay_on_ms; - uint16_t delay_off_ms; - int16_t ops[4]; - }; - - struct Operator - { - uint32_t d_E862; - uint8_t d_40; - }; + uint8_t msb; + uint8_t lsb; + int16_t insts[128]; +} ATTRIB_PACKED; + +struct InstrumentEntry +{ + int16_t noteOffset1; + int16_t noteOffset2; + int8_t midiVelocityOffset; + uint8_t percussionKeyNumber; + uint8_t instFlags; + int8_t secondVoiceDetune; + uint16_t fbConn; + uint16_t delay_on_ms; + uint16_t delay_off_ms; + int16_t ops[4]; +} ATTRIB_PACKED; + +struct Operator +{ + uint32_t d_E862; + uint8_t d_40; +} ATTRIB_PACKED; + }; extern const BanksDump::BankEntry g_embeddedBanks[]; -- cgit v1.2.3 From d02cf717c2da0344b37db1ffb864d312713f3208 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sun, 30 Jun 2019 17:05:36 +0300 Subject: Minor fix --- src/adlmidi_db.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h index eb6ba87..940e3a3 100644 --- a/src/adlmidi_db.h +++ b/src/adlmidi_db.h @@ -50,7 +50,7 @@ struct Operator uint8_t d_40; } ATTRIB_PACKED; -}; +} /* namespace BanksDump */ extern const BanksDump::BankEntry g_embeddedBanks[]; extern const size_t g_embeddedBanksMidiIndex[]; -- cgit v1.2.3 From 81f905ea76f0efb6ea35331bd1fe476f14f804de Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Mon, 1 Jul 2019 05:01:55 +0300 Subject: First working of new database // not so stable, needs a polishing, however, multibank from embedded 72'th bank (DMXOPL3) works! --- src/adlmidi_db.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h index 940e3a3..5848117 100644 --- a/src/adlmidi_db.h +++ b/src/adlmidi_db.h @@ -8,6 +8,8 @@ #define ATTRIB_PACKED #endif +typedef uint16_t bank_count_t; + extern const size_t g_embeddedBanksCount; namespace BanksDump @@ -16,11 +18,11 @@ namespace BanksDump struct BankEntry { uint16_t bankSetup; - uint16_t banksMelodicCount; - uint16_t banksPercussionCount; + bank_count_t banksMelodicCount; + bank_count_t banksPercussionCount; const char *title; - uint16_t banksOffsetMelodic; - uint16_t banksOffsetPercussive; + bank_count_t banksOffsetMelodic; + bank_count_t banksOffsetPercussive; } ATTRIB_PACKED; struct MidiBank -- cgit v1.2.3 From bca3c8a1ef8f26ed44da8f37b93ebd360d52f378 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Tue, 2 Jul 2019 17:34:00 +0300 Subject: Bank names array for compatibility and less DB source file size Yes, the compatibility is needed... for public function that gives RO an access to that array. --- src/adlmidi_db.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h index 5848117..9f16b60 100644 --- a/src/adlmidi_db.h +++ b/src/adlmidi_db.h @@ -54,6 +54,7 @@ struct Operator } /* namespace BanksDump */ +extern const char* const g_embeddedBankNames[]; extern const BanksDump::BankEntry g_embeddedBanks[]; extern const size_t g_embeddedBanksMidiIndex[]; extern const BanksDump::MidiBank g_embeddedBanksMidi[]; -- cgit v1.2.3 From 2ba770631ff1dc978d16a874a4ab99930ce12d2d Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Wed, 19 Aug 2020 02:11:01 +0300 Subject: Use new banks database format However, it's stil need to clean-up and fix gen_adldata for a correct work! --- src/adlmidi_db.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h index 9f16b60..a560e9c 100644 --- a/src/adlmidi_db.h +++ b/src/adlmidi_db.h @@ -1,3 +1,32 @@ +/* + * libADLMIDI is a free Software MIDI synthesizer library with OPL3 emulation + * + * Original ADLMIDI code: Copyright (c) 2010-2014 Joel Yliluoma + * ADLMIDI Library API: Copyright (c) 2015-2020 Vitaly Novichkov + * + * Library is based on the ADLMIDI, a MIDI player for Linux and Windows with OPL3 emulation: + * http://iki.fi/bisqwit/source/adlmidi.html + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#ifndef ADLDATA_DB_H +#define ADLDATA_DB_H + +#pragma once + #include #include #include @@ -10,7 +39,9 @@ typedef uint16_t bank_count_t; +#ifndef DISABLE_EMBEDDED_BANKS extern const size_t g_embeddedBanksCount; +#endif namespace BanksDump { @@ -54,10 +85,13 @@ struct Operator } /* namespace BanksDump */ +#ifndef DISABLE_EMBEDDED_BANKS extern const char* const g_embeddedBankNames[]; extern const BanksDump::BankEntry g_embeddedBanks[]; extern const size_t g_embeddedBanksMidiIndex[]; extern const BanksDump::MidiBank g_embeddedBanksMidi[]; extern const BanksDump::InstrumentEntry g_embeddedBanksInstruments[]; extern const BanksDump::Operator g_embeddedBanksOperators[]; +#endif +#endif // ADLDATA_DB_H -- cgit v1.2.3 From 761bd05f107b856c8aefeb3e753fa94221f926bc Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Mon, 24 Aug 2020 13:32:11 +0300 Subject: Fixed a bug of junk instruments instead of blank --- src/adlmidi_db.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/adlmidi_db.h') diff --git a/src/adlmidi_db.h b/src/adlmidi_db.h index a560e9c..1a55e4b 100644 --- a/src/adlmidi_db.h +++ b/src/adlmidi_db.h @@ -38,6 +38,7 @@ #endif typedef uint16_t bank_count_t; +typedef int16_t midi_bank_idx_t; #ifndef DISABLE_EMBEDDED_BANKS extern const size_t g_embeddedBanksCount; @@ -60,7 +61,7 @@ struct MidiBank { uint8_t msb; uint8_t lsb; - int16_t insts[128]; + midi_bank_idx_t insts[128]; } ATTRIB_PACKED; struct InstrumentEntry -- cgit v1.2.3