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 --- src/adlmidi.cpp | 12 ++++++++++-- src/adlmidi_bankmap.h | 3 ++- src/adlmidi_midiplay.cpp | 10 ++++++++++ src/adlmidi_private.hpp | 6 +++--- 4 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3