File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ class EXPORT ImportFilter : public Plugin
7878 return m_file.read ( _data, _len );
7979 }
8080
81+ inline QByteArray readAllData ()
82+ {
83+ return m_file.readAll ();
84+ }
85+
8186 inline void ungetChar ( char _ch )
8287 {
8388 m_file.ungetChar ( _ch );
Original file line number Diff line number Diff line change 2626#include < QDomDocument>
2727#include < QDir>
2828#include < QApplication>
29+ #include < QFile>
2930#include < QMessageBox>
3031#include < QProgressDialog>
3132
33+ #include < sstream>
34+
3235#include " MidiImport.h"
3336#include " TrackContainer.h"
3437#include " InstrumentTrack.h"
@@ -279,8 +282,6 @@ class smfMidiChannel
279282
280283bool MidiImport::readSMF ( TrackContainer* tc )
281284{
282- QString filename = file ().fileName ();
283- closeFile ();
284285
285286 const int preTrackSteps = 2 ;
286287 QProgressDialog pd ( TrackContainer::tr ( " Importing MIDI-file..." ),
@@ -291,7 +292,11 @@ bool MidiImport::readSMF( TrackContainer* tc )
291292
292293 pd.setValue ( 0 );
293294
294- Alg_seq_ptr seq = new Alg_seq (filename.toLocal8Bit (), true );
295+ std::stringstream stream;
296+ QByteArray arr = readAllData ();
297+ stream.str (std::string (arr.constData (), arr.size ()));
298+
299+ Alg_seq_ptr seq = new Alg_seq (stream, true );
295300 seq->convert_to_beats ();
296301
297302 pd.setMaximum ( seq->tracks () + preTrackSteps );
You can’t perform that action at this time.
0 commit comments