From 61ab0ed0938575ee3ce3e077d914ec3df96a9a1e Mon Sep 17 00:00:00 2001 From: "Raine M. Ekman" Date: Fri, 24 Apr 2015 22:44:02 +0300 Subject: [PATCH] MIDI import: add naming of AutomationTracks Name the automation tracks like "[MIDI trackname] CC ##". And don't call the automation track creation function for every CC event, as it now will involve constructing a QString. --- plugins/MidiImport/MidiImport.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index afc49e7bb..004c33957 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -156,12 +156,15 @@ public: AutomationPattern * ap; MidiTime lastPos; - smfMidiCC & create( TrackContainer* tc ) + smfMidiCC & create( TrackContainer* tc, QString tn ) { if( !at ) { at = dynamic_cast( Track::create( Track::AutomationTrack, tc ) ); } + if( tn != "") { + at->setName( tn ); + } return *this; } @@ -487,7 +490,11 @@ bool MidiImport::readSMF( TrackContainer* tc ) } else { - ccs[ccid].create( tc ); + if( ccs[ccid].at == NULL ) { + ccs[ccid].create( tc, trackName + + (ccid == 128 ? " Pitch bend" : + QString(" CC %1").arg(ccid) ) ); + } ccs[ccid].putValue( time, objModel, cc ); } }