From 6c495486cdd3c3c8f5c3c945e79233128a7479f9 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Tue, 28 Aug 2018 04:28:20 +0200 Subject: XMI: fix the VLQ reading procedure --- src/cvt_xmi2mid.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cvt_xmi2mid.hpp b/src/cvt_xmi2mid.hpp index decb25c..e8d9dbf 100644 --- a/src/cvt_xmi2mid.hpp +++ b/src/cvt_xmi2mid.hpp @@ -640,7 +640,7 @@ static int xmi2mid_GetVLQ2(struct xmi2mid_xmi_ctx *ctx, uint32_t *quant) { int32_t data; *quant = 0; - for (i = 0; i < 4; i++) { + for (i = 0; xmi2mid_getsrcpos(ctx) != xmi2mid_getsrcsize(ctx); ++i) { data = xmi2mid_read1(ctx); if (data & 0x80) { xmi2mid_skipsrc(ctx, -1); -- cgit v1.2.3 From 66d2b296616663603a64d4196bfd00f9c5f039da Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Tue, 28 Aug 2018 10:26:21 +0200 Subject: sequencer: enable end silence skipping --- CMakeLists.txt | 1 + libADLMIDI-test.pro | 1 + libADLMIDI.pro | 1 + src/midi_sequencer_impl.hpp | 13 +++++++++++++ 4 files changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91baffb..aeec85e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,6 +226,7 @@ if(WITH_MIDI_SEQUENCER) list(APPEND libADLMIDI_SOURCES ${libADLMIDI_SOURCE_DIR}/src/adlmidi_sequencer.cpp ) + add_definitions(-DENABLE_END_SILENCE_SKIPPING) endif() if(NOT WITH_MUS_SUPPORT OR NOT WITH_MIDI_SEQUENCER) diff --git a/libADLMIDI-test.pro b/libADLMIDI-test.pro index d98d6bd..ec5dd1a 100644 --- a/libADLMIDI-test.pro +++ b/libADLMIDI-test.pro @@ -18,6 +18,7 @@ LIBS += -lSDL2 -lpthread -ldl #DEFINES += DISABLE_EMBEDDED_BANKS #DEFINES += ADLMIDI_USE_DOSBOX_OPL #DEFINES += ENABLE_BEGIN_SILENCE_SKIPPING +DEFINES += ENABLE_END_SILENCE_SKIPPING #DEFINES += DEBUG_TRACE_ALL_EVENTS #DEFINES += DEBUG_TRACE_ALL_CHANNELS diff --git a/libADLMIDI.pro b/libADLMIDI.pro index 92c6009..0044b76 100644 --- a/libADLMIDI.pro +++ b/libADLMIDI.pro @@ -12,6 +12,7 @@ INSTALLINCLUDESTO = ADLMIDI include($$PWD/../audio_codec_common.pri) DEFINES += ADLMIDI_DISABLE_CPP_EXTRAS +DEFINES += ENABLE_END_SILENCE_SKIPPING macx: QMAKE_CXXFLAGS_WARN_ON += -Wno-absolute-value diff --git a/src/midi_sequencer_impl.hpp b/src/midi_sequencer_impl.hpp index 0fe6192..e54c7ee 100644 --- a/src/midi_sequencer_impl.hpp +++ b/src/midi_sequencer_impl.hpp @@ -614,6 +614,19 @@ bool BW_MidiSequencer::buildSmfTrackData(const std::vector } } +#ifdef ENABLE_END_SILENCE_SKIPPING + //Have track end on its own row? Clear any delay on the row before + if(event.subtype == MidiEvent::ST_ENDTRACK && evtPos.events.size() == 1) + { + if (!m_trackData[tk].empty()) + { + MidiTrackRow &previous = m_trackData[tk].back(); + previous.delay = 0; + previous.timeDelay = 0; + } + } +#endif + if((evtPos.delay > 0) || (event.subtype == MidiEvent::ST_ENDTRACK)) { evtPos.absPos = abs_position; -- cgit v1.2.3 From 57ef547b460843c0864e14ae4ce0fcf1f901a9d7 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Tue, 28 Aug 2018 13:20:16 +0300 Subject: Small warning fix --- src/adlmidi_opl3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adlmidi_opl3.cpp b/src/adlmidi_opl3.cpp index e127568..c98469f 100644 --- a/src/adlmidi_opl3.cpp +++ b/src/adlmidi_opl3.cpp @@ -481,7 +481,7 @@ void OPL3::updateChannelCategories() for(size_t b = 0; b < 23; ++b) { m_channelCategory[a * 23 + b] = - (b >= 18) ? static_cast(ChanCat_Rhythm_Bass + (b - 18)) : + (b >= 18) ? static_cast(ChanCat_Rhythm_Bass + (b - 18)) : (b >= 6 && b < 9) ? ChanCat_Rhythm_Slave : ChanCat_Regular; } } -- cgit v1.2.3 From 33fefba831f691f0448db49599f9798a04bcb06f Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Wed, 29 Aug 2018 04:18:21 +0200 Subject: fix the miswritten name of Jamie O'Connell --- banks.ini | 4 ++-- src/adldata.cpp | 4 ++-- utils/gen_adldata/scrapped.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/banks.ini b/banks.ini index 33b55c5..4a3626d 100644 --- a/banks.ini +++ b/banks.ini @@ -472,10 +472,10 @@ format = TMB file = "fm_banks/op3_files/gmopl_wohl_mod.tmb" prefix = "b65" -; Jammey O'Connel's bank used in his FM Driver for Win3x/9x and was +; Jamie O'Connell's bank used in his FM Driver for Win3x/9x and was ; pre-included with his SB-Timbre editor. Percussions are custom. [bank-66] -name = "SB (Jammey O'Connel's bank)" +name = "SB (Jamie O'Connell's bank)" format = TMB file = "fm_banks/op3_files/gmoconel.tmb" prefix = "b66" diff --git a/src/adldata.cpp b/src/adldata.cpp index 6606e1f..0e5b43f 100644 --- a/src/adldata.cpp +++ b/src/adldata.cpp @@ -9449,7 +9449,7 @@ const char* const banknames[76] = "TMB (Shadow Warrior)", "DMX (Raptor)", "OP3 (Modded GMOPL by Wohlstand)", - "SB (Jammey O'Connel's bank)", + "SB (Jamie O'Connell's bank)", "TMB (Default bank of Apgee Sound System)", "WOPL (4op bank by James Alan Nguyen and Wohlstand)", "TMB (Blood)", @@ -10882,7 +10882,7 @@ const AdlBankSetup adlbanksetup[75] = {3, 0, 0, 0, 0}, //Bank 63, TMB (Shadow Warrior) {2, 0, 0, 0, 0}, //Bank 64, DMX (Raptor) {3, 0, 0, 0, 0}, //Bank 65, OP3 (Modded GMOPL by Wohlstand) - {3, 0, 0, 0, 0}, //Bank 66, SB (Jammey O'Connel's bank) + {3, 0, 0, 0, 0}, //Bank 66, SB (Jamie O'Connell's bank) {3, 0, 0, 0, 0}, //Bank 67, TMB (Default bank of Apgee Sound System) {0, 1, 1, 0, 0}, //Bank 68, WOPL (4op bank by James Alan Nguyen and Wohlstand) {3, 0, 0, 0, 0}, //Bank 69, TMB (Blood) diff --git a/utils/gen_adldata/scrapped.txt b/utils/gen_adldata/scrapped.txt index 10c15cd..51a0497 100644 --- a/utils/gen_adldata/scrapped.txt +++ b/utils/gen_adldata/scrapped.txt @@ -75,7 +75,7 @@ static const char *const banknames[] = "TMB (Shadow Warrior)", "DMX (Raptor)", "OP3 (Modded GMOPL by Wohlstand)", - "SB (Jammey O'Connel's bank)", + "SB (Jamie O'Connell's bank)", "TMB (Default bank of Build Engine)", "OP3 (4op bank by James Alan Nguyen)", "TMB (Blood)", -- cgit v1.2.3 From 7ccbb3a40a80637a130f499bb914bbafbcd71646 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Wed, 29 Aug 2018 04:20:29 +0200 Subject: fix a typo about Apogee Sound System --- banks.ini | 2 +- src/adldata.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/banks.ini b/banks.ini index 4a3626d..a91c6aa 100644 --- a/banks.ini +++ b/banks.ini @@ -484,7 +484,7 @@ prefix = "b66" ; May be listened from the setup utiltiy while testing music, ; or in the Duke Nukem 3D Beta. [bank-67] -name = "TMB (Default bank of Apgee Sound System)" +name = "TMB (Default bank of Apogee Sound System)" format = TMB file = "fm_banks/tmb_files/default.tmb" prefix = "3drm67" diff --git a/src/adldata.cpp b/src/adldata.cpp index 0e5b43f..b7fd3a1 100644 --- a/src/adldata.cpp +++ b/src/adldata.cpp @@ -9450,7 +9450,7 @@ const char* const banknames[76] = "DMX (Raptor)", "OP3 (Modded GMOPL by Wohlstand)", "SB (Jamie O'Connell's bank)", - "TMB (Default bank of Apgee Sound System)", + "TMB (Default bank of Apogee Sound System)", "WOPL (4op bank by James Alan Nguyen and Wohlstand)", "TMB (Blood)", "TMB (Lee)", @@ -10883,7 +10883,7 @@ const AdlBankSetup adlbanksetup[75] = {2, 0, 0, 0, 0}, //Bank 64, DMX (Raptor) {3, 0, 0, 0, 0}, //Bank 65, OP3 (Modded GMOPL by Wohlstand) {3, 0, 0, 0, 0}, //Bank 66, SB (Jamie O'Connell's bank) - {3, 0, 0, 0, 0}, //Bank 67, TMB (Default bank of Apgee Sound System) + {3, 0, 0, 0, 0}, //Bank 67, TMB (Default bank of Apogee Sound System) {0, 1, 1, 0, 0}, //Bank 68, WOPL (4op bank by James Alan Nguyen and Wohlstand) {3, 0, 0, 0, 0}, //Bank 69, TMB (Blood) {3, 0, 0, 0, 0}, //Bank 70, TMB (Lee) -- cgit v1.2.3 From 0d9bc6794e57526af28ce45a57d91ec78e39b354 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Thu, 30 Aug 2018 07:49:14 +0200 Subject: API to return 4op channels to the original count --- include/adlmidi.h | 1 + src/adlmidi.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/adlmidi.h b/include/adlmidi.h index 6ae184e..e2bc035 100644 --- a/include/adlmidi.h +++ b/include/adlmidi.h @@ -329,6 +329,7 @@ extern ADLMIDI_DECLSPEC int adl_loadEmbeddedBank(struct ADL_MIDIPlayer *device, * If you want to specify custom number of four operator channels, * please call this function after bank change (adl_setBank() or adl_openBank()), * otherwise, value will be overwritten by auto-calculated. + * If the count is specified as -1, an auto-calculated amount is used instead. * * @param device Instance of the library * @param ops4 Count of four-op channels to allocate between all emulating chips diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index c7c5cf3..26a21e4 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -351,6 +351,10 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4) { if(!device) return -1; + + if(ops4 == -1) + return adlRefreshNumCards(device); + MidiPlayer *play = GET_MIDI_PLAYER(device); if((unsigned int)ops4 > 6 * play->m_setup.numChips) { @@ -364,7 +368,7 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4) play->m_synth.m_numFourOps = play->m_setup.numFourOps; play->m_synth.updateChannelCategories(); - return 0; //adlRefreshNumCards(device); + return 0; } ADLMIDI_EXPORT int adl_getNumFourOpsChn(struct ADL_MIDIPlayer *device) -- cgit v1.2.3 From 13e4cb1528f36d3514fa6d7f26eb4028194c5b07 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Thu, 30 Aug 2018 11:01:42 +0200 Subject: fix a case of miscalculation and infinite loop --- src/adlmidi_midiplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 49aa119..f405489 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1599,7 +1599,7 @@ void MIDIplay::setRPN(size_t midCh, unsigned value, bool MSB) case 0x0109 + 1*0x10000 + 1*0x20000: if((m_synthMode & Mode_XG) != 0) // Vibrato depth { - m_midiChannels[midCh].vibdepth = ((value - 64) * 0.15) * 0.01; + m_midiChannels[midCh].vibdepth = (((int)value - 64) * 0.15) * 0.01; } break; case 0x010A + 1*0x10000 + 1*0x20000: -- cgit v1.2.3