X-Git-Url: https://code.delx.au/virtualtones/blobdiff_plain/fea523e103dc13f1f80f71d75fe4f88686566584..dbf3c275fdcd6a94bb63ba2346b8f89dbfe35380:/midiengine.cpp diff --git a/midiengine.cpp b/midiengine.cpp index 1ba3299..5972527 100644 --- a/midiengine.cpp +++ b/midiengine.cpp @@ -5,6 +5,13 @@ #include "midiengine.h" +#include + +#include + + +using namespace Qt; + /* |---------------------------| */ /* | Code for class MidiEngine | */ @@ -60,7 +67,7 @@ void MidiEngine::timerEvent(QTimerEvent *) /* Linux code */ -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX #include #include @@ -82,7 +89,7 @@ MidiReal::MidiReal() { // Use to set the sequencer and device QString dev = "/dev/sequencer"; - int devicenum = 0; + int devicenum = 1; d = new Private(); @@ -93,7 +100,7 @@ MidiReal::MidiReal() timer = 0; // Open the sequencer file - d->seqfd = open(d->seqDevice.latin1(), O_WRONLY, 0); + d->seqfd = open(d->seqDevice.toLatin1(), O_WRONLY, 0); if (d->seqfd < 0) { errorMessage = "Cannot open sequencer: " + d->seqDevice; return; @@ -208,7 +215,7 @@ bool MidiReal::playNote(int num, int vel, int len) /* Windows code */ -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #include #include @@ -323,10 +330,6 @@ bool MidiReal::playNote(int num, int vel, int len) /* |-------------------------| */ -#include - -#include - @@ -368,7 +371,7 @@ public: /* A place to store the MTrk_Packets as we wait for them */ - QValueList packets; + QList packets; /* The time the last note was played, relative to MidiEngine::timer */ long int prevNoteTime; @@ -476,7 +479,7 @@ void MidiFile::Private::writeMIDI() // Store the MIDI packets in the MTrk chunk - QValueList::Iterator it; + QList::Iterator it; int pos = 0; for(it = packets.begin(); it != packets.end(); ++it) { // Twist the deltaTime, then copy it @@ -544,7 +547,7 @@ MidiFile::MidiFile(QString file) d->prevNoteTime = -1; // Open the MIDI file to send output to - d->file = fopen(d->filename.latin1(), "wb"); + d->file = fopen(d->filename.toLatin1(), "wb"); if (d->file == 0) { errorMessage = "Cannot open output MIDI file: " + d->filename; return; @@ -649,5 +652,3 @@ bool MidiFile::playNote(int num, int vel, int len) return true; } - -