summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-10-24 13:23:09 +0000
committerWerner Schweer <ws.seh.de>2006-10-24 13:23:09 +0000
commitd813f57ddfeb69ba28c772f7bfc0ae5f7017f71a (patch)
tree3eac8bce962e9f014f6c3132d5be0c9334147a8b
parentd64ded05c5d77cdec45a099d589566edfe98be50 (diff)
"Node" and other cleanups
-rw-r--r--muse/muse/audio.cpp7
-rw-r--r--muse/muse/audioinput.cpp8
-rw-r--r--muse/muse/audiooutput.cpp6
-rw-r--r--muse/muse/audiotrack.cpp4
-rw-r--r--muse/muse/audiotrack.h2
-rw-r--r--muse/muse/driver/alsamidi.cpp125
-rw-r--r--muse/muse/driver/alsamidi.h5
-rw-r--r--muse/muse/driver/driver.h4
-rw-r--r--muse/muse/driver/dummyaudio.cpp67
-rw-r--r--muse/muse/driver/jack.cpp62
-rw-r--r--muse/muse/driver/jackaudio.h7
-rw-r--r--muse/muse/driver/port.h64
-rw-r--r--muse/muse/fifo.h7
-rw-r--r--muse/muse/importmidi.cpp1
-rw-r--r--muse/muse/midiinport.cpp4
-rw-r--r--muse/muse/midioutport.cpp4
-rw-r--r--muse/muse/plugin.cpp4
-rw-r--r--muse/muse/route.cpp26
-rw-r--r--muse/muse/route.h13
-rw-r--r--muse/muse/seqmsg.cpp12
-rw-r--r--muse/muse/synth.h2
-rw-r--r--muse/muse/track.cpp26
-rw-r--r--muse/muse/track.h3
23 files changed, 263 insertions, 200 deletions
diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp
index b1185cf8..b3e77213 100644
--- a/muse/muse/audio.cpp
+++ b/muse/muse/audio.cpp
@@ -194,8 +194,9 @@ bool Audio::start()
InputList* itl = song->inputs();
for (iAudioInput i = itl->begin(); i != itl->end(); ++i) {
// printf("reconnecting input %s\n", (*i)->name().toLatin1().data());
- for (int x=0; x < (*i)->channels();x++)
- (*i)->setJackPort(0, x); // zero out the old connection
+ for (int x=0; x < (*i)->channels();x++) {
+ (*i)->setJackPort(Port(), x); // zero out the old connection
+ }
(*i)->activate1();
}
@@ -203,7 +204,7 @@ bool Audio::start()
for (iAudioOutput i = otl->begin(); i != otl->end(); ++i) {
// printf("reconnecting output %s\n", (*i)->name().toLatin1().data());
for (int x=0; x < (*i)->channels();x++)
- (*i)->setJackPort(0,x); // zero out the old connection
+ (*i)->setJackPort(Port(), x); // zero out the old connection
(*i)->activate1();
}
audioDriver->start(realTimePriority);
diff --git a/muse/muse/audioinput.cpp b/muse/muse/audioinput.cpp
index 92c0dfd8..d4c6a12e 100644
--- a/muse/muse/audioinput.cpp
+++ b/muse/muse/audioinput.cpp
@@ -53,7 +53,7 @@ AudioInput::AudioInput()
AudioInput::~AudioInput()
{
for (int i = 0; i < _channels; ++i) {
- if (jackPort(i))
+ if (!jackPort(i).isZero())
audioDriver->unregisterPort(jackPort(i));
}
// AudioInput does not own buffers (they are from JACK)
@@ -104,10 +104,10 @@ void AudioInput::setName(const QString& s)
{
Track::setName(s);
for (int i = 0; i < channels(); ++i) {
- if (jackPort(i)) {
+ if (!jackPort(i).isZero()) {
char buffer[128];
snprintf(buffer, 128, "%s-%d", _name.toAscii().data(), i);
- if (jackPort(i))
+ if (!jackPort(i).isZero())
audioDriver->setPortName(jackPort(i), buffer);
}
}
@@ -123,7 +123,7 @@ void AudioInput::collectInputData()
bufferEmpty = false;
for (int ch = 0; ch < channels(); ++ch) {
Port port = jackPort(ch);
- if (port)
+ if (!port.isZero())
buffer[ch] = audioDriver->getBuffer(port, segmentSize);
else {
printf("NO JACK PORT\n");
diff --git a/muse/muse/audiooutput.cpp b/muse/muse/audiooutput.cpp
index ff057474..2899cf7d 100644
--- a/muse/muse/audiooutput.cpp
+++ b/muse/muse/audiooutput.cpp
@@ -55,7 +55,7 @@ AudioOutput::AudioOutput()
AudioOutput::~AudioOutput()
{
for (int i = 0; i < _channels; ++i) {
- if (jackPort(i))
+ if (!jackPort(i).isZero())
audioDriver->unregisterPort(jackPort(i));
}
// AudioOutput does not own buffers (they are from JACK)
@@ -106,7 +106,7 @@ void AudioOutput::setChannels(int n)
void AudioOutput::silence(unsigned n)
{
for (int i = 0; i < channels(); ++i) {
- if (jackPort(i))
+ if (!jackPort(i).isZero())
buffer[i] = audioDriver->getBuffer(jackPort(i), n);
else {
printf("PANIC: silence(): no buffer from audio driver\n");
@@ -126,7 +126,7 @@ void AudioOutput::setName(const QString& s)
{
Track::setName(s);
for (int i = 0; i < channels(); ++i) {
- if (jackPort(i)) {
+ if (!jackPort(i).isZero()) {
char buffer[128];
snprintf(buffer, 128, "%s-%d", _name.toAscii().data(), i);
audioDriver->setPortName(jackPort(i), buffer);
diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp
index e4ea6072..b6cb821d 100644
--- a/muse/muse/audiotrack.cpp
+++ b/muse/muse/audiotrack.cpp
@@ -70,6 +70,10 @@ AudioTrack::AudioTrack(TrackType t)
AudioTrack::~AudioTrack()
{
+ foreach(PluginI* plugin, *_prePipe)
+ delete plugin;
+ foreach(PluginI* plugin, *_postPipe)
+ delete plugin;
delete _prePipe;
delete _postPipe;
for (int i = 0; i < MAX_CHANNELS; ++i) {
diff --git a/muse/muse/audiotrack.h b/muse/muse/audiotrack.h
index b702cf80..f6f5a89d 100644
--- a/muse/muse/audiotrack.h
+++ b/muse/muse/audiotrack.h
@@ -24,6 +24,8 @@
#include "fifo.h"
#include "track.h"
+class Pipeline;
+class SndFile;
class PluginI;
class AuxPluginIF;
diff --git a/muse/muse/driver/alsamidi.cpp b/muse/muse/driver/alsamidi.cpp
index 810ace1e..be214068 100644
--- a/muse/muse/driver/alsamidi.cpp
+++ b/muse/muse/driver/alsamidi.cpp
@@ -119,10 +119,7 @@ QList<PortName> AlsaMidi::outputPorts(bool)
if (client != snd_seq_client_id(alsaSeq)) {
PortName pn;
pn.name = QString(snd_seq_port_info_get_name(pinfo));
- snd_seq_addr_t* adr = new snd_seq_addr_t;
- adr->port = snd_seq_port_info_get_port(pinfo);
- adr->client = client;
- pn.port = adr;
+ pn.port = Port(client, snd_seq_port_info_get_port(pinfo));
clientList.append(pn);
}
}
@@ -156,10 +153,7 @@ QList<PortName> AlsaMidi::inputPorts(bool)
if (client != snd_seq_client_id(alsaSeq)) {
PortName pn;
pn.name = QString(snd_seq_port_info_get_name(pinfo));
- snd_seq_addr_t* adr = new snd_seq_addr_t;
- adr->port = snd_seq_port_info_get_port(pinfo);
- adr->client = client;
- pn.port = adr;
+ pn.port = Port(client, snd_seq_port_info_get_port(pinfo));
clientList.append(pn);
}
}
@@ -174,27 +168,13 @@ QList<PortName> AlsaMidi::inputPorts(bool)
Port AlsaMidi::registerOutPort(const QString& name, bool)
{
- int port = snd_seq_create_simple_port(alsaSeq, name.toLatin1().data(),
+ int alsaPort = snd_seq_create_simple_port(alsaSeq, name.toLatin1().data(),
outCap | SND_SEQ_PORT_CAP_WRITE, SND_SEQ_PORT_TYPE_APPLICATION);
- if (port < 0) {
- perror("create port");
- exit(1);
+ if (alsaPort < 0) {
+ perror("cannot create alsa out port");
+ return Port();
}
- snd_seq_addr_t* adr = new snd_seq_addr_t;
- adr->port = port;
- adr->client = snd_seq_client_id(alsaSeq);
- return adr;
- }
-
-//---------------------------------------------------------
-// equal
-//---------------------------------------------------------
-
-bool AlsaMidi::equal(Port p1, Port p2)
- {
- snd_seq_addr_t* a1 = (snd_seq_addr_t*)(p1);
- snd_seq_addr_t* a2 = (snd_seq_addr_t*)(p2);
- return (a1->port == a2->port) && (a1->client == a2->client);
+ return Port(snd_seq_client_id(alsaSeq), alsaPort);
}
//---------------------------------------------------------
@@ -203,16 +183,13 @@ bool AlsaMidi::equal(Port p1, Port p2)
Port AlsaMidi::registerInPort(const QString& name, bool)
{
- int port = snd_seq_create_simple_port(alsaSeq, name.toLatin1().data(),
+ int alsaPort = snd_seq_create_simple_port(alsaSeq, name.toLatin1().data(),
inCap | SND_SEQ_PORT_CAP_READ, SND_SEQ_PORT_TYPE_APPLICATION);
- if (port < 0) {
- perror("create port");
- exit(1);
+ if (alsaPort < 0) {
+ perror("cannot create alsa in port");
+ return Port();
}
- snd_seq_addr_t* adr = new snd_seq_addr_t;
- adr->port = port;
- adr->client = snd_seq_client_id(alsaSeq);
- return adr;
+ return Port(snd_seq_client_id(alsaSeq), alsaPort);
}
//---------------------------------------------------------
@@ -221,8 +198,7 @@ Port AlsaMidi::registerInPort(const QString& name, bool)
void AlsaMidi::unregisterPort(Port port)
{
- snd_seq_delete_simple_port(alsaSeq, AlsaPort(port)->port);
- delete (snd_seq_addr_t*)port;
+ snd_seq_delete_simple_port(alsaSeq, port.alsaPort());
}
//---------------------------------------------------------
@@ -242,7 +218,7 @@ QString AlsaMidi::portName(Port p)
{
snd_seq_port_info_t* pinfo;
snd_seq_port_info_alloca(&pinfo);
- snd_seq_get_any_port_info(alsaSeq, AlsaPort(p)->client, AlsaPort(p)->port, pinfo);
+ snd_seq_get_any_port_info(alsaSeq, p.alsaClient(), p.alsaPort(), pinfo);
return QString(snd_seq_port_info_get_name(pinfo));
}
@@ -252,10 +228,6 @@ QString AlsaMidi::portName(Port p)
Port AlsaMidi::findPort(const QString& name)
{
- snd_seq_addr_t* adr = new snd_seq_addr_t;
- adr->port = 0;
- adr->client = 0;
-
snd_seq_client_info_t* cinfo;
snd_seq_client_info_alloca(&cinfo);
snd_seq_client_info_set_client(cinfo, 0);
@@ -268,14 +240,13 @@ Port AlsaMidi::findPort(const QString& name)
while (snd_seq_query_next_port(alsaSeq, pinfo) >= 0) {
const char* pn = snd_seq_port_info_get_name(pinfo);
if (name == pn) {
- snd_seq_addr_t* adr = new snd_seq_addr_t;
- *adr = *snd_seq_port_info_get_addr(pinfo);
- return adr;
+ return Port(snd_seq_port_info_get_client(pinfo),
+ snd_seq_port_info_get_port(pinfo));
}
}
}
printf("AlsaMidi: port <%s> not found\n", name.toLatin1().data());
- return 0;
+ return Port();
}
//---------------------------------------------------------
@@ -285,20 +256,22 @@ Port AlsaMidi::findPort(const QString& name)
bool AlsaMidi::connect(Port src, Port dst)
{
- if (((AlsaPort)dst) == 0) {
- printf("AlsaMidi::connect failed: invalid alsa port\n");
- return false;
- }
snd_seq_port_subscribe_t* sub;
snd_seq_port_subscribe_alloca(&sub);
- snd_seq_port_subscribe_set_sender(sub, (AlsaPort)src);
- snd_seq_port_subscribe_set_dest(sub, (AlsaPort)dst);
+ snd_seq_addr_t s, d;
+ s.port = src.alsaPort();
+ s.client = src.alsaClient();
+ d.port = dst.alsaPort();
+ d.client = dst.alsaClient();
+ snd_seq_port_subscribe_set_sender(sub, &s);
+ snd_seq_port_subscribe_set_dest(sub, &d);
+
int rv = snd_seq_subscribe_port(alsaSeq, sub);
if (rv < 0) {
printf("AlsaMidi::connect(%d:%d, %d:%d) failed: %s\n",
- ((AlsaPort)src)->client, ((AlsaPort)src)->port,
- ((AlsaPort)dst)->client, ((AlsaPort)dst)->port,
+ src.alsaClient(), src.alsaPort(),
+ dst.alsaClient(), dst.alsaPort(),
snd_strerror(rv));
return false;
}
@@ -314,8 +287,13 @@ bool AlsaMidi::disconnect(Port src, Port dst)
{
snd_seq_port_subscribe_t* sub;
snd_seq_port_subscribe_alloca(&sub);
- snd_seq_port_subscribe_set_sender(sub, (AlsaPort)src);
- snd_seq_port_subscribe_set_dest(sub, (AlsaPort)dst);
+ snd_seq_addr_t s, d;
+ s.port = src.alsaPort();
+ s.client = src.alsaClient();
+ d.port = dst.alsaPort();
+ d.client = dst.alsaClient();
+ snd_seq_port_subscribe_set_sender(sub, &s);
+ snd_seq_port_subscribe_set_dest(sub, &d);
int rv = snd_seq_unsubscribe_port(alsaSeq, sub);
if (rv < 0)
printf("AlsaMidi::disconnect() failed: %s\n",
@@ -356,19 +334,19 @@ void AlsaMidi::getOutputPollFd(struct pollfd** p, int* n)
void AlsaMidi::addConnection(snd_seq_connect_t* ev)
{
- Port rs = Port(&ev->sender);
- Port rd = Port(&ev->dest);
+ Port rs(ev->sender.client, ev->sender.port);
+ Port rd(ev->dest.client, ev->dest.port);
MidiOutPortList* opl = song->midiOutPorts();
for (iMidiOutPort i = opl->begin(); i != opl->end(); ++i) {
MidiOutPort* oport = *i;
Port src = oport->alsaPort(0);
- if (equal(src, rs)) {
+ if (src == rs) {
Route r(rd, Route::MIDIPORT);
if (oport->outRoutes()->indexOf(r) == -1) {
- snd_seq_addr_t* adr = new snd_seq_addr_t(ev->dest);
- oport->outRoutes()->push_back(Route(Port(adr), -1, Route::MIDIPORT));
+ Port port(ev->dest.client, ev->dest.port);
+ oport->outRoutes()->push_back(Route(port, -1, Route::MIDIPORT));
}
break;
}
@@ -379,11 +357,11 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)
MidiInPort* iport = *i;
Port dst = iport->alsaPort();
- if (equal(dst, rd)) {
+ if (dst == rd) {
Route r(rs, Route::MIDIPORT);
if (iport->inRoutes()->indexOf(r) == -1) {
- snd_seq_addr_t* adr = new snd_seq_addr_t(ev->sender);
- iport->inRoutes()->push_back(Route(Port(adr), -1, Route::MIDIPORT));
+ Port port(ev->sender.client, ev->sender.port);
+ iport->inRoutes()->push_back(Route(port, -1, Route::MIDIPORT));
}
break;
}
@@ -397,18 +375,18 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)
void AlsaMidi::removeConnection(snd_seq_connect_t* ev)
{
- Port rs = Port(&ev->sender);
- Port rd = Port(&ev->dest);
+ Port rs(ev->sender.client, ev->sender.port);
+ Port rd(ev->dest.client, ev->dest.port);
MidiInPortList* ipl = song->midiInPorts();
for (iMidiInPort i = ipl->begin(); i != ipl->end(); ++i) {
MidiInPort* iport = *i;
Port dst = iport->alsaPort();
- if (equal(dst, rd)) {
+ if (dst == rd) {
RouteList* irl = iport->outRoutes();
for (iRoute r = irl->begin(); r != irl->end(); ++r) {
- if (!r->disconnected && equal(r->port, rs)) {
+ if (!r->disconnected && (r->port == rs)) {
iport->inRoutes()->erase(r);
break;
}
@@ -422,10 +400,10 @@ void AlsaMidi::removeConnection(snd_seq_connect_t* ev)
MidiOutPort* oport = *i;
Port src = oport->alsaPort();
- if (equal(src, rs)) {
+ if (src == rs) {
RouteList* orl = oport->outRoutes();
for (iRoute r = orl->begin(); r != orl->end(); ++r) {
- if (!r->disconnected && equal(r->port, rd)) {
+ if (!r->disconnected && (r->port == rd)) {
orl->erase(r);
break;
}
@@ -509,11 +487,12 @@ void AlsaMidi::read(MidiSeq* seq)
case SND_SEQ_EVENT_PITCHBEND:
case SND_SEQ_EVENT_CONTROLLER:
{
- Port port = &ev->dest;
+ Port port(ev->dest.client, ev->dest.port);
+
MidiInPortList* mpl = song->midiInPorts();
for (iMidiInPort i = mpl->begin(); i != mpl->end(); ++i) {
MidiInPort* inPort = *i;
- if (equal(port, inPort->alsaPort())) {
+ if (port == inPort->alsaPort()) {
inPort->eventReceived(ev);
}
}
@@ -592,7 +571,7 @@ void AlsaMidi::putEvent(Port p, const MidiEvent& e)
snd_seq_event_t event;
memset(&event, 0, sizeof(event));
snd_seq_ev_set_direct(&event);
- snd_seq_ev_set_source(&event, ((snd_seq_addr_t*)p)->port);
+ snd_seq_ev_set_source(&event, p.alsaPort());
snd_seq_ev_set_dest(&event, SND_SEQ_ADDRESS_SUBSCRIBERS, 0);
switch(e.type()) {
diff --git a/muse/muse/driver/alsamidi.h b/muse/muse/driver/alsamidi.h
index b68c4783..9c59f5dc 100644
--- a/muse/muse/driver/alsamidi.h
+++ b/muse/muse/driver/alsamidi.h
@@ -21,16 +21,12 @@
#ifndef __ALSAMIDI_H__
#define __ALSAMIDI_H__
-// #include <config.h>
#include <alsa/asoundlib.h>
-
#include "driver.h"
class MidiSeq;
class MidiEvent;
-typedef snd_seq_addr_t* AlsaPort;
-
//---------------------------------------------------------
// AlsaMidi
//---------------------------------------------------------
@@ -55,7 +51,6 @@ class AlsaMidi : public Driver {
virtual void setPortName(Port p, const QString& n);
virtual QString portName(Port);
virtual Port findPort(const QString& name);
- virtual bool equal(Port, Port);
virtual bool connect(Port, Port);
virtual bool disconnect(Port, Port);
diff --git a/muse/muse/driver/driver.h b/muse/muse/driver/driver.h
index d7147b52..a165cea0 100644
--- a/muse/muse/driver/driver.h
+++ b/muse/muse/driver/driver.h
@@ -21,7 +21,8 @@
#ifndef __DRIVER_H__
#define __DRIVER_H__
-typedef void* Port;
+#include <jack/midiport.h>
+#include "port.h"
struct PortName {
Port port;
@@ -55,7 +56,6 @@ class Driver {
virtual bool connect(Port, Port) = 0;
virtual bool disconnect(Port, Port) = 0;
- virtual bool equal(Port, Port) = 0;
virtual void putEvent(Port, const MidiEvent&) = 0;
};
diff --git a/muse/muse/driver/dummyaudio.cpp b/muse/muse/driver/dummyaudio.cpp
index 7550cc61..796e8b58 100644
--- a/muse/muse/driver/dummyaudio.cpp
+++ b/muse/muse/driver/dummyaudio.cpp
@@ -58,7 +58,7 @@ class DummyAudio : public AudioDriver {
return lrint((curTime()-startTime) * AL::sampleRate);
}
- virtual float* getBuffer(void* /*port*/, unsigned long nframes)
+ virtual float* getBuffer(Port /*port*/, unsigned long nframes)
{
if (nframes > dummyFrames) {
fprintf(stderr, "error: segment size > %d\n", dummyFrames);
@@ -73,58 +73,60 @@ class DummyAudio : public AudioDriver {
virtual void registerClient() {}
- virtual void* registerOutPort(const QString& s, bool) {
+ virtual Port registerOutPort(const QString& s, bool) {
iPorts.push_back(QString(s));
- return (void*)(iPorts.size() + 3000);
+ Port port(0, iPorts.size() + 3000);
+ return port;
}
- virtual void* registerInPort(const QString& s, bool) {
+ virtual Port registerInPort(const QString& s, bool) {
oPorts.push_back(QString(s));
- return (void*)(oPorts.size() + 4000);
+ Port port(0, oPorts.size() + 40);
+ return port;
}
- virtual void unregisterPort(void*) {
+ virtual void unregisterPort(Port) {
/* if (long(p) >= 100)
- oPorts.erase(oPorts.begin() + (long(p)-4000));
+ oPorts.erase(oPorts.begin() + (long(p)-40));
else
- iPorts.erase(iPorts.begin() + long(p)-3000);
+ iPorts.erase(iPorts.begin() + long(p)-30);
*/
}
- virtual bool connect(void*, void*) { return true; }
- virtual bool disconnect(void*, void*) { return true; }
- virtual void setPortName(void*, const QString&) {}
- virtual void* findPort(const QString& s) {
+ virtual bool connect(Port, Port) { return true; }
+ virtual bool disconnect(Port, Port) { return true; }
+ virtual void setPortName(Port, const QString&) {}
+ virtual Port findPort(const QString& s) {
if (s == "input1")
- return (void*)1000;
+ return Port(0, 10);
if (s == "input2")
- return (void*)1001;
+ return Port(0, 11);
if (s == "output1")
- return (void*)2000;
+ return Port(0, 20);
if (s == "output2")
- return (void*)2001;
+ return Port(0, 21);
int k = 0;
for (std::vector<QString>::const_iterator i = iPorts.begin(); i != iPorts.end(); ++i, ++k) {
if (s == *i)
- return (void*)(3000+k);
+ return Port(0, 30+k);
}
k = 0;
for (std::vector<QString>::const_iterator i = oPorts.begin(); i != oPorts.end(); ++i, ++k) {
if (s == *i)
- return (void*)(4000+k);
+ return Port(0, 40);
}
- return 0;
+ return Port();
}
- virtual QString portName(void* p) {
- if (long(p) == 1000)
+ virtual QString portName(Port port) {
+ if (port.alsaPort() == 10)
return QString("input1");
- if (long(p) == 1001)
+ if (port.alsaPort() == 11)
return QString("input2");
- if (long(p) == 2000)
+ if (port.alsaPort() == 20)
return QString("output1");
- if (long(p) == 2001)
+ if (port.alsaPort() == 21)
return QString("output2");
- if (long(p) >= 4000)
- return QString(oPorts[long(p)-4000]);
+ if (port.alsaPort() >= 40)
+ return QString(oPorts[port.alsaPort() - 40]);
else
- return QString(iPorts[long(p)-3000]);
+ return QString(iPorts[port.alsaPort() - 30]);
}
virtual unsigned getCurFrame() { return pos; }
virtual int realtimePriority() const { return 40; }
@@ -139,9 +141,6 @@ class DummyAudio : public AudioDriver {
pos = n;
}
virtual void setFreewheel(bool) {}
- virtual bool equal(Port a, Port b) {
- return a == b;
- }
virtual void putEvent(Port, const MidiEvent&) {}
};
@@ -168,10 +167,10 @@ QList<PortName> DummyAudio::outputPorts(bool midi)
if (!midi) {
PortName p1;
p1.name = QString("output1");
- p1.port = (void*)100;
+ p1.port = Port(0, 100);
PortName p2;
p2.name = QString("output2");
- p2.port = (void*)101;
+ p2.port = Port(0, 101);
clientList.append(p1);
clientList.append(p2);
}
@@ -188,10 +187,10 @@ QList<PortName> DummyAudio::inputPorts(bool midi)
if (!midi) {
PortName p1;
p1.name = QString("input1");
- p1.port = (void*)0;
+ p1.port = Port(0, 0);
PortName p2;
p2.name = QString("input2");
- p2.port = (void*)1;
+ p2.port = Port(0, 1);
clientList.append(p1);
clientList.append(p2);
}
diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp
index e939046d..b90958f0 100644
--- a/muse/muse/driver/jack.cpp
+++ b/muse/muse/driver/jack.cpp
@@ -322,7 +322,7 @@ void JackAudio::graphChanged()
RouteList* irl = it->inRoutes();
for (int channel = 0; channel < channels; ++channel) {
- jack_port_t* port = (jack_port_t*)(it->jackPort(channel));
+ jack_port_t* port = it->jackPort(channel).jackPort();
if (port == 0)
continue;
const char** ports = jack_port_get_all_connections(_client, port);
@@ -334,7 +334,7 @@ void JackAudio::graphChanged()
foreach (Route r, *irl) {
if (r.channel != channel)
continue;
- const char* name = jack_port_name((jack_port_t*)r.port);
+ const char* name = jack_port_name(r.port.jackPort());
bool found = false;
for (const char** pn = ports; pn && *pn; ++pn) {
if (strcmp(*pn, name) == 0) {
@@ -360,7 +360,7 @@ void JackAudio::graphChanged()
foreach(Route r, *irl) {
if (r.channel != channel)
continue;
- const char* name = jack_port_name((jack_port_t*)r.port);
+ const char* name = jack_port_name(r.port.jackPort());
if (strcmp(*pn, name) == 0) {
found = true;
break;
@@ -368,7 +368,7 @@ void JackAudio::graphChanged()
}
if (!found) {
RouteRoute a;
- Port port = jack_port_by_name(_client, *pn);
+ Port port(jack_port_by_name(_client, *pn));
a.src = Route(port, channel, Route::AUDIOPORT);
a.dst = Route(it, channel);
ra.append(a);
@@ -395,7 +395,7 @@ void JackAudio::graphChanged()
AudioOutput* it = *ii;
int channels = it->channels();
for (int channel = 0; channel < channels; ++channel) {
- jack_port_t* port = (jack_port_t*)(it->jackPort(channel));
+ jack_port_t* port = it->jackPort(channel).jackPort();
if (port == 0)
continue;
const char** ports = jack_port_get_all_connections(_client, port);
@@ -408,7 +408,7 @@ void JackAudio::graphChanged()
foreach(Route r, *rl) {
if (r.channel != channel)
continue;
- const char* name = jack_port_name((jack_port_t*)r.port);
+ const char* name = jack_port_name(r.port.jackPort());
bool found = false;
const char** pn = ports;
while (pn && *pn) {
@@ -437,7 +437,7 @@ void JackAudio::graphChanged()
for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) {
if (irl->channel != channel)
continue;
- const char* name = jack_port_name((jack_port_t*)irl->port);
+ const char* name = jack_port_name(irl->port.jackPort());
if (strcmp(*pn, name) == 0) {
found = true;
break;
@@ -446,7 +446,7 @@ void JackAudio::graphChanged()
if (!found) {
RouteRoute a;
a.src = Route(it, channel);
- Port port = jack_port_by_name(_client, *pn);
+ Port port(jack_port_by_name(_client, *pn));
a.dst = Route(port, channel, Route::AUDIOPORT);
ra.append(a);
}
@@ -495,8 +495,10 @@ void JackAudio::registerClient()
Port JackAudio::registerInPort(const QString& name, bool midi)
{
const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
- void* p = jack_port_register(_client, name.toLatin1().data(), type, JackPortIsInput, 0);
-// printf("JACK: registerInPort<%s>: <%s> %p\n", type, name.toLatin1().data(), p);
+ Port p(jack_port_register(_client, name.toLatin1().data(), type, JackPortIsInput, 0));
+// printf("JACK: registerInPort<%s>: <%s> %p\n", type, name.toLatin1().data(), p.jackPort());
+ if (!p.jackPort())
+ p.setZero();
return p;
}
@@ -507,12 +509,14 @@ Port JackAudio::registerInPort(const QString& name, bool midi)
Port JackAudio::registerOutPort(const QString& name, bool midi)
{
const char* type = midi ? JACK_DEFAULT_MIDI_TYPE : JACK_DEFAULT_AUDIO_TYPE;
- void* p = jack_port_register(_client, name.toLatin1().data(), type, JackPortIsOutput, 0);
-// printf("JACK: registerOutPort<%s>: <%s> %p\n", type, name.toLatin1().data(), p);
+ Port p(jack_port_register(_client, name.toLatin1().data(), type, JackPortIsOutput, 0));
+// printf("JACK: registerOutPort<%s>: <%s> %p\n", type, name.toLatin1().data(), p.jackPort());
if (midi) {
jack_nframes_t nframes = jack_get_buffer_size(_client);
- jack_midi_reset_new_port(jack_port_get_buffer((jack_port_t*)p, nframes), nframes);
+ jack_midi_reset_new_port(jack_port_get_buffer(p.jackPort(), nframes), nframes);
}
+ if (!p.jackPort())
+ p.setZero();
return p;
}
@@ -533,12 +537,12 @@ void exitJackAudio()
bool JackAudio::connect(Port src, Port dst)
{
- if (src == 0 || dst == 0) {
+ if (src.isZero() || dst.isZero()) {
fprintf(stderr, "JackAudio::connect(1): unknown jack ports\n");
return false;
}
- const char* sn = jack_port_name((jack_port_t*) src);
- const char* dn = jack_port_name((jack_port_t*) dst);
+ const char* sn = jack_port_name(src.jackPort());
+ const char* dn = jack_port_name(dst.jackPort());
// printf("jack connect <%s>%p - <%s>%p\n", sn, src, dn, dst);
@@ -553,10 +557,10 @@ bool JackAudio::connect(Port src, Port dst)
if (rv == EEXIST)
fprintf(stderr, " connection already made\n");
else {
- int pf = jack_port_flags((jack_port_t*)src);
+ int pf = jack_port_flags(src.jackPort());
if (!(pf & JackPortIsOutput))
fprintf(stderr, " src is not an output port\n");
- pf = jack_port_flags((jack_port_t*)dst);
+ pf = jack_port_flags(dst.jackPort());
if (!(pf & JackPortIsInput))
fprintf(stderr, " dst is not an input port\n");
}
@@ -571,8 +575,8 @@ bool JackAudio::connect(Port src, Port dst)
bool JackAudio::disconnect(Port src, Port dst)
{
- const char* sn = jack_port_name((jack_port_t*) src);
- const char* dn = jack_port_name((jack_port_t*) dst);
+ const char* sn = jack_port_name(src.jackPort());
+ const char* dn = jack_port_name(dst.jackPort());
// printf("jack disconnect <%s>%p - <%s>%p\n", sn, src, dn, dst);
@@ -629,7 +633,7 @@ QList<PortName> JackAudio::outputPorts(bool midi)
continue;
PortName pn;
pn.name = QString(buffer);
- pn.port = port;
+ pn.port = Port(port);
clientList.append(pn);
}
return clientList;
@@ -652,7 +656,7 @@ QList<PortName> JackAudio::inputPorts(bool midi)
continue;
PortName pn;
pn.name = QString(buffer);
- pn.port = port;
+ pn.port = Port(port);
clientList.append(pn);
}
return clientList;
@@ -662,9 +666,9 @@ QList<PortName> JackAudio::inputPorts(bool midi)
// portName
//---------------------------------------------------------
-QString JackAudio::portName(void* port)
+QString JackAudio::portName(Port port)
{
- const char *nameStrPtr = jack_port_name((jack_port_t*)port);
+ const char* nameStrPtr = jack_port_name(port.jackPort());
QString s(nameStrPtr);
return s;
}
@@ -677,8 +681,8 @@ void JackAudio::unregisterPort(Port p)
{
if (_client) {
// printf("JACK: unregister Port %p\n", p);
- if (jack_port_unregister(_client, (jack_port_t*)p))
- fprintf(stderr, "jack unregister port %p failed\n", p);
+ if (jack_port_unregister(_client, p.jackPort()))
+ fprintf(stderr, "jack unregister port %p failed\n", p.jackPort());
}
}
@@ -729,7 +733,7 @@ void JackAudio::seekTransport(unsigned frame)
Port JackAudio::findPort(const QString& name)
{
- void* p = jack_port_by_name(_client, name.toLatin1().data());
+ Port p(jack_port_by_name(_client, name.toLatin1().data()));
// printf("Jack::findPort <%s>, %p\n", name.toLatin1().data(), p);
return p;
}
@@ -818,7 +822,7 @@ void JackAudio::putEvent(Port port, const MidiEvent& e)
printf("MidiOut<%s>: jackMidi: ", portName(port).toLatin1().data());
e.dump();
}
- void* pb = jack_port_get_buffer((jack_port_t*)port, segmentSize);
+ void* pb = jack_port_get_buffer(port.jackPort(), segmentSize);
unsigned ft;
if (transportState == JackTransportRolling) {
ft = e.time() - pos.frame;
@@ -868,7 +872,7 @@ void JackAudio::putEvent(Port port, const MidiEvent& e)
void JackAudio::startMidiCycle(Port port)
{
- void* port_buf = jack_port_get_buffer((jack_port_t*)port, segmentSize);
+ void* port_buf = jack_port_get_buffer(port.jackPort(), segmentSize);
jack_midi_clear_buffer(port_buf, segmentSize);
}
diff --git a/muse/muse/driver/jackaudio.h b/muse/muse/driver/jackaudio.h
index e350ca0a..43da338b 100644
--- a/muse/muse/driver/jackaudio.h
+++ b/muse/muse/driver/jackaudio.h
@@ -21,8 +21,6 @@
#ifndef __JACKAUDIO_H__
#define __JACKAUDIO_H__
-#include <jack/jack.h>
-#include <jack/midiport.h>
#include "audiodev.h"
//---------------------------------------------------------
@@ -46,7 +44,7 @@ class JackAudio : public AudioDriver {
virtual void stop ();
virtual void zeroClientPtr() { _client = 0; }
virtual float* getBuffer(Port port, unsigned long nframes) {
- return (float*)jack_port_get_buffer((jack_port_t*)port, nframes);
+ return (float*)jack_port_get_buffer(port.jackPort(), nframes);
}
virtual QList<PortName> outputPorts(bool midi);
@@ -63,7 +61,7 @@ class JackAudio : public AudioDriver {
virtual bool connect(Port, Port);
virtual bool disconnect(Port, Port);
virtual void setPortName(Port p, const QString& n) {
- jack_port_set_name((jack_port_t*)p, n.toLatin1().data());
+ jack_port_set_name(p.jackPort(), n.toLatin1().data());
}
virtual Port findPort(const QString& name);
virtual QString portName(Port);
@@ -77,7 +75,6 @@ class JackAudio : public AudioDriver {
return jack_transport_query(_client, pos);
}
void graphChanged();
- virtual bool equal(Port a, Port b) { return a == b; }
virtual void putEvent(Port, const MidiEvent&);
virtual void startMidiCycle(Port);
virtual unsigned int getCurFrame() { return pos.frame; }
diff --git a/muse/muse/driver/port.h b/muse/muse/driver/port.h
new file mode 100644
index 00000000..7386a7f3
--- /dev/null
+++ b/muse/muse/driver/port.h
@@ -0,0 +1,64 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#ifndef __PORT_H__
+#define __PORT_H__
+
+#include <jack/jack.h>
+
+class Port {
+ enum { JACK_TYPE, ALSA_TYPE, ZERO_TYPE } type;
+ union {
+ jack_port_t* _jackPort;
+ struct {
+ unsigned char _alsaPort;
+ unsigned char _alsaClient;
+ };
+ };
+ public:
+ Port() {
+ type = ZERO_TYPE;
+ }
+ Port(jack_port_t* p) {
+ _jackPort = p;
+ type = JACK_TYPE;
+ }
+ Port(unsigned char client, unsigned char port) {
+ _alsaPort = port;
+ _alsaClient = client;
+ type = ALSA_TYPE;
+ }
+ void setZero() { type = ZERO_TYPE; }
+ bool isZero() const { return type == ZERO_TYPE; }
+ bool operator==(const Port& p) const {
+ if (type == JACK_TYPE)
+ return _jackPort == p._jackPort;
+ else if (type == ALSA_TYPE)
+ return _alsaPort == p._alsaPort && _alsaClient == p._alsaClient;
+ else
+ return true;
+ }
+ unsigned char alsaPort() const { return _alsaPort; }
+ unsigned char alsaClient() const { return _alsaClient; }
+ jack_port_t* jackPort() const { return _jackPort; }
+ };
+
+#endif
+
diff --git a/muse/muse/fifo.h b/muse/muse/fifo.h
index e719d813..b4c49288 100644
--- a/muse/muse/fifo.h
+++ b/muse/muse/fifo.h
@@ -18,11 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
-#ifndef __AUDIONODE_H__
-#define __AUDIONODE_H__
-
-class Pipeline;
-class SndFile;
+#ifndef __FIFO_H__
+#define __FIFO_H__
const int FIFO_BUFFER = 256;
diff --git a/muse/muse/importmidi.cpp b/muse/muse/importmidi.cpp
index 09d5a11f..80dfa9fd 100644
--- a/muse/muse/importmidi.cpp
+++ b/muse/muse/importmidi.cpp
@@ -40,6 +40,7 @@
#include "arranger/arranger.h"
#include "midictrl.h"
#include "midichannel.h"
+#include "midiinport.h"
#include "midioutport.h"
//---------------------------------------------------------
diff --git a/muse/muse/midiinport.cpp b/muse/muse/midiinport.cpp
index 25a2faee..6fc3288c 100644
--- a/muse/muse/midiinport.cpp
+++ b/muse/muse/midiinport.cpp
@@ -53,9 +53,9 @@ MidiInPort::~MidiInPort()
void MidiInPort::setName(const QString& s)
{
Track::setName(s);
- if (alsaPort(0))
+ if (!alsaPort(0).isZero())
midiDriver->setPortName(alsaPort(), s);
- if (jackPort(0))
+ if (!jackPort(0).isZero())
audioDriver->setPortName(jackPort(), s);
}
diff --git a/muse/muse/midioutport.cpp b/muse/muse/midioutport.cpp
index 9fadaa71..bc3b7968 100644
--- a/muse/muse/midioutport.cpp
+++ b/muse/muse/midioutport.cpp
@@ -73,9 +73,9 @@ MidiOutPort::~MidiOutPort()
void MidiOutPort::setName(const QString& s)
{
Track::setName(s);
- if (alsaPort())
+ if (!alsaPort().isZero())
midiDriver->setPortName(alsaPort(), s);
- if (jackPort())
+ if (!jackPort().isZero())
audioDriver->setPortName(jackPort(), s);
for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
_channel[ch]->setDefaultName();
diff --git a/muse/muse/plugin.cpp b/muse/muse/plugin.cpp
index 6cd28e62..5f7b128e 100644
--- a/muse/muse/plugin.cpp
+++ b/muse/muse/plugin.cpp
@@ -167,8 +167,10 @@ PluginI::PluginI(AudioTrack* t)
PluginI::~PluginI()
{
- if (_plugin)
+ if (_plugin) {
deactivate();
+ _plugin->incInstances(-1);
+ }
if (_gui)
delete _gui;
if (pif) {
diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp
index 22b6b3f1..8748f009 100644
--- a/muse/muse/route.cpp
+++ b/muse/muse/route.cpp
@@ -280,6 +280,15 @@ void Song::readRoute(QDomNode n)
else
printf("MusE:readRoute: unknown tag %s\n", e.tagName().toLatin1().data());
}
+ if (!s.isValid()) { // source port not found
+ printf("invalid source port\n");
+ return;
+ }
+ if (!d.isValid()) { // destination port not found
+ printf("invalid destination port\n");
+ return;
+ }
+
if (s.type == Route::AUDIOPORT)
s.channel = d.channel;
if (d.type == Route::AUDIOPORT)
@@ -314,11 +323,10 @@ bool Route::operator==(const Route& a) const
case SYNTIPORT:
return channel == a.channel && track == a.track;
case MIDIPORT:
- return midiDriver->equal(port, a.port);
case JACKMIDIPORT:
- return audioDriver->equal(port, a.port);
+ return port == a.port;
case AUDIOPORT:
- return channel == a.channel && audioDriver->equal(port, a.port);
+ return (channel == a.channel) && (port == a.port);
case AUXPLUGIN:
return plugin == a.plugin;
}
@@ -410,20 +418,20 @@ void Route::read(QDomNode node)
else if (st == "AUDIOPORT") {
type = Route::AUDIOPORT;
port = audioDriver->findPort(s);
- if (port == 0)
- printf("Route::read(): audioport not found\n");
+ if (port.isZero())
+ printf("Route::read(): audioport <%s> not found\n", s.toLatin1().data());
}
else if (st == "JACKMIDIPORT") {
type = Route::JACKMIDIPORT;
port = audioDriver->findPort(s);
- if (port == 0)
- printf("Route::read(): jack midiport not found\n");
+ if (port.isZero())
+ printf("Route::read(): jack midiport <%s> not found\n", s.toLatin1().data());
}
else if (st == "MIDIPORT") {
type = Route::MIDIPORT;
port = midiDriver->findPort(s);
- if (port == 0)
- printf("Route::read(): midiport not found\n");
+ if (port.isZero())
+ printf("Route::read(): midiport <%s> not found\n", s.toLatin1().data());
}
else if (st == "SYNTIPORT") {
type = Route::SYNTIPORT;
diff --git a/muse/muse/route.h b/muse/muse/route.h
index 5d17c5c0..70ed536b 100644
--- a/muse/muse/route.h
+++ b/muse/muse/route.h
@@ -29,8 +29,7 @@ namespace AL {
};
using AL::Xml;
-
-typedef void* Port;
+#include "driver/driver.h"
// Routing Types:
//
@@ -61,9 +60,9 @@ struct Route {
enum RouteType { TRACK, AUDIOPORT, MIDIPORT, JACKMIDIPORT,
SYNTIPORT, AUXPLUGIN};
+ Port port;
union {
Track* track;
- Port port;
AuxPluginIF* plugin;
};
int channel; // route to/from JACK can specify a channel to connect to
@@ -79,6 +78,14 @@ struct Route {
Route(Track*, int, RouteType t = TRACK);
Route(AuxPluginIF*);
+ bool isPortType() const {
+ return type==AUDIOPORT || type == MIDIPORT || type == JACKMIDIPORT;
+ }
+ bool isValid() const {
+ return (isPortType() && !port.isZero())
+ || ((type == TRACK || type == SYNTIPORT) && track)
+ || ((type == AUXPLUGIN) && plugin);
+ }
QString name() const;
void read(QDomNode node);
void write(Xml&, const char* name) const;
diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp
index d3a5cd4c..c21080ff 100644
--- a/muse/muse/seqmsg.cpp
+++ b/muse/muse/seqmsg.cpp
@@ -208,12 +208,12 @@ void Audio::msgSetChannels(AudioTrack* node, int n)
if (node->type() == Track::AUDIO_INPUT) {
AudioInput* ai = (AudioInput*)node;
for (int i = 0; i < mc; ++i) {
- if (i < n && ai->jackPort(i) == 0) {
+ if (i < n && ai->jackPort(i).isZero()) {
char buffer[128];
snprintf(buffer, 128, "%s-%d", name.toLatin1().data(), i);
ai->setJackPort(audioDriver->registerInPort(QString(buffer), false), i);
}
- else if ((i >= n) && ai->jackPort(i)) {
+ else if ((i >= n) && ai->jackPort(i).isZero()) {
RouteList* ir = node->inRoutes();
for (iRoute ii = ir->begin(); ii != ir->end(); ++ii) {
Route r = *ii;
@@ -223,14 +223,14 @@ void Audio::msgSetChannels(AudioTrack* node, int n)
}
}
audioDriver->unregisterPort(ai->jackPort(i));
- ai->setJackPort(0, i);
+ ai->setJackPort(Port(), i);
}
}
}
else if (node->type() == Track::AUDIO_OUTPUT) {
AudioOutput* ao = (AudioOutput*)node;
for (int i = 0; i < mc; ++i) {
- void* jp = ao->jackPort(i);
+ void* jp = ao->jackPort(i).jackPort();
if (i < n && jp == 0) {
char buffer[128];
snprintf(buffer, 128, "%s-%d", name.toLatin1().data(), i);
@@ -245,8 +245,8 @@ void Audio::msgSetChannels(AudioTrack* node, int n)
break;
}
}
- audioDriver->unregisterPort(jp);
- ao->setJackPort(0, i);
+ audioDriver->unregisterPort(ao->jackPort(i));
+ ao->setJackPort(Port(), i);
}
}
}
diff --git a/muse/muse/synth.h b/muse/muse/synth.h
index 6ce90f95..f538842d 100644
--- a/muse/muse/synth.h
+++ b/muse/muse/synth.h
@@ -136,7 +136,7 @@ class SynthI : public AudioTrack, public MidiInstrument
public:
SynthI();
virtual ~SynthI();
- SynthI* clone() const { return 0; }
+// SynthI* clone() const { return 0; }
SynthIF* sif() const { return _sif; }
bool initInstance(Synth* s);
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index bcb3ff3c..f2937450 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -113,8 +113,6 @@ void Track::init()
_meter[i] = 0.0f;
_peak[i] = 0.0f;
_peakTimer[i] = 0;
- _alsaPort[i] = 0;
- _jackPort[i] = 0;
}
}
@@ -136,10 +134,14 @@ Track::Track(Track::TrackType t)
Track::~Track()
{
delete _parts;
- if (_alsaPort)
- midiDriver->unregisterPort(_alsaPort);
- if (_jackPort)
- audioDriver->unregisterPort(_jackPort);
+
+ for (int i = 0; i < MAX_CHANNELS; ++i) {
+ if (!_alsaPort[i].isZero())
+ midiDriver->unregisterPort(_alsaPort[i]);
+ if (!_jackPort[i].isZero())
+ audioDriver->unregisterPort(_jackPort[i]);
+ }
+
}
//---------------------------------------------------------
@@ -733,6 +735,8 @@ MidiTrackBase::MidiTrackBase(TrackType t)
MidiTrackBase::~MidiTrackBase()
{
+ foreach(MidiPluginI* plugin, *_pipeline)
+ delete plugin;
delete _pipeline;
}
@@ -977,9 +981,9 @@ void Track::resetAllMeter()
void Track::activate1()
{
if (isMidiTrack()) {
- if (alsaPort(0))
+ if (!alsaPort(0).isZero())
printf("Track::activate1() midi: alsa port already active!\n");
- if (jackPort(0))
+ if (!jackPort(0).isZero())
printf("Track::activate1() midi: jack port already active!\n");
if (type() == MIDI_OUT) {
_alsaPort[0] = midiDriver->registerInPort(_name, true);
@@ -993,7 +997,7 @@ void Track::activate1()
}
for (int i = 0; i < channels(); ++i) {
- if (jackPort(i))
+ if (!jackPort(i).isZero())
printf("Track::activate1(): already active!\n");
else {
QString s(QString("%1-%2").arg(_name).arg(i));
@@ -1087,11 +1091,11 @@ void Track::deactivate()
}
}
for (int i = 0; i < channels(); ++i) {
- if (_jackPort[i]) {
+ if (!_jackPort[i].isZero()) {
audioDriver->unregisterPort(_jackPort[i]);
_jackPort[i] = 0;
}
- if (_alsaPort[i]) {
+ if (!_alsaPort[i].isZero()) {
midiDriver->unregisterPort(_alsaPort[i]);
_alsaPort[i] = 0;
}
diff --git a/muse/muse/track.h b/muse/muse/track.h
index 0dcc3410..f3f28d18 100644
--- a/muse/muse/track.h
+++ b/muse/muse/track.h
@@ -21,6 +21,7 @@
#ifndef __TRACK_H__
#define __TRACK_H__
+#include "driver/port.h"
#include "al/pos.h"
#include "route.h"
#include "ctrl.h"
@@ -35,8 +36,6 @@ namespace AL {
using AL::Xml;
using AL::TType;
-typedef void* Port;
-
class DrumMap;
class MidiPipeline;
class MidiEvent;