From bed6bcb220346c622a307bf405b9a1e87fd99db5 Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sat, 19 May 2018 19:55:47 +0300 Subject: OpenWatcom compilation fix --- projects/watcom/ADLMIDI.tgt | 246 +++++++++++++++++++++++++++++++++-------- projects/watcom/libADLMIDI.wpj | 20 ++-- src/adlmidi.cpp | 12 +- src/adlmidi_bankmap.h | 3 +- src/adlmidi_midiplay.cpp | 10 ++ src/adlmidi_private.hpp | 6 +- utils/midiplay/adlmidiplay.cpp | 2 + 7 files changed, 235 insertions(+), 64 deletions(-) diff --git a/projects/watcom/ADLMIDI.tgt b/projects/watcom/ADLMIDI.tgt index 4c3e335..d731507 100644 --- a/projects/watcom/ADLMIDI.tgt +++ b/projects/watcom/ADLMIDI.tgt @@ -12,7 +12,7 @@ LIB 3 WString 5 -n_2sn +d_2sn 1 0 1 @@ -79,7 +79,7 @@ WVList 0 20 WPickList -11 +18 21 MItem 3 @@ -100,12 +100,12 @@ WCC 26 WString 25 -n????Include directories: +d????Include directories: 1 27 WString -46 -"$(%watcom)/h;$(%watcom)/h/nt" "../../include" +30 +"$(%watcom)/h" "../../include" 0 28 MRState @@ -185,8 +185,8 @@ WVList 0 46 MItem -21 -..\..\src\nukedopl3.c +33 +..\..\src\chips\nuked\nukedopl3.c 47 WString 4 @@ -203,143 +203,293 @@ WVList 0 50 MItem +37 +..\..\src\chips\nuked\nukedopl3_174.c +51 +WString +4 +COBJ +52 +WVList +0 +53 +WVList +0 +21 +1 +1 +0 +54 +MItem +26 +..\..\src\wopl\wopl_file.c +55 +WString +4 +COBJ +56 +WVList +0 +57 +WVList +0 +21 +1 +1 +0 +58 +MItem 5 *.cpp -51 +59 WString 6 CPPOBJ -52 +60 WVList -1 -53 +3 +61 MVState -54 +62 WString 3 WPP -55 +63 WString 25 -n????Include directories: +d????Include directories: 1 -56 +64 WString -47 -"$(%watcom)/h;$(%watcom)/h/nt" "../../include" +30 +"$(%watcom)/h" "../../include" 0 -57 +65 +MRState +66 +WString +3 +WPP +67 +WString +21 +?????Default rounding +1 +0 +68 +MRState +69 +WString +3 +WPP +70 +WString +18 +?????Omit rounding +1 +1 +71 WVList 0 -1 1 1 0 -58 +72 MItem 21 ..\..\src\adldata.cpp -59 +73 WString 6 CPPOBJ -60 +74 WVList 0 -61 +75 WVList 0 -50 +58 1 1 0 -62 +76 MItem 21 ..\..\src\adlmidi.cpp -63 +77 WString 6 CPPOBJ -64 +78 WVList 0 -65 +79 WVList 0 -50 +58 1 1 0 -66 +80 MItem 26 ..\..\src\adlmidi_load.cpp -67 +81 WString 6 CPPOBJ -68 +82 WVList 0 -69 +83 WVList 0 -50 +58 1 1 0 -70 +84 MItem 30 ..\..\src\adlmidi_midiplay.cpp -71 +85 WString 6 CPPOBJ -72 +86 WVList 0 -73 +87 WVList 0 -50 +58 1 1 0 -74 +88 MItem 26 ..\..\src\adlmidi_opl3.cpp -75 +89 WString 6 CPPOBJ -76 +90 WVList 0 -77 +91 WVList 0 -50 +58 1 1 0 -78 +92 MItem 29 ..\..\src\adlmidi_private.cpp -79 +93 WString 6 CPPOBJ -80 +94 WVList 0 -81 +95 WVList 0 -50 +58 +1 +1 +0 +96 +MItem +32 +..\..\src\chips\dosbox\dbopl.cpp +97 +WString +6 +CPPOBJ +98 +WVList +0 +99 +WVList +0 +58 +1 +1 +0 +100 +MItem +31 +..\..\src\chips\dosbox_opl3.cpp +101 +WString +6 +CPPOBJ +102 +WVList +0 +103 +WVList +0 +58 +1 +1 +0 +104 +MItem +30 +..\..\src\chips\nuked_opl3.cpp +105 +WString +6 +CPPOBJ +106 +WVList +0 +107 +WVList +0 +58 +1 +1 +0 +108 +MItem +35 +..\..\src\chips\nuked_opl3_v174.cpp +109 +WString +6 +CPPOBJ +110 +WVList +0 +111 +WVList +0 +58 +1 +1 +0 +112 +MItem +33 +..\..\src\chips\opl_chip_base.cpp +113 +WString +6 +CPPOBJ +114 +WVList +0 +115 +WVList +0 +58 1 1 0 diff --git a/projects/watcom/libADLMIDI.wpj b/projects/watcom/libADLMIDI.wpj index b7bfc41..e0d9442 100644 --- a/projects/watcom/libADLMIDI.wpj +++ b/projects/watcom/libADLMIDI.wpj @@ -4,10 +4,10 @@ projectIdent VpeMain 1 WRect --24 -270 -10288 -9680 +-32 +260 +10304 +9710 2 MProject 3 @@ -32,8 +32,8 @@ WVList VComponent 9 WRect -160 -270 +328 +240 5712 4360 0 @@ -43,13 +43,13 @@ WFileName 11 ADLMIDI.tgt 0 -10 +17 11 VComponent 12 WRect -1712 -810 +3752 +3250 5712 4360 0 @@ -60,4 +60,4 @@ WFileName playmidi.tgt 0 3 -11 +8 diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 8648308..8fe70fd 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -659,6 +659,8 @@ static int SendStereoAudio(int samples_requested, right += (outputOffset / 2) * sampleOffset; typedef int32_t(&pfnConvert)(int32_t); + typedef float(&ffnConvert)(int32_t); + typedef double(&dfnConvert)(int32_t); switch(sampleType) { case ADLMIDI_SampleType_S8: @@ -723,15 +725,21 @@ static int SendStereoAudio(int samples_requested, break; } case ADLMIDI_SampleType_F32: + { if(containerSize != sizeof(float)) return -1; - CopySamplesTransformed(left, right, _in, toCopy / 2, sampleOffset, adl_cvtReal); + ffnConvert cvt = adl_cvtReal; + CopySamplesTransformed(left, right, _in, toCopy / 2, sampleOffset, cvt); break; + } case ADLMIDI_SampleType_F64: + { if(containerSize != sizeof(double)) return -1; - CopySamplesTransformed(left, right, _in, toCopy / 2, sampleOffset, adl_cvtReal); + dfnConvert cvt = adl_cvtReal; + CopySamplesTransformed(left, right, _in, toCopy / 2, sampleOffset, cvt); break; + } default: return -1; } diff --git a/src/adlmidi_bankmap.h b/src/adlmidi_bankmap.h index c249b55..84af6e9 100644 --- a/src/adlmidi_bankmap.h +++ b/src/adlmidi_bankmap.h @@ -85,7 +85,8 @@ public: bool operator==(const iterator &o) const; bool operator!=(const iterator &o) const; private: - Slot **buckets, *slot; + Slot **buckets; + Slot *slot; size_t index; iterator(Slot **buckets, Slot *slot, size_t index); #ifdef _MSC_VER diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 5f3ce57..1ee7cfb 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1093,11 +1093,21 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) //uint16_t i[2] = { ains.adlno1, ains.adlno2 }; bool pseudo_4op = ains.flags & adlinsdata::Flag_Pseudo4op; +#ifndef __WATCOMC__ MIDIchannel::NoteInfo::Phys voices[MIDIchannel::NoteInfo::MaxNumPhysChans] = { {0, ains.adl[0], false}, {0, ains.adl[1], pseudo_4op} }; +#else /* Unfortunately, WatCom can't brace-initialize structure that incluses structure fields */ + MIDIchannel::NoteInfo::Phys voices[MIDIchannel::NoteInfo::MaxNumPhysChans]; + voices[0].chip_chan = 0; + voices[0].ains = ains.adl[0]; + voices[0].pseudo4op = false; + voices[1].chip_chan = 0; + voices[1].ains = ains.adl[1]; + voices[1].pseudo4op = pseudo_4op; +#endif if((opl.AdlPercussionMode == 1) && PercussionMap[midiins & 0xFF]) voices[1] = voices[0];//i[1] = i[0]; diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 89d3236..07f15f2 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -569,7 +569,7 @@ public: ph = &chip_channels[i]; return ph; } - Phys *phys_find_or_create(unsigned chip_chan) + Phys *phys_find_or_create(uint16_t chip_chan) { Phys *ph = phys_find(chip_chan); if(!ph) { @@ -580,7 +580,7 @@ public: } return ph; } - Phys *phys_ensure_find_or_create(unsigned chip_chan) + Phys *phys_ensure_find_or_create(uint16_t chip_chan) { Phys *ph = phys_find_or_create(chip_chan); assert(ph); @@ -679,7 +679,7 @@ public: void activenotes_clear() { - for(unsigned i = 0; i < 128; ++i) { + for(uint8_t i = 0; i < 128; ++i) { activenotes[i].note = i; activenotes[i].active = false; } diff --git a/utils/midiplay/adlmidiplay.cpp b/utils/midiplay/adlmidiplay.cpp index 364909a..6c44171 100644 --- a/utils/midiplay/adlmidiplay.cpp +++ b/utils/midiplay/adlmidiplay.cpp @@ -320,6 +320,8 @@ int main(int argc, char **argv) #endif #ifndef HARDWARE_OPL3 int emulator = ADLMIDI_EMU_NUKED; + #endif + #if !defined(HARDWARE_OPL3) && !defined(OUTPUT_WAVE_ONLY) g_audioFormat.type = ADLMIDI_SampleType_S16; g_audioFormat.containerSize = sizeof(Sint16); g_audioFormat.sampleOffset = sizeof(Sint16) * 2; -- cgit v1.2.3