From 22b1e4fb4caaa1a69c647a4b22bd6481cd907ce1 Mon Sep 17 00:00:00 2001 From: "Raine M. Ekman" Date: Tue, 5 May 2015 22:21:33 +0300 Subject: [PATCH] Clarified the reason for qApp->processEvents(), changed an odd type juggling into something slightly saner. --- plugins/MidiImport/MidiImport.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/MidiImport/MidiImport.cpp b/plugins/MidiImport/MidiImport.cpp index 3b76d58b0..c9fa47070 100644 --- a/plugins/MidiImport/MidiImport.cpp +++ b/plugins/MidiImport/MidiImport.cpp @@ -160,6 +160,9 @@ public: { if( !at ) { + // Keep LMMS responsive, for now the import runs + // in the main thread. This should probably be + // removed if that ever changes. qApp->processEvents(); at = dynamic_cast( Track::create( Track::AutomationTrack, tc ) ); } @@ -224,6 +227,7 @@ public: smfMidiChannel * create( TrackContainer* tc, QString tn ) { if( !it ) { + // Keep LMMS responsive qApp->processEvents(); it = dynamic_cast( Track::create( Track::InstrumentTrack, tc ) ); @@ -409,7 +413,7 @@ bool MidiImport::readSMF( TrackContainer* tc ) { smfMidiChannel * ch = chs[evt->chan].create( tc, trackName ); Alg_note_ptr noteEvt = dynamic_cast( evt ); - double ticks = MidiTime( noteEvt->get_duration() * ticksPerBeat ); + int ticks = noteEvt->get_duration() * ticksPerBeat; Note n( (ticks < 1 ? 1 : ticks ), noteEvt->get_start_time() * ticksPerBeat, noteEvt->get_identifier() - 12,