]> code.delx.au - virtualtones/blobdiff - midiengine.cpp
Remove unused include
[virtualtones] / midiengine.cpp
index 1ba329973f86cf6679c7f91ddf70764dcf4bad7c..bd8a529ff8955c55e516ae44b8d34ffb87578b46 100644 (file)
@@ -1,10 +1,17 @@
 // midiengine.cpp - Class to play to a sequencer or write to a MIDI file
-// Written by James Bunton <james@delx.cjb.net>
+// Written by James Bunton <james@delx.net.au>
 // Licensed under the GPL, see COPYING.txt for more details
 
 
 #include "midiengine.h"
 
+#include <cstdio>
+
+#include <QList>
+
+
+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 <linux/soundcard.h>
 #include <sys/ioctl.h>
@@ -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 <windows.h>
 #include <mmsystem.h>
@@ -323,10 +330,6 @@ bool MidiReal::playNote(int num, int vel, int len)
 /* |-------------------------| */
 
 
-#include <stdio.h>
-
-#include <qvaluelist.h>
-
 
 
 
@@ -368,7 +371,7 @@ public:
 
 
        /* A place to store the MTrk_Packets as we wait for them */
-       QValueList<struct MTrk_Packet> packets;
+       QList<struct MTrk_Packet> 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<struct MTrk_Packet>::Iterator it;
+       QList<struct MTrk_Packet>::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;
 }
-
-