Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug and typo fix
Browse files Browse the repository at this point in the history
senseab committed Jan 10, 2017
1 parent 47694ae commit f9d4de9
Showing 9 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion plugins/SmfImport/SmfImport.cpp
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ SmfImport::SmfImport(const QString &_file):

SmfImport::~SmfImport()
{
closeFile();
}

bool SmfImport::tryImport(TrackContainer *tc)
@@ -113,7 +114,6 @@ bool SmfImport::tryImport(TrackContainer *tc)
}

filename = file().fileName();
closeFile();

switch( readID() )
{
5 changes: 3 additions & 2 deletions plugins/SmfImport/commonReader.cpp
Original file line number Diff line number Diff line change
@@ -291,7 +291,7 @@ void commonReader::addNoteEvent(long tick, int chan,
&& tick >= note[time])
{
int dur = tick - note[time];
addNoteEvent(tick, chan, pitch, note[note_vol], dur, track);
addNoteEvent(note[time], chan, pitch, note[note_vol], dur, track);
note_list.removeAt(c);
delete note;
break;
@@ -313,7 +313,8 @@ void commonReader::addNoteEvent(long tick, int chan, int pitch, int vol,

QString trackName = QString( tr( "Track" ) + " %1").arg(track+1);
SmfMidiChannel * ch = chs[track].create( m_tc, trackName );
Note n( (dur < 1 ? 1 : dur ), (double)tick * tickRate, pitch-12, vol );
double realDur = dur * tickRate;
Note n( (realDur < 1 ? 1 : realDur ), (double)tick * tickRate, pitch-12, vol );
ch->addNote( n );

}
1 change: 0 additions & 1 deletion plugins/SmfImport/commonReader.h
Original file line number Diff line number Diff line change
@@ -57,7 +57,6 @@ class commonReader : public QObject
public:
commonReader(TrackContainer *tc, const char *hintText);
~commonReader();
void read(QString &fileName);
protected:
virtual void errorHandler(const QString &errorStr);
void CCHandler(long tick, int track, int ctl, int value);
11 changes: 8 additions & 3 deletions plugins/SmfImport/midiReader.cpp
Original file line number Diff line number Diff line change
@@ -81,6 +81,11 @@ midiReader::~midiReader()
delete m_seq;
}

void midiReader::read(QString &fileName)
{
m_seq->readFromFile(fileName);
}

// Slots below.

// b0: Numerator
@@ -94,7 +99,7 @@ void midiReader::timeSigEvent(int b0, int b1, int b2, int b3)

void midiReader::tempoEvent(int tempo)
{
tempoHandler(m_seq->getCurrentTempo(), 60000000/tempo);
tempoHandler(m_seq->getCurrentTime(), 60000000/tempo);
}

void midiReader::errorHandler(const QString &errorStr)
@@ -105,12 +110,12 @@ void midiReader::errorHandler(const QString &errorStr)

void midiReader::ctlChangeEvent(int chan, int ctl, int value)
{
CCHandler(m_seq->getCurrentTempo(), chan, ctl, value);
CCHandler(m_seq->getCurrentTime(), chan, ctl, value);
}

void midiReader::pitchBendEvent(int chan, int value)
{
CCHandler(m_seq->getCurrentTempo(), chan, pitchBendEventId, value);
CCHandler(m_seq->getCurrentTime(), chan, pitchBendEventId, value);
}

void midiReader::noteOnEvent(int chan, int pitch, int vol)
1 change: 1 addition & 0 deletions plugins/SmfImport/midiReader.h
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ class midiReader : public commonReader
public:
midiReader(TrackContainer *tc);
~midiReader();
void read(QString &fileName);
public slots:
void headerEvent(int format, int ntrks, int division);
void noteOnEvent(int chan, int pitch, int vol);
5 changes: 5 additions & 0 deletions plugins/SmfImport/oveReader.cpp
Original file line number Diff line number Diff line change
@@ -90,6 +90,11 @@ oveReader::~oveReader()
delete m_seq;
}

void oveReader::read(QString &fileName)
{
m_seq->readFromFile(fileName);
}

// Slots below.
void oveReader::timeSigEvent(int bar, long tick, int num, int den)
{
1 change: 1 addition & 0 deletions plugins/SmfImport/oveReader.h
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ class oveReader : public commonReader
public:
oveReader(TrackContainer *tc);
~oveReader();
void read(QString &fileName);
public slots:
void errorHandler(const QString& errorStr);
void fileHeader(int quarter, int trackCount);
9 changes: 7 additions & 2 deletions plugins/SmfImport/wrkReader.cpp
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ wrkReader::wrkReader( TrackContainer* tc ) :
connect(m_seq, SIGNAL(signalWRKProgram(int,long,int,int)),
this, SLOT(programEvent(int,long,int,int)));
connect(m_seq, SIGNAL(signalWRKTimeSig(int,int,int)),
this, SLOT(pitchBendEvent(int,long,int,int)));
this, SLOT(timeSigEvent(int,int,int)));
connect(m_seq, SIGNAL(signalWRKTempo(long,int)),
this, SLOT(tempoEvent(long,int)));
connect(m_seq, SIGNAL(signalWRKTrackVol(int,int)),
@@ -74,6 +74,11 @@ wrkReader::~wrkReader()
delete m_seq;
}

void wrkReader::read(QString &fileName)
{
m_seq->readFromFile(fileName);
}

// Slots below.

void wrkReader::timeSigEvent(int bar, int num, int den)
@@ -129,5 +134,5 @@ void wrkReader::trackVol(int track, int vol)

void wrkReader::timeBase(int quarter)
{
timeBase(quarter);
timeBaseHandler(quarter);
}
1 change: 1 addition & 0 deletions plugins/SmfImport/wrkReader.h
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ class wrkReader : public commonReader
public:
wrkReader(TrackContainer *tc);
~wrkReader();
void read(QString &fileName);
public slots:
void errorHandler(const QString& errorStr);
void timeBase(int timebase);

0 comments on commit f9d4de9

Please sign in to comment.