Use automation track for MIDI program change events (#6308)
This commit is contained in:
@@ -319,6 +319,9 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
// 128 CC + Pitch Bend
|
||||
smfMidiCC ccs[MIDI_CC_COUNT];
|
||||
|
||||
// channel to CC object for program changes
|
||||
std::unordered_map<long, smfMidiCC> pcs;
|
||||
|
||||
// channels can be set out of 256 range
|
||||
// using unordered_map should fix most invalid loads and crashes while loading
|
||||
std::unordered_map<long, smfMidiChannel> chs;
|
||||
@@ -467,8 +470,12 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
long prog = evt->get_integer_value();
|
||||
if( ch->isSF2 )
|
||||
{
|
||||
ch->it_inst->childModel( "bank" )->setValue( 0 );
|
||||
ch->it_inst->childModel( "patch" )->setValue( prog );
|
||||
auto& pc = pcs[evt->chan];
|
||||
AutomatableModel* objModel = ch->it_inst->childModel("patch");
|
||||
if (pc.at == nullptr) {
|
||||
pc.create(tc, trackName + " > " + objModel->displayName());
|
||||
}
|
||||
pc.putValue(time, objModel, prog);
|
||||
}
|
||||
else {
|
||||
const QString num = QString::number( prog );
|
||||
|
||||
Reference in New Issue
Block a user