summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-11-08 21:07:52 +0000
committerWerner Schweer <ws.seh.de>2006-11-08 21:07:52 +0000
commitea940433ee14640d2782350cc19b9742ee0e8522 (patch)
tree626e20e652f0311dc1b9ca1a4d39a06f11b4783f
parent17e8df8ee420ef52b0cb0ac20ac25f679f22fb3c (diff)
update last updates
-rw-r--r--muse/muse/driver/jack.cpp3
-rw-r--r--muse/muse/midififo.cpp1
-rw-r--r--muse/muse/midiout.cpp10
-rw-r--r--muse/muse/midiout.h1
-rw-r--r--muse/muse/miditrack.cpp21
-rw-r--r--muse/muse/mixer/astrip.cpp35
-rw-r--r--muse/muse/mixer/mstrip.cpp4
-rw-r--r--muse/muse/route.cpp27
-rw-r--r--muse/muse/song.cpp2
-rw-r--r--muse/muse/track.cpp8
10 files changed, 66 insertions, 46 deletions
diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp
index 24525d1c..96a2da64 100644
--- a/muse/muse/driver/jack.cpp
+++ b/muse/muse/driver/jack.cpp
@@ -540,7 +540,8 @@ void exitJackAudio()
bool JackAudio::connect(Port src, Port dst)
{
if (src.isZero() || dst.isZero()) {
- fprintf(stderr, "JackAudio::connect(1): unknown jack ports\n");
+ fprintf(stderr, "JackAudio::connect(1): unknown jack ports (%d-%d)\n",
+ src.isZero(), dst.isZero());
return false;
}
const char* sn = jack_port_name(src.jackPort());
diff --git a/muse/muse/midififo.cpp b/muse/muse/midififo.cpp
index 4bb43346..51b6fd3a 100644
--- a/muse/muse/midififo.cpp
+++ b/muse/muse/midififo.cpp
@@ -33,6 +33,7 @@ bool MidiFifo::put(const MidiEvent& event)
q_atomic_increment(&size);
return false;
}
+printf("fifo overflow size %d\n", size);
return true;
}
diff --git a/muse/muse/midiout.cpp b/muse/muse/midiout.cpp
index 79928cb7..e4edf5b1 100644
--- a/muse/muse/midiout.cpp
+++ b/muse/muse/midiout.cpp
@@ -30,6 +30,16 @@
static const unsigned char mmcDeferredPlayMsg[] = { 0x7f, 0x7f, 0x06, 0x03 };
//---------------------------------------------------------
+// MidiOut
+//---------------------------------------------------------
+
+MidiOut::MidiOut()
+ {
+ track = 0;
+ _instrument = 0;
+ }
+
+//---------------------------------------------------------
// sendGmOn
// send GM-On message to midi device and keep track
// of device state
diff --git a/muse/muse/midiout.h b/muse/muse/midiout.h
index 76835052..d521ff89 100644
--- a/muse/muse/midiout.h
+++ b/muse/muse/midiout.h
@@ -46,6 +46,7 @@ class MidiOut
MidiFifo eventFifo;
+ MidiOut();
void processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
unsigned fromFrame, unsigned toFrame);
MidiInstrument* instrument() { return _instrument; }
diff --git a/muse/muse/miditrack.cpp b/muse/muse/miditrack.cpp
index 43c627e1..9cc63c3e 100644
--- a/muse/muse/miditrack.cpp
+++ b/muse/muse/miditrack.cpp
@@ -36,8 +36,10 @@ MidiTrack::MidiTrack()
: MidiTrackBase()
{
init();
- _events = new EventList;
- recordPart = 0;
+ _events = new EventList;
+ recordPart = 0;
+ _drumMap = 0;
+ _useDrumMap = false;
}
MidiTrack::~MidiTrack()
@@ -139,7 +141,11 @@ void MidiTrack::read(QDomNode node)
void MidiTrack::playMidiEvent(MidiEvent* ev)
{
foreach (const Route& r, _outRoutes) {
- ((MidiOutPort*)r.dst.track)->playMidiEvent(ev);
+ Track* track = r.dst.track;
+ if (track->type() == MIDI_OUT)
+ ((MidiOutPort*)track)->playMidiEvent(ev);
+ else if (track->type() == AUDIO_SOFTSYNTH)
+ ((SynthI*)track)->playMidiEvent(ev);
}
}
@@ -480,7 +486,7 @@ void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
Part* part = p->second;
if (part->mute())
continue;
- DrumMap* dm = ((MidiTrack*)part->track())->drumMap();
+ DrumMap* dm = drumMap();
unsigned offset = _delay + part->tick();
if (offset > to)
@@ -653,7 +659,12 @@ MidiInstrument* MidiTrack::instrument() const
{
if (_outRoutes.isEmpty())
return genericMidiInstrument;
- return ((MidiOutPort*)_outRoutes[0].dst.track)->instrument();
+ Track* track = _outRoutes[0].dst.track;
+ if (track->type() == MIDI_OUT)
+ return ((MidiOutPort*)track)->instrument();
+ else if (track->type() == AUDIO_SOFTSYNTH)
+ return ((SynthI*)track)->instrument();
+ return 0;
}
//---------------------------------------------------------
diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp
index a7ef5037..4b712674 100644
--- a/muse/muse/mixer/astrip.cpp
+++ b/muse/muse/mixer/astrip.cpp
@@ -194,15 +194,11 @@ AudioStrip::AudioStrip(Mixer* m, AudioTrack* t, bool align)
QHBoxLayout* rBox = new QHBoxLayout(0);
- if (track->type() == Track::AUDIO_SOFTSYNTH) {
- rBox->addStretch(100);
- }
- else {
- iR = newInRouteButton();
- rBox->addWidget(iR);
- connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
- connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
- }
+ iR = newInRouteButton();
+ rBox->addWidget(iR);
+ connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
+ connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
+
oR = newOutRouteButton();
rBox->addWidget(oR);
connect(oR->menu(), SIGNAL(aboutToShow()), SLOT(oRouteShow()));
@@ -579,7 +575,9 @@ static void addSyntiPorts(AudioTrack* t, QMenu* lb, const RouteList& rl)
continue;
QAction* it = lb->addAction(track->name());
it->setCheckable(true);
- Route route = Route(RouteNode(t), RouteNode(track));
+ RouteNode a(t);
+ RouteNode b(track);
+ Route route = Route(b, a);
it->setData(QVariant::fromValue(route));
it->setChecked(rl.indexOf(route) != -1);
}
@@ -589,6 +587,9 @@ static void addSyntiPorts(AudioTrack* t, QMenu* lb, const RouteList& rl)
// iRouteShow
//---------------------------------------------------------
+extern void addMidiTracks(QMenu* menu, Track* track, int channel, bool input);
+extern void addMidiInPorts(QMenu* menu, Track* dtrack, int channel);
+
void AudioStrip::iRouteShow()
{
QMenu* pup = iR->menu();
@@ -607,7 +608,7 @@ void AudioStrip::iRouteShow()
foreach (PortName ip, ol) {
QAction* id = pup->addAction(ip.name);
id->setCheckable(true);
- RouteNode src(ip.port, i, RouteNode::AUDIOPORT);
+ RouteNode src(ip.port, -1, RouteNode::AUDIOPORT);
RouteNode dst(t, i, RouteNode::TRACK);
Route route = Route(src, dst);
id->setData(QVariant::fromValue(route));
@@ -631,6 +632,14 @@ void AudioStrip::iRouteShow()
addGroupPorts(t, pup, *irl);
addSyntiPorts(t, pup, *irl);
break;
+ case Track::AUDIO_SOFTSYNTH:
+ pup->addSeparator()->setText(tr("MidiChannel"));
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QMenu* m = pup->addMenu(QString("Channel %1").arg(ch+1));
+ addMidiTracks(m, track, ch, true);
+ addMidiInPorts(m, track, ch);
+ }
+ break;
}
}
@@ -659,8 +668,8 @@ void AudioStrip::oRouteShow()
foreach (PortName ip, ol) {
QAction* action = pup->addAction(ip.name);
action->setCheckable(true);
- RouteNode src(t);
- RouteNode dst(ip.port, i, RouteNode::AUDIOPORT);
+ RouteNode src(t, i, RouteNode::TRACK);
+ RouteNode dst(ip.port, -1, RouteNode::AUDIOPORT);
Route r = Route(src, dst);
action->setData(QVariant::fromValue(r));
action->setChecked(orl->indexOf(r) != -1);
diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp
index 5e728b75..d8f404d6 100644
--- a/muse/muse/mixer/mstrip.cpp
+++ b/muse/muse/mixer/mstrip.cpp
@@ -42,7 +42,7 @@ enum { KNOB_PAN, KNOB_CHOR_SEND, KNOB_VAR_SEND, KNOB_REV_SEND };
// Note: midi tracks do not have channels
//---------------------------------------------------------
-static void addMidiTracks(QMenu* menu, Track* track, int channel, bool input)
+void addMidiTracks(QMenu* menu, Track* track, int channel, bool input)
{
RouteList* rl = input ? track->inRoutes() : track->outRoutes();
RouteNode a(track, channel, RouteNode::TRACK);
@@ -64,7 +64,7 @@ static void addMidiTracks(QMenu* menu, Track* track, int channel, bool input)
// can only be added to input route lists
//---------------------------------------------------------
-static void addMidiInPorts(QMenu* menu, Track* dtrack, int channel)
+void addMidiInPorts(QMenu* menu, Track* dtrack, int channel)
{
RouteList* rl = dtrack->inRoutes();
RouteNode dst(dtrack, channel, RouteNode::TRACK);
diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp
index 4129b884..953defaf 100644
--- a/muse/muse/route.cpp
+++ b/muse/muse/route.cpp
@@ -87,7 +87,7 @@ RouteNode::RouteNode(Track* tr, int ch, RouteNodeType t)
bool addRoute(const Route& r)
{
-//printf("addRoute %s.%d:<%s> %s.%d:<%s>\n",
+// printf("addRoute %s.%d:<%s> %s.%d:<%s>\n",
// r.src.tname(), r.src.channel, r.src.name().toLatin1().data(),
// r.dst.tname(), r.dst.channel, r.dst.name().toLatin1().data());
@@ -355,25 +355,12 @@ const char* RouteNode::tname() const
void RouteNode::write(Xml& xml, const char* label) const
{
- switch (type) {
- case AUDIOPORT:
- case JACKMIDIPORT:
- case MIDIPORT:
- case AUXPLUGIN:
- xml.put("<%s type=\"%s\" name=\"%s\"/>",
- label, tname(), name().toUtf8().data());
- break;
- case TRACK:
- case SYNTIPORT:
- if (channel != -1)
- xml.put("<%s type=\"%s\" channel=\"%d\" name=\"%s\"/>",
- label, tname(), channel + 1, name().toUtf8().data());
- else
- xml.put("<%s type=\"%s\" name=\"%s\"/>",
- label, tname(), name().toUtf8().data());
-
- break;
- }
+ if (channel != -1)
+ xml.put("<%s type=\"%s\" channel=\"%d\" name=\"%s\"/>",
+ label, tname(), channel + 1, name().toUtf8().data());
+ else
+ xml.put("<%s type=\"%s\" name=\"%s\"/>",
+ label, tname(), name().toUtf8().data());
}
//---------------------------------------------------------
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index f14d4253..6af28976 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -165,7 +165,7 @@ bool Song::addEvent(Event& event, Part* part)
CVal val;
val.i = event.dataB();
if (!track->addControllerVal(cntrl, tick, val)) {
-//TODOA track->addMidiController(track->port()->instrument(), cntrl);
+ track->addMidiController(track->instrument(), cntrl);
if (!track->addControllerVal(cntrl, tick, val)) {
return false;
}
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index 2b4f0b79..425b32fb 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -980,7 +980,7 @@ void Track::activate2()
r.dst.disconnected = false;
}
else if (r.dst.type == RouteNode::AUDIOPORT) {
- audioDriver->connect(_jackPort[r.dst.channel], r.dst.port);
+ audioDriver->connect(_jackPort[r.src.channel], r.dst.port);
r.dst.disconnected = false;
}
else if (r.dst.type == RouteNode::MIDIPORT) {
@@ -994,7 +994,7 @@ void Track::activate2()
r.src.disconnected = false;
}
else if (r.src.type == RouteNode::AUDIOPORT) {
- audioDriver->connect(r.src.port, _jackPort[r.src.channel]);
+ audioDriver->connect(r.src.port, _jackPort[r.dst.channel]);
r.src.disconnected = false;
}
else if (r.src.type == RouteNode::MIDIPORT) {
@@ -1018,7 +1018,7 @@ void Track::deactivate()
audioDriver->disconnect(_jackPort[0], r.dst.port);
}
else if (r.dst.type == RouteNode::AUDIOPORT) {
- audioDriver->disconnect(_jackPort[r.dst.channel], r.dst.port);
+ audioDriver->disconnect(_jackPort[r.src.channel], r.dst.port);
r.dst.disconnected = true;
}
else if (r.dst.type == RouteNode::MIDIPORT) {
@@ -1033,7 +1033,7 @@ void Track::deactivate()
}
else if (r.src.type == RouteNode::AUDIOPORT) {
r.src.disconnected = true;
- audioDriver->disconnect(r.src.port, _jackPort[r.src.channel]);
+ audioDriver->disconnect(r.src.port, _jackPort[r.dst.channel]);
}
else if (r.src.type == RouteNode::MIDIPORT) {
r.src.disconnected = true;