// 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 | */
/* Linux code */
-#ifdef Q_WS_X11
+#ifdef Q_OS_LINUX
#include <linux/soundcard.h>
#include <sys/ioctl.h>
{
// Use to set the sequencer and device
QString dev = "/dev/sequencer";
- int devicenum = 0;
+ int devicenum = 1;
d = new Private();
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;
/* Windows code */
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
#include <windows.h>
#include <mmsystem.h>
/* |-------------------------| */
-#include <stdio.h>
-
-#include <qvaluelist.h>
-
/* 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;
// 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
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;
return true;
}
-
-