ADL&OPN: Fix long vs int64 conflict in 'CalcChGoodness'

This commit is contained in:
Vitaly Novichkov 2018-03-25 01:37:44 +03:00
parent 6e6d1b5e97
commit a60dc64e71
4 changed files with 13 additions and 14 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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

View file

@ -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)