diff --git a/src/sound/adlmidi/adlmidi_midiplay.cpp b/src/sound/adlmidi/adlmidi_midiplay.cpp index ea3b1fefb..65e7af5ef 100644 --- a/src/sound/adlmidi/adlmidi_midiplay.cpp +++ b/src/sound/adlmidi/adlmidi_midiplay.cpp @@ -2109,9 +2109,9 @@ void MIDIplay::HandleEvent(size_t tk, const MIDIplay::MidiEvent &evt, int &statu } #endif -long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) const +int64_t MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteInfo::Phys &ins, uint16_t) const { - long s = -ch[c].koff_time_until_neglible; + int64_t s = -ch[c].koff_time_until_neglible; // Same midi-instrument = some stability //if(c == MidCh) s += 4; @@ -2123,9 +2123,9 @@ long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteIn s -= 4000; if(!j->second.sustained) - s -= (long)j->second.kon_time_until_neglible; + s -= j->second.kon_time_until_neglible; else - s -= (long)(j->second.kon_time_until_neglible / 2); + s -= (j->second.kon_time_until_neglible / 2); MIDIchannel::activenotemap_t::const_iterator k = Ch[j->first.MidCh].activenotes.find(j->first.note); @@ -2143,7 +2143,7 @@ long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteIn } // Percussion is inferior to melody - s += 50 * (k->second.midiins / 128); + s += 50 * (int64_t)(k->second.midiins / 128); /* if(k->second.midiins >= 25 && k->second.midiins < 40 @@ -2178,7 +2178,7 @@ long MIDIplay::CalculateAdlChannelGoodness(unsigned c, const MIDIchannel::NoteIn } } - s += n_evacuation_stations * 4; + s += (int64_t)n_evacuation_stations * 4; } return s; diff --git a/src/sound/adlmidi/adlmidi_private.hpp b/src/sound/adlmidi/adlmidi_private.hpp index 8f0c6579f..852334328 100644 --- a/src/sound/adlmidi/adlmidi_private.hpp +++ b/src/sound/adlmidi/adlmidi_private.hpp @@ -965,7 +965,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*/) const; + int64_t 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) diff --git a/src/sound/opnmidi/opnmidi_midiplay.cpp b/src/sound/opnmidi/opnmidi_midiplay.cpp index 50bc21742..630df1c77 100644 --- a/src/sound/opnmidi/opnmidi_midiplay.cpp +++ b/src/sound/opnmidi/opnmidi_midiplay.cpp @@ -2031,9 +2031,9 @@ void OPNMIDIplay::HandleEvent(size_t tk, const OPNMIDIplay::MidiEvent &evt, int } #endif //OPNMIDI_DISABLE_MIDI_SEQUENCER -long OPNMIDIplay::CalculateAdlChannelGoodness(size_t c, uint16_t ins, uint16_t) const +int64_t OPNMIDIplay::CalculateAdlChannelGoodness(size_t c, uint16_t ins, uint16_t) const { - long s = -ch[c].koff_time_until_neglible; + int64_t s = -ch[c].koff_time_until_neglible; // Same midi-instrument = some stability //if(c == MidCh) s += 4; @@ -2045,9 +2045,9 @@ long OPNMIDIplay::CalculateAdlChannelGoodness(size_t c, uint16_t ins, uint16_t) s -= 4000; if(!j->second.sustained) - s -= (long)j->second.kon_time_until_neglible; + s -= j->second.kon_time_until_neglible; else - s -= (long)(j->second.kon_time_until_neglible / 2); + s -= (j->second.kon_time_until_neglible / 2); MIDIchannel::activenotemap_t::const_iterator k = Ch[j->first.MidCh].activenotes.find(j->first.note); @@ -2065,7 +2065,7 @@ long OPNMIDIplay::CalculateAdlChannelGoodness(size_t c, uint16_t ins, uint16_t) } // Percussion is inferior to melody - s += 50 * (k->second.midiins / 128); + s += 50 * (int64_t)(k->second.midiins / 128); /* if(k->second.midiins >= 25 && k->second.midiins < 40 diff --git a/src/sound/opnmidi/opnmidi_private.hpp b/src/sound/opnmidi/opnmidi_private.hpp index 4654456aa..10cda9716 100644 --- a/src/sound/opnmidi/opnmidi_private.hpp +++ b/src/sound/opnmidi/opnmidi_private.hpp @@ -94,7 +94,6 @@ typedef __int32 ssize_t; #include "opnbank.h" #include "opnmidi.h" - #define ADL_UNUSED(x) (void)x extern std::string OPN2MIDI_ErrorString; @@ -894,7 +893,7 @@ private: // Determine how good a candidate this adlchannel // would be for playing a note from this instrument. - long CalculateAdlChannelGoodness(size_t c, uint16_t ins, uint16_t /*MidCh*/) const; + int64_t CalculateAdlChannelGoodness(size_t c, uint16_t 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)