diff options
-rw-r--r-- | muse/ChangeLog | 3 | ||||
-rw-r--r-- | muse/TODO | 9 | ||||
-rw-r--r-- | muse/muse/audio.h | 1 | ||||
-rw-r--r-- | muse/muse/midiedit/ecanvas.cpp | 3 | ||||
-rw-r--r-- | muse/muse/mixer/astrip.cpp | 14 | ||||
-rw-r--r-- | muse/muse/mixer/mstrip.cpp | 292 | ||||
-rw-r--r-- | muse/muse/mixer/mstrip.h | 1 | ||||
-rw-r--r-- | muse/muse/route.cpp | 4 | ||||
-rw-r--r-- | muse/muse/seqmsg.cpp | 13 | ||||
-rw-r--r-- | muse/muse/song.cpp | 12 | ||||
-rw-r--r-- | muse/muse/song.h | 1 | ||||
-rw-r--r-- | muse/muse/songfile.cpp | 15 |
12 files changed, 151 insertions, 217 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog index 721d3581..ec1564ee 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,6 @@ +5.11 (ws) + - simplified midi input routing + - added "Monitor" button to midi track mixer strip 31.10 (ws) - MESS: - remove useless QWidget parameter in instantiate() @@ -2,12 +2,9 @@ (29.10.2006) ---------------------------------------------------------------------------- - - change default: show MidiChannel in mixer, dont show MidiTrack - - Add "monitor" button to midi channel strip in mixer. - - change default: do not default to "automation read" when - creating new strips - BUGS + - make sure all track names are unique + ? updating the gui during midi recording is too slow; a new, faster implementation is needed @@ -16,7 +13,7 @@ BUGS - Do not allow switch track recording on/off during recording - - audio prefetching is not stable + ? audio prefetching is not stable - looping does not work sample accurate due to jack transport limitations; looping should be implemented internally to work diff --git a/muse/muse/audio.h b/muse/muse/audio.h index c6fef4c2..836c9321 100644 --- a/muse/muse/audio.h +++ b/muse/muse/audio.h @@ -230,6 +230,7 @@ class Audio { void msgPanic(); void sendMsg(AudioMsg*); bool sendMessage(AudioMsg* m, bool doUndo); + void msgRoute(bool add, Route, Route); void msgRemoveRoute(Route, Route); void msgRemoveRoute1(Route, Route); void msgAddRoute(Route, Route); diff --git a/muse/muse/midiedit/ecanvas.cpp b/muse/muse/midiedit/ecanvas.cpp index 3373805a..a2917c8b 100644 --- a/muse/muse/midiedit/ecanvas.cpp +++ b/muse/muse/midiedit/ecanvas.cpp @@ -168,7 +168,8 @@ void EventCanvas::songChanged(int flags) part = nevent->part; } emit selectionChanged(x, event, part); - setPart(*curPart, curPart->end()); + if (curPart) + setPart(*curPart, curPart->end()); widget()->update(); } diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp index 7462b575..5a29272d 100644 --- a/muse/muse/mixer/astrip.cpp +++ b/muse/muse/mixer/astrip.cpp @@ -738,11 +738,7 @@ void AudioStrip::iRoutePressed() else if (track->type() == Track::AUDIO_SOFTSYNTH) dstRoute.type = Route::SYNTIPORT; - if (n->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); - song->update(SC_ROUTE); + audio->msgRoute(n->isChecked(), srcRoute, dstRoute); } iR->setDown(false); // pup.exec() catches mouse release event } @@ -798,15 +794,9 @@ void AudioStrip::oRoutePressed() Route srcRoute(t); Route dstRoute = n->data().value<Route>(); -// if (track->type() == Track::AUDIO_SOFTSYNTH) -// srcRoute.type = Route::SYNTIPORT; if (track->type() == Track::AUDIO_OUTPUT) srcRoute.channel = dstRoute.channel; - if (n->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); - song->update(SC_ROUTE); + audio->msgRoute(n->isChecked(), srcRoute, dstRoute); } oR->setDown(false); // pup.exec() catches mouse release event } diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp index 19021ea1..5fa413d4 100644 --- a/muse/muse/mixer/mstrip.cpp +++ b/muse/muse/mixer/mstrip.cpp @@ -32,40 +32,17 @@ enum { KNOB_PAN, KNOB_CHOR_SEND, KNOB_VAR_SEND, KNOB_REV_SEND }; //--------------------------------------------------------- -// addSyntiPorts -//--------------------------------------------------------- - -static void addSyntiPorts(QMenu* menu, RouteList* r, int channel) - { - SynthIList* sl = song->syntis(); - for (iSynthI i = sl->begin(); i != sl->end(); ++i) { - MidiChannel* track = (*i)->channel(channel); - QAction* oa = menu->addAction(track->name()); - oa->setCheckable(true); - Route dst(track, channel, Route::TRACK); - oa->setData(QVariant::fromValue(dst)); - - for (iRoute ir = r->begin(); ir != r->end(); ++ir) { - if (*ir == dst) { - oa->setChecked(true); - break; - } - } - } - } - -//--------------------------------------------------------- // addMidiTracks //--------------------------------------------------------- -static void addMidiTracks(QMenu* menu, RouteList* r, int channel) +static void addMidiTracks(QMenu* menu, RouteList* r) { MidiTrackList* tl = song->midis(); for (iMidiTrack i = tl->begin();i != tl->end(); ++i) { MidiTrack* track = *i; QAction* action = menu->addAction(track->name()); action->setCheckable(true); - Route src(track, channel, Route::TRACK); + Route src(track); action->setData(QVariant::fromValue(src)); for (iRoute ir = r->begin(); ir != r->end(); ++ir) { @@ -81,36 +58,71 @@ static void addMidiTracks(QMenu* menu, RouteList* r, int channel) // addMidiOutPorts //--------------------------------------------------------- -static void addMidiOutPorts(QMenu* menu, RouteList* r, int channel) +static void addMidiOutPorts(QMenu* menu, RouteList* r) { MidiOutPortList* tl = song->midiOutPorts(); for (iMidiOutPort i = tl->begin();i != tl->end(); ++i) { - MidiChannel* track = (*i)->channel(channel); - QAction* action = menu->addAction(track->name()); - action->setCheckable(true); - Route src(track, -1, Route::TRACK); - action->setData(QVariant::fromValue(src)); - for (iRoute ir = r->begin(); ir != r->end(); ++ir) { - if (*ir == src) { - action->setChecked(true); - break; + MidiOutPort* op = *i; + QMenu* m = menu->addMenu(op->name()); + m->setSeparatorsCollapsible(false); + m->addSeparator()->setText(m->tr("Channels")); + for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { + MidiChannel* track = op->channel(channel); + QAction* action = m->addAction(track->name()); + action->setCheckable(true); + Route dst(track); + action->setData(QVariant::fromValue(dst)); + for (iRoute ir = r->begin(); ir != r->end(); ++ir) { + if (*ir == dst) { + action->setChecked(true); + break; + } + } + } + } + } + +//--------------------------------------------------------- +// addSyntiPorts +//--------------------------------------------------------- + +static void addSyntiPorts(QMenu* menu, RouteList* r) + { + SynthIList* sl = song->syntis(); + for (iSynthI i = sl->begin(); i != sl->end(); ++i) { + SynthI* sy = *i; + QMenu* m = menu->addMenu(sy->name()); + m->setSeparatorsCollapsible(false); + m->addSeparator()->setText(m->tr("Channels")); + for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { + MidiChannel* track = sy->channel(channel); + QAction* action = m->addAction(track->name()); + action->setCheckable(true); + Route dst(track); + action->setData(QVariant::fromValue(dst)); + for (iRoute ir = r->begin(); ir != r->end(); ++ir) { + if (*ir == dst) { + action->setChecked(true); + break; + } } } } } + //--------------------------------------------------------- // addMidiInPorts //--------------------------------------------------------- -static void addMidiInPorts(QMenu* menu, RouteList* r, int channel) +static void addMidiInPorts(QMenu* menu, RouteList* r) { MidiInPortList* tl = song->midiInPorts(); for (iMidiInPort i = tl->begin();i != tl->end(); ++i) { MidiInPort* track = *i; QAction* action = menu->addAction(track->name()); action->setCheckable(true); - Route src(track, channel, Route::TRACK); + Route src(track); action->setData(QVariant::fromValue(src)); for (iRoute ir = r->begin(); ir != r->end(); ++ir) { if (*ir == src) { @@ -447,21 +459,16 @@ void MidiChannelStrip::iRoutePressed() MidiChannel* t = (MidiChannel*)track; RouteList* irl = t->inRoutes(); - addMidiTracks(&pup, irl, -1); // add midi tracks to menu - addMidiInPorts(&pup, irl, -1); // add midi inputs to menu + addMidiTracks(&pup, irl); // add midi tracks to menu + addMidiInPorts(&pup, irl); // add midi inputs to menu if (pup.isEmpty()) return; QAction* n = pup.exec(QCursor::pos()); if (n) { Route srcRoute = n->data().value<Route>(); - Route dstRoute(track, -1, Route::TRACK); - - if (n->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); - song->update(SC_ROUTE); + Route dstRoute(track); + audio->msgRoute(n->isChecked(), srcRoute, dstRoute); } iR->setDown(false); // pup->exec() catches mouse release event } @@ -501,6 +508,12 @@ MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align) // record, mixdownfile //--------------------------------------------------- + SimpleButton* monitor = newMonitorButton(); + monitor->setFixedSize(buttonSize); + monitor->setChecked(track->monitor()); + connect(monitor, SIGNAL(clicked(bool)), SLOT(monitorToggled(bool))); + connect(t, SIGNAL(monitorChanged(bool)), monitor, SLOT(setChecked(bool))); + SimpleButton* record = newRecordButton(); record->setFixedSize(buttonSize); record->setChecked(track->recordFlag()); @@ -523,7 +536,7 @@ MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align) smBox2->addWidget(mute); smBox2->addWidget(solo); - smBox1->addStretch(100); + smBox1->addWidget(monitor); smBox1->addWidget(record); layout->addLayout(smBox1); layout->addLayout(smBox2); @@ -597,6 +610,15 @@ void MidiStrip::muteToggled(bool val) } //--------------------------------------------------------- +// monitorToggled +//--------------------------------------------------------- + +void MidiStrip::monitorToggled(bool val) + { + song->setMonitor(track, val); + } + +//--------------------------------------------------------- // soloToggled //--------------------------------------------------------- @@ -625,36 +647,20 @@ void MidiStrip::iRoutePressed() pup.addSeparator()->setText(tr("Input Ports")); MidiOutPort* t = (MidiOutPort*)track; - RouteList* irl = t->inRoutes(); + RouteList* r = t->inRoutes(); MidiInPortList* ipl = song->midiInPorts(); - int tn = 0; - for (iMidiInPort i = ipl->begin(); i != ipl->end(); ++i, ++tn) { - QMenu* m = pup.addMenu((*i)->name()); - m->addSeparator()->setText(tr("Channel")); - QAction* all_action = m->addAction(tr("All")); - QMap<QString, QVariant> map; - map["was_checked"] = false; - map["id"] = tn * 32 + MIDI_CHANNELS; - all_action->setData(map); + for (iMidiInPort i = ipl->begin(); i != ipl->end(); ++i) { + MidiInPort* track = *i; + QAction* action = pup.addAction(track->name()); + action->setCheckable(true); + Route src(track); + action->setData(QVariant::fromValue(src)); - for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { - QString s; - s.setNum(channel+1); - QAction* channel_action = m->addAction(s); - QMap<QString, QVariant> cmap; - cmap["was_checked"] = false; - cmap["id"] = tn * 32 + channel; // trackno + channel as id - channel_action->setData(cmap); - Route src(*i, channel, Route::TRACK); - for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) { - if (*ir == src) { - cmap["was_checked"] = true; - channel_action->setData(cmap); - channel_action->setCheckable(true); - channel_action->setChecked(true); - break; - } + for (iRoute ir = r->begin(); ir != r->end(); ++ir) { + if (*ir == src) { + action->setChecked(true); + break; } } } @@ -662,32 +668,11 @@ void MidiStrip::iRoutePressed() return; QAction* n = pup.exec(QCursor::pos()); if (n) { - QMap<QString, QVariant> data = n->data().toMap(); - int trackid = data["id"].toInt(); - int was_checked = data["was_checked"].toInt(); - int port = trackid >> 5; - int channel = trackid & 0x1f; - - MidiInPort* mip = ipl->at(port); - if (channel == MIDI_CHANNELS) { - for (channel = 0; channel < MIDI_CHANNELS; ++channel) { - Route srcRoute(mip, channel, Route::TRACK); - Route dstRoute(track, channel, Route::TRACK); - audio->msgAddRoute(srcRoute, dstRoute); - } - } - else { - Route srcRoute(mip, channel, Route::TRACK); - Route dstRoute(track, channel, Route::TRACK); - - if (was_checked == 1) - audio->msgRemoveRoute(srcRoute, dstRoute); - else - audio->msgAddRoute(srcRoute, dstRoute); - } - song->update(SC_ROUTE); + Route srcRoute = n->data().value<Route>(); + Route dstRoute(track); + audio->msgRoute(n->isChecked(), srcRoute, dstRoute); } - iR->setDown(false); // pup->exec() catches mouse release event + iR->setDown(false); // pup.exec() catches mouse release event } //--------------------------------------------------------- @@ -701,62 +686,17 @@ void MidiStrip::oRoutePressed() pup.addSeparator()->setText(tr("OutputPorts")); RouteList* orl = track->outRoutes(); - MidiOutPortList* mpl = song->midiOutPorts(); - for (iMidiOutPort i = mpl->begin(); i != mpl->end(); ++i) { - MidiOutPort* op = *i; - QMenu* m = pup.addMenu(op->name()); - m->setSeparatorsCollapsible(false); - m->addSeparator()->setText(tr("Channel")); - for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { - QString s; - s.setNum(channel+1); - QAction* action = m->addAction(s); - action->setCheckable(true); - MidiChannel* mc = op->channel(channel); - Route dst(mc, -1, Route::TRACK); - action->setData(QVariant::fromValue(dst)); - for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) { - if (dst == *ir) { - action->setChecked(true); - break; - } - } - } - } - SynthIList* sl = song->syntis(); - for (iSynthI i = sl->begin(); i != sl->end(); ++i) { - SynthI* op = *i; - QMenu* m = pup.addMenu(op->name()); - m->setSeparatorsCollapsible(false); - m->addSeparator()->setText(tr("Channel")); - for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { - QString s; - s.setNum(channel+1); - QAction* action = m->addAction(s); - action->setCheckable(true); - MidiChannel* mc = op->channel(channel); - Route dst(mc, -1, Route::TRACK); - action->setData(QVariant::fromValue(dst)); - for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) { - if (dst == *ir) { - action->setChecked(true); - break; - } - } - } - } + addMidiOutPorts(&pup, orl); + addSyntiPorts(&pup, orl); + if (pup.isEmpty()) return; + QAction* n = pup.exec(QCursor::pos()); if (n) { - Route srcRoute(track, -1, Route::TRACK); + Route srcRoute(track); Route dstRoute = n->data().value<Route>(); - - if (n->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); - song->update(SC_ROUTE); + audio->msgRoute(n->isChecked(), srcRoute, dstRoute); } oR->setDown(false); // pup->exec() catches mouse release event } @@ -1052,12 +992,7 @@ void MidiOutPortStrip::oRoutePressed() if (action) { Route dstRoute = action->data().value<Route>(); Route srcRoute(track); - - if (action->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); - song->update(SC_ROUTE); + audio->msgRoute(action->isChecked(), srcRoute, dstRoute); } oR->setDown(false); // pup->exec() catches mouse release event } @@ -1214,30 +1149,20 @@ void MidiInPortStrip::oRoutePressed() { QMenu pup(oR); pup.setSeparatorsCollapsible(false); - pup.addSeparator()->setText(tr("Channel")); RouteList* orl = track->outRoutes(); - for (int channel = 0; channel < MIDI_CHANNELS; ++channel) { - QMenu* m = pup.addMenu(QString(tr("Channel %1")).arg(channel + 1)); - m->addSeparator()->setText(tr("Tracks")); - - addMidiTracks(m, orl, channel); - addSyntiPorts(m, orl, channel); - addMidiOutPorts(m, orl, channel); - } + addMidiTracks(&pup, orl); + addSyntiPorts(&pup, orl); + addMidiOutPorts(&pup, orl); if (pup.isEmpty()) return; QAction* action = pup.exec(QCursor::pos()); if (action) { - Route srcRoute(track, -1, Route::TRACK); + Route srcRoute(track); Route dstRoute = action->data().value<Route>(); - if (action->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); - song->update(SC_ROUTE); + audio->msgRoute(action->isChecked(), srcRoute, dstRoute); } oR->setDown(false); // pup->exec() catches mouse release event } @@ -1290,22 +1215,7 @@ void MidiInPortStrip::iRoutePressed() if (action) { Route srcRoute = action->data().value<Route>(); Route dstRoute(track, -1, Route::TRACK); - - // check if route src->dst exists: - iRoute ir = irl->begin(); - for (; ir != irl->end(); ++ir) { - if (*ir == srcRoute) - break; - } - if (ir != irl->end()) { - // disconnect if route exists - audio->msgRemoveRoute(srcRoute, dstRoute); - } - else { - // connect if route does not exist - audio->msgAddRoute(srcRoute, dstRoute); - } - song->update(SC_ROUTE); + audio->msgRoute(action->isChecked(), srcRoute, dstRoute); } iR->setDown(false); // pup->exec() catches mouse release event } @@ -1602,6 +1512,7 @@ void MidiSyntiStrip::oRoutePressed() } oR->setDown(false); // pup->exec() catches mouse release event } + //--------------------------------------------------------- // iRoutePressed //--------------------------------------------------------- @@ -1652,15 +1563,12 @@ void MidiSyntiStrip::iRoutePressed() Route dstRoute(track, channel, Route::TRACK); audio->msgAddRoute(srcRoute, dstRoute); } + song->update(SC_ROUTE); } else { Route dstRoute(track, srcRoute.channel, Route::TRACK); - if (action->isChecked()) - audio->msgAddRoute(srcRoute, dstRoute); - else - audio->msgRemoveRoute(srcRoute, dstRoute); + audio->msgRoute(action->isChecked(), srcRoute, dstRoute); } - song->update(SC_ROUTE); } iR->setDown(false); // pup->exec() catches mouse release event } diff --git a/muse/muse/mixer/mstrip.h b/muse/muse/mixer/mstrip.h index 41afcd5e..bf23dd95 100644 --- a/muse/muse/mixer/mstrip.h +++ b/muse/muse/mixer/mstrip.h @@ -42,6 +42,7 @@ class MidiStrip : public Strip { void recordToggled(bool); void iRoutePressed(); void oRoutePressed(); + void monitorToggled(bool); protected slots: virtual void heartBeat(); diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp index 8b4a9ca6..89f819ee 100644 --- a/muse/muse/route.cpp +++ b/muse/muse/route.cpp @@ -88,7 +88,7 @@ Route::Route(Track* tr, int ch, RouteType t) bool addRoute(Route src, Route dst) { -// printf("addRoute %s.%d:<%s> %s.%d:<%s>\n", +//printf("addRoute %s.%d:<%s> %s.%d:<%s>\n", // src.tname(), src.channel, src.name().toLatin1().data(), // dst.tname(), dst.channel, dst.name().toLatin1().data()); @@ -300,8 +300,6 @@ void Song::readRoute(QDomNode n) s.channel = d.channel; if (d.type == Route::AUDIOPORT) d.channel = s.channel; - if (s.type == Route::TRACK && s.track->type() == Track::MIDI_IN) - d.channel = s.channel; s.disconnected = true; d.disconnected = true; addRoute(s, d); diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp index 45bd0014..b2f26361 100644 --- a/muse/muse/seqmsg.cpp +++ b/muse/muse/seqmsg.cpp @@ -76,6 +76,19 @@ bool Audio::sendMessage(AudioMsg* m, bool doUndo) } //--------------------------------------------------------- +// msgRoute +//--------------------------------------------------------- + +void Audio::msgRoute(bool add, Route src, Route dst) + { + if (add) + msgAddRoute(src, dst); + else + msgRemoveRoute(src, dst); + song->update(SC_ROUTE); + } + +//--------------------------------------------------------- // msgRemoveRoute //--------------------------------------------------------- diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp index 35e2078a..b4b3cdb0 100644 --- a/muse/muse/song.cpp +++ b/muse/muse/song.cpp @@ -1651,6 +1651,8 @@ void Song::insertTrack0(Track* track, int idx) void Song::insertTrack1(Track* track, int idx) { + if (idx == -1) + idx = _tracks.size(); _tracks.insert(idx, track); if (track->type() == Track::AUDIO_SOFTSYNTH) { SynthI* s = (SynthI*)track; @@ -2107,6 +2109,16 @@ void Song::setMute(Track* track, bool val) } //--------------------------------------------------------- +// setMonitor +//--------------------------------------------------------- + +void Song::setMonitor(Track* track, bool val) + { + track->setMonitor(val); +// emit monitorChanged(track, track->mute()); + } + +//--------------------------------------------------------- // setOff //--------------------------------------------------------- diff --git a/muse/muse/song.h b/muse/muse/song.h index a14b22e3..5ab3f14b 100644 --- a/muse/muse/song.h +++ b/muse/muse/song.h @@ -383,6 +383,7 @@ class Song : public QObject { bool solo() const { return soloFlag; } void setRecordFlag(Track*, bool); void setMute(Track*,bool); + void setMonitor(Track*,bool); void setSolo(Track*,bool); void setOff(Track*,bool); diff --git a/muse/muse/songfile.cpp b/muse/muse/songfile.cpp index b6b7515f..51898d07 100644 --- a/muse/muse/songfile.cpp +++ b/muse/muse/songfile.cpp @@ -55,10 +55,17 @@ Part* MusE::readPart(QDomNode node) int partIdx; sscanf(s.toLatin1().data(), "%d:%d", &trackIdx, &partIdx); TrackList* tl = song->tracks(); - Track* track = 0; - if (trackIdx < tl->size()) { - track = tl->at(trackIdx); + Track* track = song->tracks()->value(trackIdx); + if (track) { part = track->parts()->find(partIdx); + if (part == 0) { + printf("MusE::readPart(): part %d(%d) not found in track <%s>\n", + partIdx, track->parts()->size(), track->name().toLatin1().data()); + } + } + else { + printf("MusE::readPart(): trackIdx >= tl->size %d > %d\n", + trackIdx , tl->size()); } return part; } @@ -78,6 +85,8 @@ void MusE::readToplevels(QDomNode node) Part* part = readPart(node); if (part) pl->add(part); + else + printf("part not found\n"); } else if (tag == "PianoRoll") { PianoRoll* pianoroll = new PianoRoll(pl, true); |