Fix MIDI import encoding issue on Windows
This commit is contained in:
@@ -78,6 +78,11 @@ protected:
|
||||
return m_file.read( _data, _len );
|
||||
}
|
||||
|
||||
inline QByteArray readAllData()
|
||||
{
|
||||
return m_file.readAll();
|
||||
}
|
||||
|
||||
inline void ungetChar( char _ch )
|
||||
{
|
||||
m_file.ungetChar( _ch );
|
||||
|
||||
@@ -26,9 +26,12 @@
|
||||
#include <QDomDocument>
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QProgressDialog>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "MidiImport.h"
|
||||
#include "TrackContainer.h"
|
||||
#include "InstrumentTrack.h"
|
||||
@@ -279,8 +282,6 @@ public:
|
||||
|
||||
bool MidiImport::readSMF( TrackContainer* tc )
|
||||
{
|
||||
QString filename = file().fileName();
|
||||
closeFile();
|
||||
|
||||
const int preTrackSteps = 2;
|
||||
QProgressDialog pd( TrackContainer::tr( "Importing MIDI-file..." ),
|
||||
@@ -291,7 +292,11 @@ bool MidiImport::readSMF( TrackContainer* tc )
|
||||
|
||||
pd.setValue( 0 );
|
||||
|
||||
Alg_seq_ptr seq = new Alg_seq(filename.toLocal8Bit(), true);
|
||||
std::stringstream stream;
|
||||
QByteArray arr = readAllData();
|
||||
stream.str(std::string(arr.constData(), arr.size()));
|
||||
|
||||
Alg_seq_ptr seq = new Alg_seq(stream, true);
|
||||
seq->convert_to_beats();
|
||||
|
||||
pd.setMaximum( seq->tracks() + preTrackSteps );
|
||||
|
||||
Reference in New Issue
Block a user