From d18ed3c53687bcbead21fe006334b7cc8b515dc2 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Fri, 1 Dec 2017 00:34:49 +0300 Subject: Added a project to build from under native OpenWatcom IDE --- projects/watcom/.gitignore | 11 ++ projects/watcom/ADLMIDI.tgt | 297 +++++++++++++++++++++++++++++++++++++++++ projects/watcom/bass.mid | Bin 0 -> 444 bytes projects/watcom/dmxopl3.wop | Bin 0 -> 15959 bytes projects/watcom/libADLMIDI.tgt | 275 ++++++++++++++++++++++++++++++++++++++ projects/watcom/libADLMIDI.wpj | 63 +++++++++ projects/watcom/nin-hlah.mid | Bin 0 -> 62164 bytes projects/watcom/onestop.mid | Bin 0 -> 40075 bytes projects/watcom/playmidi.sym | Bin 0 -> 632827 bytes projects/watcom/playmidi.tgt | 213 +++++++++++++++++++++++++++++ projects/watcom/ttd10.mid | Bin 0 -> 62952 bytes 11 files changed, 859 insertions(+) create mode 100644 projects/watcom/.gitignore create mode 100644 projects/watcom/ADLMIDI.tgt create mode 100644 projects/watcom/bass.mid create mode 100644 projects/watcom/dmxopl3.wop create mode 100644 projects/watcom/libADLMIDI.tgt create mode 100644 projects/watcom/libADLMIDI.wpj create mode 100644 projects/watcom/nin-hlah.mid create mode 100644 projects/watcom/onestop.mid create mode 100644 projects/watcom/playmidi.sym create mode 100644 projects/watcom/playmidi.tgt create mode 100644 projects/watcom/ttd10.mid diff --git a/projects/watcom/.gitignore b/projects/watcom/.gitignore new file mode 100644 index 0000000..1a3500c --- /dev/null +++ b/projects/watcom/.gitignore @@ -0,0 +1,11 @@ +*.obj +*.lib +*.exe +*.elf +*.lb1 +*.ERR +*.err +*.mk +*.mk1 +*.lk1 +*.map diff --git a/projects/watcom/ADLMIDI.tgt b/projects/watcom/ADLMIDI.tgt new file mode 100644 index 0000000..56cce64 --- /dev/null +++ b/projects/watcom/ADLMIDI.tgt @@ -0,0 +1,297 @@ +40 +targetIdent +0 +MProject +1 +MComponent +0 +2 +WString +3 +LIB +3 +WString +5 +d_2s9 +1 +0 +1 +4 +MCommand +0 +5 +MCommand +0 +6 +MItem +11 +ADLMIDI.lib +7 +WString +3 +LIB +8 +WVList +0 +9 +WVList +1 +10 +ActionStates +11 +WString +5 +&Make +12 +WVList +0 +-1 +1 +1 +0 +13 +WPickList +9 +14 +MItem +3 +*.c +15 +WString +4 +COBJ +16 +WVList +3 +17 +MVState +18 +WString +3 +WCC +19 +WString +25 +d????Include directories: +1 +20 +WString +30 +"$(%watcom)/h" "../../include" +0 +21 +MRState +22 +WString +3 +WCC +23 +WString +33 +??2??80386 register-based calling +1 +1 +24 +MRState +25 +WString +3 +WCC +26 +WString +39 +??2??Pentium Pro register-based calling +1 +0 +27 +WVList +1 +28 +ActionStates +29 +WString +5 +&Make +30 +WVList +0 +-1 +1 +1 +0 +31 +MItem +27 +..\..\src\adlmidi_mus2mid.c +32 +WString +4 +COBJ +33 +WVList +0 +34 +WVList +0 +14 +1 +1 +0 +35 +MItem +27 +..\..\src\adlmidi_xmi2mid.c +36 +WString +4 +COBJ +37 +WVList +0 +38 +WVList +0 +14 +1 +1 +0 +39 +MItem +5 +*.cpp +40 +WString +6 +CPPOBJ +41 +WVList +2 +42 +MVState +43 +WString +3 +WPP +44 +WString +25 +d????Include directories: +1 +45 +WString +30 +"$(%watcom)/h" "../../include" +0 +46 +MVState +47 +WString +3 +WPP +48 +WString +23 +?????Macro definitions: +1 +49 +WString +22 +DISABLE_EMBEDDED_BANKS +0 +50 +WVList +0 +-1 +1 +1 +0 +51 +MItem +21 +..\..\src\adlmidi.cpp +52 +WString +6 +CPPOBJ +53 +WVList +0 +54 +WVList +0 +39 +1 +1 +0 +55 +MItem +26 +..\..\src\adlmidi_load.cpp +56 +WString +6 +CPPOBJ +57 +WVList +0 +58 +WVList +0 +39 +1 +1 +0 +59 +MItem +30 +..\..\src\adlmidi_midiplay.cpp +60 +WString +6 +CPPOBJ +61 +WVList +0 +62 +WVList +0 +39 +1 +1 +0 +63 +MItem +26 +..\..\src\adlmidi_opl3.cpp +64 +WString +6 +CPPOBJ +65 +WVList +0 +66 +WVList +0 +39 +1 +1 +0 +67 +MItem +29 +..\..\src\adlmidi_private.cpp +68 +WString +6 +CPPOBJ +69 +WVList +0 +70 +WVList +0 +39 +1 +1 +0 diff --git a/projects/watcom/bass.mid b/projects/watcom/bass.mid new file mode 100644 index 0000000..422cbc9 Binary files /dev/null and b/projects/watcom/bass.mid differ diff --git a/projects/watcom/dmxopl3.wop b/projects/watcom/dmxopl3.wop new file mode 100644 index 0000000..eee2fab Binary files /dev/null and b/projects/watcom/dmxopl3.wop differ diff --git a/projects/watcom/libADLMIDI.tgt b/projects/watcom/libADLMIDI.tgt new file mode 100644 index 0000000..d384a4f --- /dev/null +++ b/projects/watcom/libADLMIDI.tgt @@ -0,0 +1,275 @@ +40 +targetIdent +0 +MProject +1 +MComponent +0 +2 +WString +3 +LIB +3 +WString +5 +d_2sn +1 +0 +1 +4 +MCommand +0 +5 +MCommand +0 +6 +MItem +14 +libADLMIDI.lib +7 +WString +3 +LIB +8 +WVList +0 +9 +WVList +1 +10 +ActionStates +11 +WString +5 +&Make +12 +WVList +0 +-1 +1 +1 +0 +13 +WPickList +10 +14 +MItem +3 +*.c +15 +WString +4 +COBJ +16 +WVList +1 +17 +MVState +18 +WString +3 +WCC +19 +WString +25 +d????Include directories: +1 +20 +WString +30 +"$(%watcom)/h" "../../include" +0 +21 +WVList +1 +22 +ActionStates +23 +WString +5 +&Make +24 +WVList +0 +-1 +1 +1 +0 +25 +MItem +27 +..\..\src\adlmidi_mus2mid.c +26 +WString +4 +COBJ +27 +WVList +0 +28 +WVList +0 +14 +1 +1 +0 +29 +MItem +27 +..\..\src\adlmidi_xmi2mid.c +30 +WString +4 +COBJ +31 +WVList +0 +32 +WVList +0 +14 +1 +1 +0 +33 +MItem +5 +*.cpp +34 +WString +6 +CPPOBJ +35 +WVList +1 +36 +MVState +37 +WString +3 +WPP +38 +WString +25 +d????Include directories: +1 +39 +WString +30 +"$(%watcom)/h" "../../include" +0 +40 +WVList +0 +-1 +1 +1 +0 +41 +MItem +21 +..\..\src\adldata.cpp +42 +WString +6 +CPPOBJ +43 +WVList +0 +44 +WVList +0 +33 +1 +1 +0 +45 +MItem +21 +..\..\src\adlmidi.cpp +46 +WString +6 +CPPOBJ +47 +WVList +0 +48 +WVList +0 +33 +1 +1 +0 +49 +MItem +26 +..\..\src\adlmidi_load.cpp +50 +WString +6 +CPPOBJ +51 +WVList +0 +52 +WVList +0 +33 +1 +1 +0 +53 +MItem +30 +..\..\src\adlmidi_midiplay.cpp +54 +WString +6 +CPPOBJ +55 +WVList +0 +56 +WVList +0 +33 +1 +1 +0 +57 +MItem +26 +..\..\src\adlmidi_opl3.cpp +58 +WString +6 +CPPOBJ +59 +WVList +0 +60 +WVList +0 +33 +1 +1 +0 +61 +MItem +29 +..\..\src\adlmidi_private.cpp +62 +WString +6 +CPPOBJ +63 +WVList +0 +64 +WVList +0 +33 +1 +1 +0 diff --git a/projects/watcom/libADLMIDI.wpj b/projects/watcom/libADLMIDI.wpj new file mode 100644 index 0000000..dbd9c49 --- /dev/null +++ b/projects/watcom/libADLMIDI.wpj @@ -0,0 +1,63 @@ +40 +projectIdent +0 +VpeMain +1 +WRect +32 +50 +10288 +9680 +2 +MProject +3 +MCommand +0 +4 +MCommand +0 +2 +5 +WFileName +11 +ADLMIDI.tgt +6 +WFileName +12 +playmidi.tgt +7 +WVList +2 +8 +VComponent +9 +WRect +168 +260 +5712 +4360 +0 +0 +10 +WFileName +11 +ADLMIDI.tgt +0 +8 +11 +VComponent +12 +WRect +1600 +1360 +5712 +4360 +0 +0 +13 +WFileName +12 +playmidi.tgt +0 +1 +8 diff --git a/projects/watcom/nin-hlah.mid b/projects/watcom/nin-hlah.mid new file mode 100644 index 0000000..ebf8b59 Binary files /dev/null and b/projects/watcom/nin-hlah.mid differ diff --git a/projects/watcom/onestop.mid b/projects/watcom/onestop.mid new file mode 100644 index 0000000..c677319 Binary files /dev/null and b/projects/watcom/onestop.mid differ diff --git a/projects/watcom/playmidi.sym b/projects/watcom/playmidi.sym new file mode 100644 index 0000000..2d0d2be Binary files /dev/null and b/projects/watcom/playmidi.sym differ diff --git a/projects/watcom/playmidi.tgt b/projects/watcom/playmidi.tgt new file mode 100644 index 0000000..23702c8 --- /dev/null +++ b/projects/watcom/playmidi.tgt @@ -0,0 +1,213 @@ +40 +targetIdent +0 +MProject +1 +MComponent +0 +2 +WString +3 +EXE +3 +WString +5 +dw2e9 +1 +0 +1 +4 +MCommand +0 +5 +MCommand +0 +6 +MItem +12 +playmidi.exe +7 +WString +3 +EXE +8 +WVList +1 +9 +MVState +10 +WString +5 +WLINK +11 +WString +18 +?????Libraries(,): +1 +12 +WString +7 +ADLMIDI +0 +13 +WVList +4 +14 +ActionStates +15 +WString +7 +Sam&ple +16 +WVList +0 +17 +ActionStates +18 +WString +13 +Remote D&ebug +19 +WVList +2 +20 +MRState +21 +WString +6 +RDEBUG +22 +WString +13 +????9Windowed +1 +0 +23 +MRState +24 +WString +6 +RDEBUG +25 +WString +19 +????9Character mode +1 +1 +26 +ActionStates +27 +WString +12 +Local &Debug +28 +WVList +0 +29 +ActionStates +30 +WString +5 +&Make +31 +WVList +0 +-1 +1 +1 +0 +32 +WPickList +2 +33 +MItem +5 +*.cpp +34 +WString +6 +CPPOBJ +35 +WVList +2 +36 +MVState +37 +WString +3 +WPP +38 +WString +25 +d????Include directories: +1 +39 +WString +30 +"$(%watcom)/h" "../../include" +0 +40 +MVState +41 +WString +3 +WPP +42 +WString +23 +?????Macro definitions: +1 +43 +WString +13 +HARDWARE_OPL3 +0 +44 +WVList +0 +-1 +1 +1 +0 +45 +MItem +36 +..\..\utils\midiplay\adlmidiplay.cpp +46 +WString +6 +CPPOBJ +47 +WVList +2 +48 +MRState +49 +WString +3 +WPP +50 +WString +33 +??2??80386 register-based calling +1 +1 +51 +MRState +52 +WString +3 +WPP +53 +WString +39 +??2??Pentium Pro register-based calling +1 +0 +54 +WVList +0 +33 +1 +1 +0 diff --git a/projects/watcom/ttd10.mid b/projects/watcom/ttd10.mid new file mode 100644 index 0000000..eeb47cc Binary files /dev/null and b/projects/watcom/ttd10.mid differ -- cgit v1.2.3 From 709797bbd9ed0ed1d433be5acca5ca1ad98e7d5a Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Sat, 2 Dec 2017 00:32:37 +0300 Subject: Fixed OpenWatcom IDE project --- projects/watcom/.gitignore | 1 + projects/watcom/ADLMIDI.tgt | 98 +++++++++++++---------- projects/watcom/libADLMIDI.wpj | 14 ++-- projects/watcom/playmidi.sym | Bin 632827 -> 0 bytes projects/watcom/playmidi.tgt | 171 +++++++++++++++++++++++++++++++---------- utils/midiplay/wave_writer.c | 2 +- 6 files changed, 200 insertions(+), 86 deletions(-) delete mode 100644 projects/watcom/playmidi.sym diff --git a/projects/watcom/.gitignore b/projects/watcom/.gitignore index 1a3500c..a8d82c5 100644 --- a/projects/watcom/.gitignore +++ b/projects/watcom/.gitignore @@ -9,3 +9,4 @@ *.mk1 *.lk1 *.map +*.sym diff --git a/projects/watcom/ADLMIDI.tgt b/projects/watcom/ADLMIDI.tgt index 56cce64..bec6792 100644 --- a/projects/watcom/ADLMIDI.tgt +++ b/projects/watcom/ADLMIDI.tgt @@ -12,7 +12,7 @@ LIB 3 WString 5 -d_2s9 +n_2sn 1 0 1 @@ -51,7 +51,7 @@ WVList 0 13 WPickList -9 +11 14 MItem 3 @@ -72,12 +72,12 @@ WCC 19 WString 25 -d????Include directories: +n????Include directories: 1 20 WString -30 -"$(%watcom)/h" "../../include" +46 +"$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 21 MRState @@ -157,31 +157,33 @@ WVList 0 39 MItem -5 -*.cpp +21 +..\..\src\nukedopl3.c 40 WString -6 -CPPOBJ +4 +COBJ 41 WVList -2 +0 42 -MVState +WVList +0 +14 +1 +1 +0 43 -WString -3 -WPP +MItem +5 +*.cpp 44 WString -25 -d????Include directories: -1 +6 +CPPOBJ 45 -WString -30 -"$(%watcom)/h" "../../include" -0 +WVList +1 46 MVState 47 @@ -190,13 +192,13 @@ WString WPP 48 WString -23 -?????Macro definitions: +25 +n????Include directories: 1 49 WString -22 -DISABLE_EMBEDDED_BANKS +47 +"$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 50 WVList @@ -208,7 +210,7 @@ WVList 51 MItem 21 -..\..\src\adlmidi.cpp +..\..\src\adldata.cpp 52 WString 6 @@ -219,14 +221,14 @@ WVList 54 WVList 0 -39 +43 1 1 0 55 MItem -26 -..\..\src\adlmidi_load.cpp +21 +..\..\src\adlmidi.cpp 56 WString 6 @@ -237,14 +239,14 @@ WVList 58 WVList 0 -39 +43 1 1 0 59 MItem -30 -..\..\src\adlmidi_midiplay.cpp +26 +..\..\src\adlmidi_load.cpp 60 WString 6 @@ -255,14 +257,14 @@ WVList 62 WVList 0 -39 +43 1 1 0 63 MItem -26 -..\..\src\adlmidi_opl3.cpp +30 +..\..\src\adlmidi_midiplay.cpp 64 WString 6 @@ -273,14 +275,14 @@ WVList 66 WVList 0 -39 +43 1 1 0 67 MItem -29 -..\..\src\adlmidi_private.cpp +26 +..\..\src\adlmidi_opl3.cpp 68 WString 6 @@ -291,7 +293,25 @@ WVList 70 WVList 0 -39 +43 +1 +1 +0 +71 +MItem +29 +..\..\src\adlmidi_private.cpp +72 +WString +6 +CPPOBJ +73 +WVList +0 +74 +WVList +0 +43 1 1 0 diff --git a/projects/watcom/libADLMIDI.wpj b/projects/watcom/libADLMIDI.wpj index dbd9c49..fbab996 100644 --- a/projects/watcom/libADLMIDI.wpj +++ b/projects/watcom/libADLMIDI.wpj @@ -4,8 +4,8 @@ projectIdent VpeMain 1 WRect -32 -50 +-24 +270 10288 9680 2 @@ -43,13 +43,13 @@ WFileName 11 ADLMIDI.tgt 0 -8 +10 11 VComponent 12 WRect -1600 -1360 +1704 +1300 5712 4360 0 @@ -59,5 +59,5 @@ WFileName 12 playmidi.tgt 0 -1 -8 +3 +11 diff --git a/projects/watcom/playmidi.sym b/projects/watcom/playmidi.sym deleted file mode 100644 index 2d0d2be..0000000 Binary files a/projects/watcom/playmidi.sym and /dev/null differ diff --git a/projects/watcom/playmidi.tgt b/projects/watcom/playmidi.tgt index 23702c8..d09f132 100644 --- a/projects/watcom/playmidi.tgt +++ b/projects/watcom/playmidi.tgt @@ -7,12 +7,12 @@ MComponent 0 2 WString -3 -EXE +4 +NEXE 3 WString 5 -dw2e9 +nc2en 1 0 1 @@ -28,8 +28,8 @@ MItem playmidi.exe 7 WString -3 -EXE +4 +NEXE 8 WVList 1 @@ -51,7 +51,7 @@ ADLMIDI 0 13 WVList -4 +5 14 ActionStates 15 @@ -102,112 +102,205 @@ WString Local &Debug 28 WVList -0 +1 29 -ActionStates +MVState 30 WString +6 +WDEBUG +31 +WString +28 +?????Application parameters: +1 +32 +WString +9 +ttd10.mid +0 +33 +ActionStates +34 +WString 5 &Make -31 +35 WVList 0 +36 +ActionStates +37 +WString +4 +&Run +38 +WVList +1 +39 +MVState +40 +WString +3 +RUN +41 +WString +28 +?????Application parameters: +1 +42 +WString +9 +ttd10.mid +0 -1 1 1 0 -32 +43 WPickList -2 -33 +4 +44 +MItem +3 +*.c +45 +WString +4 +COBJ +46 +WVList +1 +47 +MVState +48 +WString +3 +WCC +49 +WString +25 +n????Include directories: +1 +50 +WString +47 +"$(%watcom)/h;$(%watcom)/h/nt" "../../include" +0 +51 +WVList +0 +-1 +1 +1 +0 +52 +MItem +34 +..\..\utils\midiplay\wave_writer.c +53 +WString +4 +COBJ +54 +WVList +0 +55 +WVList +0 +44 +1 +1 +0 +56 MItem 5 *.cpp -34 +57 WString 6 CPPOBJ -35 +58 WVList 2 -36 +59 MVState -37 +60 WString 3 WPP -38 +61 WString 25 -d????Include directories: +n????Include directories: 1 -39 +62 WString -30 -"$(%watcom)/h" "../../include" +47 +"$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 -40 +63 MVState -41 +64 WString 3 WPP -42 +65 WString 23 ?????Macro definitions: 1 -43 +66 WString -13 -HARDWARE_OPL3 +16 +OUTPUT_WAVE_ONLY 0 -44 +67 WVList 0 -1 1 1 0 -45 +68 MItem 36 ..\..\utils\midiplay\adlmidiplay.cpp -46 +69 WString 6 CPPOBJ -47 +70 WVList 2 -48 +71 MRState -49 +72 WString 3 WPP -50 +73 WString 33 ??2??80386 register-based calling 1 1 -51 +74 MRState -52 +75 WString 3 WPP -53 +76 WString 39 ??2??Pentium Pro register-based calling 1 0 -54 +77 WVList 0 -33 +56 1 1 0 diff --git a/utils/midiplay/wave_writer.c b/utils/midiplay/wave_writer.c index 0bfaf68..e8ee10c 100755 --- a/utils/midiplay/wave_writer.c +++ b/utils/midiplay/wave_writer.c @@ -53,7 +53,7 @@ int wave_open( long sample_rate, const char* filename ) return -1; } -#ifndef _WIN32 +#if !defined(_WIN32) || defined(__WATCOMC__) file = fopen( filename, "wb" ); #else wchar_t widePath[MAX_PATH]; -- cgit v1.2.3 From 731c65d92a769920dccdca89e991746dbba07a9d Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Sat, 2 Dec 2017 00:40:24 +0300 Subject: Added debug print to illustrate invalid data inside of std::set --- src/adlmidi_midiplay.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 2c10331..c55e9cd 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -158,6 +158,38 @@ void MIDIplay::MidiTrackRow::reset() events.clear(); } +void TEMP_DEBUG_printSet(std::set &container, const char *messsage = "") +{ + if(container.empty()) + return; + std::printf("===============%s===============\n", messsage); + std::printf("Count: %u\n", container.size()); + for(std::set::iterator j = container.begin(); j != container.end(); j++) + { + size_t field = *j; + std::printf("SET ITEM: [%d]\n", (unsigned int)(field)); + std::fflush(stdout); + } + std::printf("---------------%s-END-----------\n", messsage); + std::fflush(stdout); +} + +void TEMP_DEBUG_printVector(std::vector &container, const char *messsage = "") +{ + if(container.empty()) + return; + std::printf("===============%s===============\n", messsage); + std::printf("Count: %u\n", container.size()); + for(std::vector::iterator j = container.begin(); j != container.end(); j++) + { + MIDIplay::MidiEvent &e = *j; + std::printf("VECTOR ITEM: Ch %d, Valid %d, Type %d\n", j->channel, (int)j->isValid, j->type); + std::fflush(stdout); + } + std::printf("---------------%s-END-----------\n", messsage); + std::fflush(stdout); +} + void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) { typedef std::vector EvtArr; @@ -188,6 +220,8 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) anyOther.push_back(events[i]); } + TEMP_DEBUG_printVector(noteOffs, "Filled"); + /* * If Note-Off and it's Note-On is on the same row - move this damned note off down! */ @@ -202,7 +236,7 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) const size_t note_i = (e.channel * 255) + (e.data[0] & 0x7F); //Check, was previously note is on or off bool wasOn = noteStates[note_i]; - markAsOn.insert(note_i); + markAsOn.insert(note_i); TEMP_DEBUG_printSet(markAsOn, "Inserted"); // Detect zero-length notes are following previously pressed note int noteOffsOnSameNote = 0; for(EvtArr::iterator j = noteOffs.begin(); j != noteOffs.end();) @@ -218,7 +252,7 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) { anyOther.push_back(*j); j = noteOffs.erase(j); - markAsOn.erase(note_i); + markAsOn.erase(note_i); TEMP_DEBUG_printSet(markAsOn, "Erased"); continue; } else { //When same row has many note-offs on same row @@ -228,9 +262,16 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) } } j++; + TEMP_DEBUG_printVector(noteOffs, "Iterated"); } + TEMP_DEBUG_printVector(noteOffs, "Quit from noteOffs loop"); + TEMP_DEBUG_printSet(markAsOn, "Quit from noteOffs loop"); } + TEMP_DEBUG_printVector(noteOffs, "Quit from if NOTEON"); + TEMP_DEBUG_printSet(markAsOn, "Quit from if NOTEON"); } + TEMP_DEBUG_printVector(noteOffs, "Quit from anyOther loop"); + TEMP_DEBUG_printSet(markAsOn, "Quit from anyOther loop"); //Mark other notes as released for(EvtArr::iterator j = noteOffs.begin(); j != noteOffs.end(); j++) @@ -238,10 +279,14 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) size_t note_i = (j->channel * 255) + (j->data[0] & 0x7F); noteStates[note_i] = false; } + TEMP_DEBUG_printVector(noteOffs, "Post-process noteOffs"); + TEMP_DEBUG_printSet(markAsOn, "Post-process noteOffs"); for(std::set::iterator j = markAsOn.begin(); j != markAsOn.end(); j++) noteStates[*j] = true; + TEMP_DEBUG_printVector(noteOffs, "Post-process markAsOn"); + TEMP_DEBUG_printSet(markAsOn, "Post-process markAsOn"); } /***********************************************************************************/ -- cgit v1.2.3 From ab57d660908f36e6604fa537807090fd2c7798cb Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Sat, 2 Dec 2017 00:56:40 +0300 Subject: More debug info for OpenWattcom --- src/adlmidi_midiplay.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index c55e9cd..27d09d4 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -160,10 +160,11 @@ void MIDIplay::MidiTrackRow::reset() void TEMP_DEBUG_printSet(std::set &container, const char *messsage = "") { + std::printf("===============%s===============\n", messsage); + std::printf("Set Count: %u\n", container.size()); + std::fflush(stdout); if(container.empty()) return; - std::printf("===============%s===============\n", messsage); - std::printf("Count: %u\n", container.size()); for(std::set::iterator j = container.begin(); j != container.end(); j++) { size_t field = *j; @@ -176,10 +177,11 @@ void TEMP_DEBUG_printSet(std::set &container, const char *messsage = "") void TEMP_DEBUG_printVector(std::vector &container, const char *messsage = "") { + std::printf("===============%s===============\n", messsage); + std::printf("Vector Count: %u\n", container.size()); + std::fflush(stdout); if(container.empty()) return; - std::printf("===============%s===============\n", messsage); - std::printf("Count: %u\n", container.size()); for(std::vector::iterator j = container.begin(); j != container.end(); j++) { MIDIplay::MidiEvent &e = *j; @@ -228,6 +230,7 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) if(noteStates) { std::set markAsOn; + TEMP_DEBUG_printSet(markAsOn, "Initialized"); for(size_t i = 0; i < anyOther.size(); i++) { const MidiEvent e = anyOther[i]; -- cgit v1.2.3 From 30952a0a88f31000fa3b2329c6d16f215a30f282 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Fri, 8 Dec 2017 03:11:11 +0300 Subject: Update OpenWatcom project --- projects/watcom/ADLMIDI.tgt | 178 ++++++++++++++++++++++++----------------- projects/watcom/libADLMIDI.wpj | 8 +- projects/watcom/playmidi.tgt | 158 ++++++++++++++++++++---------------- 3 files changed, 194 insertions(+), 150 deletions(-) diff --git a/projects/watcom/ADLMIDI.tgt b/projects/watcom/ADLMIDI.tgt index bec6792..4c3e335 100644 --- a/projects/watcom/ADLMIDI.tgt +++ b/projects/watcom/ADLMIDI.tgt @@ -32,286 +32,314 @@ WString LIB 8 WVList -0 +2 9 +MCState +10 +WString +4 +WLIB +11 +WString +25 +???s?Strip LINNUM records +1 +1 +12 +MVState +13 +WString +4 +WLIB +14 +WString +16 +???s?Page bound: +1 +15 +WString +4 +1024 +0 +16 WVList 1 -10 +17 ActionStates -11 +18 WString 5 &Make -12 +19 WVList 0 -1 1 1 0 -13 +20 WPickList 11 -14 +21 MItem 3 *.c -15 +22 WString 4 COBJ -16 +23 WVList 3 -17 +24 MVState -18 +25 WString 3 WCC -19 +26 WString 25 n????Include directories: 1 -20 +27 WString 46 "$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 -21 +28 MRState -22 +29 WString 3 WCC -23 +30 WString 33 ??2??80386 register-based calling 1 1 -24 +31 MRState -25 +32 WString 3 WCC -26 +33 WString 39 ??2??Pentium Pro register-based calling 1 0 -27 +34 WVList 1 -28 +35 ActionStates -29 +36 WString 5 &Make -30 +37 WVList 0 -1 1 1 0 -31 +38 MItem 27 ..\..\src\adlmidi_mus2mid.c -32 +39 WString 4 COBJ -33 +40 WVList 0 -34 +41 WVList 0 -14 +21 1 1 0 -35 +42 MItem 27 ..\..\src\adlmidi_xmi2mid.c -36 +43 WString 4 COBJ -37 +44 WVList 0 -38 +45 WVList 0 -14 +21 1 1 0 -39 +46 MItem 21 ..\..\src\nukedopl3.c -40 +47 WString 4 COBJ -41 +48 WVList 0 -42 +49 WVList 0 -14 +21 1 1 0 -43 +50 MItem 5 *.cpp -44 +51 WString 6 CPPOBJ -45 +52 WVList 1 -46 +53 MVState -47 +54 WString 3 WPP -48 +55 WString 25 n????Include directories: 1 -49 +56 WString 47 "$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 -50 +57 WVList 0 -1 1 1 0 -51 +58 MItem 21 ..\..\src\adldata.cpp -52 +59 WString 6 CPPOBJ -53 +60 WVList 0 -54 +61 WVList 0 -43 +50 1 1 0 -55 +62 MItem 21 ..\..\src\adlmidi.cpp -56 +63 WString 6 CPPOBJ -57 +64 WVList 0 -58 +65 WVList 0 -43 +50 1 1 0 -59 +66 MItem 26 ..\..\src\adlmidi_load.cpp -60 +67 WString 6 CPPOBJ -61 +68 WVList 0 -62 +69 WVList 0 -43 +50 1 1 0 -63 +70 MItem 30 ..\..\src\adlmidi_midiplay.cpp -64 +71 WString 6 CPPOBJ -65 +72 WVList 0 -66 +73 WVList 0 -43 +50 1 1 0 -67 +74 MItem 26 ..\..\src\adlmidi_opl3.cpp -68 +75 WString 6 CPPOBJ -69 +76 WVList 0 -70 +77 WVList 0 -43 +50 1 1 0 -71 +78 MItem 29 ..\..\src\adlmidi_private.cpp -72 +79 WString 6 CPPOBJ -73 +80 WVList 0 -74 +81 WVList 0 -43 +50 1 1 0 diff --git a/projects/watcom/libADLMIDI.wpj b/projects/watcom/libADLMIDI.wpj index fbab996..b7bfc41 100644 --- a/projects/watcom/libADLMIDI.wpj +++ b/projects/watcom/libADLMIDI.wpj @@ -32,8 +32,8 @@ WVList VComponent 9 WRect -168 -260 +160 +270 5712 4360 0 @@ -48,8 +48,8 @@ ADLMIDI.tgt VComponent 12 WRect -1704 -1300 +1712 +810 5712 4360 0 diff --git a/projects/watcom/playmidi.tgt b/projects/watcom/playmidi.tgt index d09f132..d1c5b42 100644 --- a/projects/watcom/playmidi.tgt +++ b/projects/watcom/playmidi.tgt @@ -32,123 +32,139 @@ WString NEXE 8 WVList -1 +2 9 MVState 10 WString -5 -WLINK +7 +WINLINK 11 WString +22 +?????Other options(,): +1 +12 +WString +12 +commit st=1m +0 +13 +MVState +14 +WString +7 +WINLINK +15 +WString 18 ?????Libraries(,): 1 -12 +16 WString 7 ADLMIDI 0 -13 +17 WVList 5 -14 +18 ActionStates -15 +19 WString 7 Sam&ple -16 +20 WVList 0 -17 +21 ActionStates -18 +22 WString 13 Remote D&ebug -19 +23 WVList 2 -20 +24 MRState -21 +25 WString 6 RDEBUG -22 +26 WString 13 ????9Windowed 1 0 -23 +27 MRState -24 +28 WString 6 RDEBUG -25 +29 WString 19 ????9Character mode 1 1 -26 +30 ActionStates -27 +31 WString 12 Local &Debug -28 +32 WVList 1 -29 +33 MVState -30 +34 WString 6 WDEBUG -31 +35 WString 28 ?????Application parameters: 1 -32 +36 WString 9 ttd10.mid 0 -33 +37 ActionStates -34 +38 WString 5 &Make -35 +39 WVList 0 -36 +40 ActionStates -37 +41 WString 4 &Run -38 +42 WVList 1 -39 +43 MVState -40 +44 WString 3 RUN -41 +45 WString 28 ?????Application parameters: 1 -42 +46 WString 9 ttd10.mid @@ -157,150 +173,150 @@ ttd10.mid 1 1 0 -43 +47 WPickList 4 -44 +48 MItem 3 *.c -45 +49 WString 4 COBJ -46 +50 WVList 1 -47 +51 MVState -48 +52 WString 3 WCC -49 +53 WString 25 n????Include directories: 1 -50 +54 WString 47 "$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 -51 +55 WVList 0 -1 1 1 0 -52 +56 MItem 34 ..\..\utils\midiplay\wave_writer.c -53 +57 WString 4 COBJ -54 +58 WVList 0 -55 +59 WVList 0 -44 +48 1 1 0 -56 +60 MItem 5 *.cpp -57 +61 WString 6 CPPOBJ -58 +62 WVList 2 -59 +63 MVState -60 +64 WString 3 WPP -61 +65 WString 25 n????Include directories: 1 -62 +66 WString 47 "$(%watcom)/h;$(%watcom)/h/nt" "../../include" 0 -63 +67 MVState -64 +68 WString 3 WPP -65 +69 WString 23 ?????Macro definitions: 1 -66 +70 WString 16 OUTPUT_WAVE_ONLY 0 -67 +71 WVList 0 -1 1 1 0 -68 +72 MItem 36 ..\..\utils\midiplay\adlmidiplay.cpp -69 +73 WString 6 CPPOBJ -70 +74 WVList 2 -71 +75 MRState -72 +76 WString 3 WPP -73 +77 WString 33 ??2??80386 register-based calling 1 1 -74 +78 MRState -75 +79 WString 3 WPP -76 +80 WString 39 ??2??Pentium Pro register-based calling 1 0 -77 +81 WVList 0 -56 +60 1 1 0 -- cgit v1.2.3 From 03ae1603df780d1f66862b7ea96c66a277452eb8 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Fri, 8 Dec 2017 03:11:56 +0300 Subject: Return back the "const" attribute to CalculateAdlChannelGoodness --- src/adlmidi_midiplay.cpp | 2 +- src/adlmidi_private.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 27d09d4..76641a6 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -2105,7 +2105,7 @@ void MIDIplay::HandleEvent(size_t tk, const MIDIplay::MidiEvent &evt, int &statu } } -long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) +long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) const { long s = -ch[c].koff_time_until_neglible; diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 6ab9437..f906ad2 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -936,7 +936,7 @@ private: // Determine how good a candidate this adlchannel // would be for playing a note from this instrument. - long CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t /*MidCh*/); + long CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t /*MidCh*/) const; // A new note will be played on this channel using this instrument. // Kill existing notes on this channel (or don't, if we do arpeggio) -- cgit v1.2.3 From 9e2029b353bdcc9de15aca07050072ecf75f845a Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sat, 9 Dec 2017 23:40:17 +0300 Subject: Hardware OPL3 build fix --- utils/midiplay/adlmidiplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/midiplay/adlmidiplay.cpp b/utils/midiplay/adlmidiplay.cpp index 2548636..69b3698 100644 --- a/utils/midiplay/adlmidiplay.cpp +++ b/utils/midiplay/adlmidiplay.cpp @@ -238,8 +238,8 @@ int main(int argc, char **argv) return 0; } - #ifndef HARDWARE_OPL3 long sampleRate = 44100; + #ifndef HARDWARE_OPL3 //const unsigned MaxSamplesAtTime = 512; // 512=dbopl limitation // How long is SDL buffer, in seconds? // The smaller the value, the more often SDL_AudioCallBack() -- cgit v1.2.3 From 48708549ff5f8bc7388c0cb9121583932e932439 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sat, 9 Dec 2017 23:49:02 +0300 Subject: Remove temporary debug prints to merge some of changes into Master branch --- src/adlmidi_midiplay.cpp | 53 ++---------------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 76641a6..c88a796 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -158,40 +158,6 @@ void MIDIplay::MidiTrackRow::reset() events.clear(); } -void TEMP_DEBUG_printSet(std::set &container, const char *messsage = "") -{ - std::printf("===============%s===============\n", messsage); - std::printf("Set Count: %u\n", container.size()); - std::fflush(stdout); - if(container.empty()) - return; - for(std::set::iterator j = container.begin(); j != container.end(); j++) - { - size_t field = *j; - std::printf("SET ITEM: [%d]\n", (unsigned int)(field)); - std::fflush(stdout); - } - std::printf("---------------%s-END-----------\n", messsage); - std::fflush(stdout); -} - -void TEMP_DEBUG_printVector(std::vector &container, const char *messsage = "") -{ - std::printf("===============%s===============\n", messsage); - std::printf("Vector Count: %u\n", container.size()); - std::fflush(stdout); - if(container.empty()) - return; - for(std::vector::iterator j = container.begin(); j != container.end(); j++) - { - MIDIplay::MidiEvent &e = *j; - std::printf("VECTOR ITEM: Ch %d, Valid %d, Type %d\n", j->channel, (int)j->isValid, j->type); - std::fflush(stdout); - } - std::printf("---------------%s-END-----------\n", messsage); - std::fflush(stdout); -} - void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) { typedef std::vector EvtArr; @@ -222,15 +188,12 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) anyOther.push_back(events[i]); } - TEMP_DEBUG_printVector(noteOffs, "Filled"); - /* * If Note-Off and it's Note-On is on the same row - move this damned note off down! */ if(noteStates) { std::set markAsOn; - TEMP_DEBUG_printSet(markAsOn, "Initialized"); for(size_t i = 0; i < anyOther.size(); i++) { const MidiEvent e = anyOther[i]; @@ -239,7 +202,7 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) const size_t note_i = (e.channel * 255) + (e.data[0] & 0x7F); //Check, was previously note is on or off bool wasOn = noteStates[note_i]; - markAsOn.insert(note_i); TEMP_DEBUG_printSet(markAsOn, "Inserted"); + markAsOn.insert(note_i); // Detect zero-length notes are following previously pressed note int noteOffsOnSameNote = 0; for(EvtArr::iterator j = noteOffs.begin(); j != noteOffs.end();) @@ -255,7 +218,7 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) { anyOther.push_back(*j); j = noteOffs.erase(j); - markAsOn.erase(note_i); TEMP_DEBUG_printSet(markAsOn, "Erased"); + markAsOn.erase(note_i); continue; } else { //When same row has many note-offs on same row @@ -265,16 +228,9 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) } } j++; - TEMP_DEBUG_printVector(noteOffs, "Iterated"); } - TEMP_DEBUG_printVector(noteOffs, "Quit from noteOffs loop"); - TEMP_DEBUG_printSet(markAsOn, "Quit from noteOffs loop"); } - TEMP_DEBUG_printVector(noteOffs, "Quit from if NOTEON"); - TEMP_DEBUG_printSet(markAsOn, "Quit from if NOTEON"); } - TEMP_DEBUG_printVector(noteOffs, "Quit from anyOther loop"); - TEMP_DEBUG_printSet(markAsOn, "Quit from anyOther loop"); //Mark other notes as released for(EvtArr::iterator j = noteOffs.begin(); j != noteOffs.end(); j++) @@ -282,14 +238,9 @@ void MIDIplay::MidiTrackRow::sortEvents(bool *noteStates) size_t note_i = (j->channel * 255) + (j->data[0] & 0x7F); noteStates[note_i] = false; } - TEMP_DEBUG_printVector(noteOffs, "Post-process noteOffs"); - TEMP_DEBUG_printSet(markAsOn, "Post-process noteOffs"); for(std::set::iterator j = markAsOn.begin(); j != markAsOn.end(); j++) noteStates[*j] = true; - - TEMP_DEBUG_printVector(noteOffs, "Post-process markAsOn"); - TEMP_DEBUG_printSet(markAsOn, "Post-process markAsOn"); } /***********************************************************************************/ -- cgit v1.2.3 From 4ab6c7b2d81960b124974ddca5733a07c8dd5fc8 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sun, 10 Dec 2017 00:11:44 +0300 Subject: Small refactoring to make the buffer copying be more understandable (add-on for issue #37) --- src/adlmidi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 2e75bbe..108ff1a 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -574,8 +574,8 @@ ADLMIDI_EXPORT int adl_play(ADL_MIDIPlayer *device, int sampleCount, short *out) if((ate < setup.backup_samples_size) && (ate != 0)) { - for(ssize_t i = 0, j = ate; j < setup.backup_samples_size; i++, j++) - setup.backup_samples[i] = setup.backup_samples[j]; + for(size_t src = ate, dst = 0; src < setup.backup_samples_size; src++, dst++) + setup.backup_samples[dst] = setup.backup_samples[src]; } setup.backup_samples_size -= ate; -- cgit v1.2.3