diff options
40 files changed, 428 insertions, 411 deletions
| @@ -2,6 +2,7 @@  (29.10.2006)  ---------------------------------------------------------------------------- +      - dont allow for overlapping parts  BUGS        - make sure all track names are unique diff --git a/muse/muse/arranger/midiportinfo.ui b/muse/muse/arranger/midiportinfo.ui index d59b6eed..0c83a01a 100644 --- a/muse/muse/arranger/midiportinfo.ui +++ b/muse/muse/arranger/midiportinfo.ui @@ -1,7 +1,4 @@  <ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro>   <class>MidiPortInfoBase</class>   <widget class="QWidget" name="MidiPortInfoBase" >    <property name="geometry" > @@ -25,7 +22,7 @@    </property>    <layout class="QGridLayout" >     <property name="margin" > -    <number>6</number> +    <number>0</number>     </property>     <property name="spacing" >      <number>0</number> @@ -64,7 +61,6 @@     </item>    </layout>   </widget> - <pixmapfunction></pixmapfunction>   <resources/>   <connections/>  </ui> diff --git a/muse/muse/arranger/tlwidget.cpp b/muse/muse/arranger/tlwidget.cpp index b651a6ee..0bca66d9 100644 --- a/muse/muse/arranger/tlwidget.cpp +++ b/muse/muse/arranger/tlwidget.cpp @@ -420,8 +420,8 @@ void TLWidget::configChanged()                                outChannel->setToolTip(tr("Midi Output Channel"));                                l->addWidget(outChannel);                                wlist.push_back(outChannel); -                              connect(outChannel, SIGNAL(valueChanged(int)), SLOT(outChannelChanged(int))); -                              connect((MidiTrack*)_track, SIGNAL(outChannelChanged(int)), SLOT(setOutChannel(int))); +                              connect(outChannel, SIGNAL(valueChanged(int)), SLOT(setChannel(int))); +                              connect((MidiTrack*)_track, SIGNAL(channelChanged(int)), SLOT(channelChanged(int)));                                }                                break; @@ -518,36 +518,6 @@ void TLWidget::setOutPort(int n)        }  //--------------------------------------------------------- -//   outChannelChanged -//--------------------------------------------------------- - -void TLWidget::outChannelChanged(int n) -      { -#if 0 //TODOA -      n -= 1; -      MidiChannel* mc = ((MidiTrack*)_track)->channel(); -      if (mc == 0)		// no route to port? -            return; -      MidiOut* mp = mc->port(); -      int id = mc->channelNo(); -      if (id == n) -            return; -      audio->msgRemoveRoute(Route(_track), Route(mc)); -      audio->msgAddRoute(Route(_track), Route(mp->channel(n))); -      song->update(SC_ROUTE); -#endif -      } - -//--------------------------------------------------------- -//   setOutChannel -//--------------------------------------------------------- - -void TLWidget::setOutChannel(int) -      { -//TODO3      outChannel->setValue(n + 1); -      } - -//---------------------------------------------------------  //   dragEnterEvent  //--------------------------------------------------------- @@ -643,3 +613,29 @@ void TLWidget::paintEvent(QPaintEvent* ev)              p.fillRect(qr, color);              }        } + +//--------------------------------------------------------- +//   channelChanged +//    SLOT: callend when channel routing of track has +//          changed +//    - channel starts counting at 0 +//--------------------------------------------------------- + +void TLWidget::channelChanged(int channel) +      { +      if (outChannel->value() == channel + 1) +            return; +      outChannel->setValue(channel + 1); +      } + +//--------------------------------------------------------- +//   setChannel +//    - called when channel spinbox value changed +//    - channel starts counting at 1 +//--------------------------------------------------------- + +void TLWidget::setChannel(int channel) +      { +      ((MidiTrack*)_track)->setChannel(channel - 1);       +      } + diff --git a/muse/muse/arranger/tlwidget.h b/muse/muse/arranger/tlwidget.h index 056d1e52..fbe428e2 100644 --- a/muse/muse/arranger/tlwidget.h +++ b/muse/muse/arranger/tlwidget.h @@ -79,14 +79,14 @@ class TLWidget : public QWidget {        void monitorToggled(bool);        void drumMapToggled(bool);        void selectionChanged(); -      void outChannelChanged(int); -      void setOutChannel(int);        void setOutPort(int);        void autoReadToggled(bool val);        void autoWriteToggled(bool val);        void instrumentSelected(int);        void instrumentChanged();        void updateOffState(); +      void channelChanged(int); +      void setChannel(int);     public slots:        void select(); diff --git a/muse/muse/arranger/trackinfo.cpp b/muse/muse/arranger/trackinfo.cpp index 3e88d991..2dbab9af 100644 --- a/muse/muse/arranger/trackinfo.cpp +++ b/muse/muse/arranger/trackinfo.cpp @@ -32,6 +32,8 @@  #include "midioutport.h"  #include "midiinport.h" +static QColor labelColor(140, 140, 255); +  //---------------------------------------------------------  //   createTrackInfo  //--------------------------------------------------------- @@ -67,6 +69,10 @@ TrackInfo::TrackInfo()        label->setToolTip(tr("Track Type"));        label->setLineWidth(2);        label->setFrameStyle(QFrame::Panel | QFrame::Raised); +      label->setAutoFillBackground(true); +      QPalette p = label->palette(); +      p.setColor(QPalette::Background, labelColor); +      label->setPalette(p);        name  = new TLLineEdit("");        name->setToolTip(tr("Track Name")); @@ -132,24 +138,24 @@ MidiTrackInfo::MidiTrackInfo()        grid->addWidget(midiTrackInfo, 2, 0, 1, 2); -      QLabel* label = new QLabel; -      label->setText(tr("Midi Channel")); -      label->setLineWidth(2); -      label->setFrameStyle(QFrame::Panel | QFrame::Raised); -      grid->addWidget(label, 3, 0, 1, 2); -        channel = new QComboBox; -      grid->addWidget(channel, 4, 0, 1, 2); +      for (int ch = 0; ch < MIDI_CHANNELS; ++ch) +            channel->addItem(tr("Channel %1").arg(ch+1), ch); +      grid->addWidget(channel, 3, 0, 1, 2); -      label = new QLabel; +      QLabel* label = new QLabel;        label->setText(tr("Midi Port"));        label->setLineWidth(2);        label->setFrameStyle(QFrame::Panel | QFrame::Raised); -      grid->addWidget(label, 6, 0, 1, 2); +      label->setAutoFillBackground(true); +      QPalette p = label->palette(); +      p.setColor(QPalette::Background, labelColor); +      label->setPalette(p); +      grid->addWidget(label, 4, 0, 1, 2);        port = new QComboBox; -      grid->addWidget(port, 7, 0, 1, 2); -      grid->addWidget(midiPortInfo, 8, 0, 1, 2); +      grid->addWidget(port, 5, 0, 1, 2); +      grid->addWidget(midiPortInfo, 6, 0, 1, 2);        pop = new QMenu(mt.patch); @@ -159,7 +165,6 @@ MidiTrackInfo::MidiTrackInfo()        connect(mt.length,        SIGNAL(valueChanged(int)), SLOT(lenChanged(int)));        connect(mt.compression,   SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int)));        connect(mt.patch,         SIGNAL(clicked()),         SLOT(patchClicked())); -      connect(channel,          SIGNAL(activated(int)),    SLOT(channelSelected(int)));        connect(port,             SIGNAL(activated(int)),    SLOT(portSelected(int)));        connect(mp.instrument,    SIGNAL(activated(int)),    SLOT(instrumentSelected(int)));        connect(mp.deviceId,      SIGNAL(valueChanged(int)), SLOT(deviceIdChanged(int))); @@ -174,6 +179,16 @@ MidiTrackInfo::MidiTrackInfo()  void MidiTrackInfo::init(Track* t)        { +      MidiTrack* midiTrack = (MidiTrack*)t; +      if (t != track) { +            if (track) { +                  disconnect(channel, 0, (MidiTrack*)track, 0); +                  disconnect((MidiTrack*)track, 0, channel, 0); +                  } +            connect(channel, SIGNAL(activated(int)), midiTrack, SLOT(setChannel(int))); +            connect(midiTrack,SIGNAL(channelChanged(int)), channel, SLOT(setCurrentIndex(int))); +            } +        TrackInfo::init(t);        mt.transposition->setValue(((MidiTrack*)track)->transposition());        mt.delay->setValue(((MidiTrack*)track)->delay()); @@ -182,45 +197,43 @@ void MidiTrackInfo::init(Track* t)        mt.compression->setValue(((MidiTrack*)track)->compression());        mp.instrument->clear(); +      foreach(MidiInstrument* mi, midiInstruments) +            mp.instrument->addItem(mi->iname()); -      channel->clear(); -      channel->addItem("---", -1); -      port->clear(); -      port->addItem("---", -1); -      int portIndex = 1; -      MidiTrack* midiTrack = (MidiTrack*)track; -       -      MidiOutPortList* opl = song->midiOutPorts(); +      RouteList* rl = track->outRoutes(); +      Track* outputTrack = 0; +      if (!rl->isEmpty()) +            outputTrack = (*rl)[0].dst.track; -      MidiOut* mo = midiTrack->midiOut();       -      for (iMidiOutPort i = opl->begin(); i != opl->end(); ++i, ++portIndex) { -      	port->addItem((*i)->name()); -            if (mo == (*i)) -                  port->setCurrentIndex(portIndex); +      port->clear(); +      port->addItem("---", QVariant::fromValue<void*>(0)); +      foreach(MidiOutPort* mp, *(song->midiOutPorts())) +      	port->addItem(mp->name(), QVariant::fromValue<void*>(mp)); +      foreach(SynthI* s, *(song->syntis())) +      	port->addItem(s->name(), QVariant::fromValue<void*>(s)); +      if (outputTrack) { +            int idx = port->findText(outputTrack->name()); +            port->setCurrentIndex(idx == -1 ? 0 : idx);              } -      for (int ch = 0; ch < MIDI_CHANNELS; ++ch) -            channel->addItem(QString("Channel %1").arg(ch+1), ch); -      int n = midiTrack->channelNo(); -      channel->setCurrentIndex(n < 0 ? 0 : n + 1); +       +      channel->setCurrentIndex(midiTrack->channelNo());        connect(track, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int))); -//TODO  connect(op, SIGNAL(instrumentChanged()), SLOT(instrumentChanged())); +      if (outputTrack && outputTrack->type() == Track::MIDI_OUT) +            connect(outputTrack, SIGNAL(instrumentChanged()), SLOT(instrumentChanged())); -      MidiInstrument* mi = midiTrack->instrument(); -      int idx = 0; -      int curIdx = 0; -      for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) { -            mp.instrument->addItem((*i)->iname()); -            if (mi && ((*i)->iname() == mi->iname())) -                  curIdx = idx; -            } -      mp.instrument->setCurrentIndex(curIdx); -      mp.deviceId->setValue(midiTrack->deviceId()); -#if 0 +      instrumentChanged();    // setup instrument + +      // enable instrument selection only for tracks routed to a +      // midi out port: +      mp.instrument->setEnabled(outputTrack && (outputTrack->type() == Track::MIDI_OUT)); + +      if (!rl->isEmpty()) { +            mp.deviceId->setValue(midiTrack->deviceId());              autoChanged(track, false);             // update enable -            int val = track->ctrlVal(CTRL_PROGRAM).i; -            int channelno = track->channelNo(); -            mt.patch->setText(mi->getPatchName(channelno, val)); +            int val       = midiTrack->ctrlVal(CTRL_PROGRAM).i; +            int channelno = midiTrack->channelNo(); +            mt.patch->setText(midiTrack->instrument()->getPatchName(channelno, val));              }        else {              channel->setCurrentIndex(0); @@ -229,61 +242,26 @@ void MidiTrackInfo::init(Track* t)              mp.instrument->setCurrentIndex(0);              mt.patch->setText("--");              } -#endif         }  //---------------------------------------------------------  //   portSelected  //--------------------------------------------------------- -void MidiTrackInfo::portSelected(int portno) +void MidiTrackInfo::portSelected(int idx)        { -      if (portno == 0) +      QVariant v(port->itemData(idx)); +      Track* outputTrack = (Track*)v.value<void*>(); +      if (outputTrack == 0)              return; -      --portno; -#if 0 //TODOA -	Route srcRoute(track); -      MidiChannel* midic = ((MidiTrack*)track)->channel(); -      if (midic) { -      	Route odstRoute(midic); -	      audio->msgRemoveRoute(srcRoute, odstRoute); -            } - -      int channel = midic ? midic->channelNo() : 0; -      MidiOutPort* midip = song->midiOutPorts()->at(portno); -      midic = midip->channel(channel); - -      Route dstRoute(midic); -      audio->msgAddRoute(srcRoute, dstRoute); - -	song->update(SC_ROUTE); -#endif -      } - -//--------------------------------------------------------- -//   channelSelected -//--------------------------------------------------------- - -void MidiTrackInfo::channelSelected(int ch) -      { -	if (ch == 0) -      	return; -	--ch; -#if 0 //TODOA -	Route srcRoute(track); -      MidiOut* midip = ((MidiTrack*)track)->midiOut(); -      MidiOutPort* midi =   -      if (midi) { -      	Route dstRoute(midic); -	      audio->msgRemoveRoute(srcRoute, dstRoute); -            } - -      midic = midip->channel(ch); -      Route dstRoute(midic); -      audio->msgAddRoute(srcRoute, dstRoute); - +      RouteList* rl = track->outRoutes(); +      if (rl->isEmpty()) +            return; +      Route r = (*rl)[0]; +      audio->msgRemoveRoute(r); +      r.dst.track = outputTrack; +      audio->msgAddRoute(r);  	song->update(SC_ROUTE); -#endif        }  //--------------------------------------------------------- @@ -293,14 +271,9 @@ void MidiTrackInfo::channelSelected(int ch)  void MidiTrackInfo::controllerChanged(int id)        {        if (id == CTRL_PROGRAM) { -#if 0 //TODOA -            MidiOut* op = ((MidiTrack*)track)->midiOut(); -            if (op) { -                  MidiInstrument* mi = op->instrument(); -                  int val = midic->ctrlVal(id).i; -                  mt.patch->setText(mi->getPatchName(midic->channelNo(), val)); -                  } -#endif +            MidiInstrument* mi = track->instrument(); +            int val = track->ctrlVal(id).i; +            mt.patch->setText(mi->getPatchName(((MidiTrack*)track)->channelNo(), val));              }        } @@ -310,24 +283,8 @@ void MidiTrackInfo::controllerChanged(int id)  void MidiTrackInfo::instrumentChanged()        { -#if 0 //TODOA -      MidiChannel* midic = ((MidiTrack*)track)->channel(); -      if (midic) { -            MidiOut* op = midic->port(); -            MidiInstrument* mi = op->instrument(); -            int idx = 0; -            for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) { -                  if (*i == mi) { -                        mp.instrument->setCurrentIndex(idx); -                        break; -                        } -                  } -            } -      else { -            mp.instrument->clear(); -            mp.instrument->setCurrentIndex(0); -            } -#endif +      MidiInstrument* mi = track->instrument(); +      mp.instrument->setCurrentIndex(midiInstruments.indexOf(mi));        }  //--------------------------------------------------------- @@ -336,9 +293,8 @@ void MidiTrackInfo::instrumentChanged()  void MidiTrackInfo::autoChanged(Track* t, bool)        { -//      MidiChannel* midic = ((MidiTrack*)track)->channel(); -//      if (midic != t) -//            return; +      if (t != track) +            return;        bool ar = t->autoRead();        bool aw = t->autoWrite();        bool en = !ar || (ar && aw); @@ -360,12 +316,7 @@ void MidiTrackInfo::transpositionChanged(int val)  void MidiTrackInfo::patchClicked()        { -      MidiOut* op = ((MidiTrack*)track)->midiOut(); -      if (op == 0) -            return; -      MidiInstrument* mi = op->instrument(); -      if (mi == 0) -            return; +      MidiInstrument* mi = track->instrument();        mi->populatePatchPopup(pop, 0);        QAction* rv = pop->exec(mt.patch->mapToGlobal(QPoint(10,5))); @@ -382,10 +333,12 @@ void MidiTrackInfo::patchClicked()  void MidiTrackInfo::instrumentSelected(int n)        { -      MidiOut* op = ((MidiTrack*)track)->midiOut(); -      if (op == 0) +      RouteList* rl = track->outRoutes(); +      if (rl->isEmpty())              return; -      op->setInstrument(midiInstruments[n]); +      Track* outTrack = (*rl)[0].dst.track; +      if (outTrack->type() == Track::MIDI_OUT) +            ((MidiOutPort*)outTrack)->setInstrument(midiInstruments[n]);        }  //--------------------------------------------------------- diff --git a/muse/muse/arranger/trackinfo.h b/muse/muse/arranger/trackinfo.h index b0733b31..2b349603 100644 --- a/muse/muse/arranger/trackinfo.h +++ b/muse/muse/arranger/trackinfo.h @@ -85,7 +85,6 @@ class MidiTrackInfo : public TrackInfo {        void autoChanged(Track*,bool);        void controllerChanged(int);        void portSelected(int); -      void channelSelected(int);        void deviceIdChanged(int);     public: diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp index a6bf9a84..b91f7715 100644 --- a/muse/muse/conf.cpp +++ b/muse/muse/conf.cpp @@ -671,7 +671,6 @@ void MixerConfig::write(Xml& xml, const char* name)        xml.intTag("showSyntiTracks",  showSyntiTracks);        xml.intTag("showMidiInPorts",  showMidiInPorts);        xml.intTag("showMidiOutPorts", showMidiOutPorts); -      xml.intTag("showMidiChannels", showMidiChannels);        xml.etag("%s", name);        } @@ -708,8 +707,6 @@ void MixerConfig::read(QDomNode node)                    showMidiInPorts = i;              else if (tag == "showMidiOutPorts")                    showMidiOutPorts = i; -            else if (tag == "showMidiChannels") -                  showMidiChannels = i;              else                    printf("MusE:MixerConfig: unknown tag %s\n", e.tagName().toAscii().data());              } diff --git a/muse/muse/ctrl/configmidictrl.cpp b/muse/muse/ctrl/configmidictrl.cpp index c2436e12..e7352be8 100644 --- a/muse/muse/ctrl/configmidictrl.cpp +++ b/muse/muse/ctrl/configmidictrl.cpp @@ -138,13 +138,10 @@ void ConfigMidiCtrl::done(int code)              QDialog::done(code);              return;              } -#if 0 //TODOA -      if (track->type() == Track::MIDI) -            MidiTrack* mc = (MidiTrack*)track; - -            MidiOut* port           = mc->port(); +#if 1 //TODOA +      if (track->type() == Track::MIDI) {              ControllerNameList* cn  = track->controllerNames(); -            MidiInstrument* instr   = port->instrument(); +            MidiInstrument* instr   = track->instrument();              MidiControllerList* mcl = instr->controller();              // diff --git a/muse/muse/ctrl/ctrldialog.cpp b/muse/muse/ctrl/ctrldialog.cpp index a9715c83..206687eb 100644 --- a/muse/muse/ctrl/ctrldialog.cpp +++ b/muse/muse/ctrl/ctrldialog.cpp @@ -146,32 +146,6 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent)                          }                    }              } -      if (track->type() == Track::MIDI) { -            // -            //    add midi channel controller -            // -#if 0 //TODOA -            MidiChannel* mc = ((MidiTrack*)track)->channel(); -            if (mc) { -                  ci = new QTreeWidgetItem(tw, CTRL_NO_CTRL); -                  ci->setText(0, tr("Midi Channel Controller")); - -                  ControllerNameList* cn = mc->controllerNames(); -                  for (iControllerName i = cn->begin(); i != cn->end(); ++i) { -                        QTreeWidgetItem* cci = new QTreeWidgetItem(ci, i->id); -                        cci->setText(0, i->name); -                        Ctrl* ctrl = mc->getController(i->id); -                        if (!ctrl->empty()) -                              cci->setText(1, "*"); - -                        if (i->id == currentId) { -                              tw->setCurrentItem(cci); -                              tw->setItemSelected(cci, true); -                              } -                        } -                  } -#endif -            }        ci = new QTreeWidgetItem(tw, CTRL_OTHER);        ci->setText(0, tr("other"));        connect(tw,  diff --git a/muse/muse/driver/alsamidi.cpp b/muse/muse/driver/alsamidi.cpp index ae2ef5ea..8b76534a 100644 --- a/muse/muse/driver/alsamidi.cpp +++ b/muse/muse/driver/alsamidi.cpp @@ -334,7 +334,6 @@ void AlsaMidi::getOutputPollFd(struct pollfd** p, int* n)  void AlsaMidi::addConnection(snd_seq_connect_t* ev)        { -#if 0 //TODOA        Port rs(ev->sender.client, ev->sender.port);        Port rd(ev->dest.client, ev->dest.port); @@ -344,11 +343,11 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)              Port src = oport->alsaPort(0);              if (src == rs) { -                  RouteNode r(rd, Route::MIDIPORT); -                  if (oport->outRoutes()->indexOf(r) == -1) { -                        Port port(ev->dest.client, ev->dest.port); -                        oport->outRoutes()->push_back(Route(port, -1, Route::MIDIPORT)); -                        } +                  RouteNode src(oport); +                  RouteNode dst(rd, -1, RouteNode::MIDIPORT); +                  Route r = Route(src, dst); +                  if (oport->outRoutes()->indexOf(r) == -1) +                        oport->outRoutes()->push_back(r);                    break;                    }              } @@ -359,15 +358,14 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)              Port dst = iport->alsaPort();              if (dst == rd) { -                  Route r(rs, Route::MIDIPORT); -                  if (iport->inRoutes()->indexOf(r) == -1) { -                        Port port(ev->sender.client, ev->sender.port); -                        iport->inRoutes()->push_back(Route(port, -1, Route::MIDIPORT)); -                        } +                  RouteNode src(rs, -1, RouteNode::MIDIPORT); +                  RouteNode dst(iport); +                  Route r = Route(src, dst); +                  if (iport->inRoutes()->indexOf(r) == -1) +                        iport->inRoutes()->push_back(r);                    break;                    }              } -#endif        }  //--------------------------------------------------------- @@ -377,7 +375,6 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)  void AlsaMidi::removeConnection(snd_seq_connect_t* ev)        { -#if 0 //TODOA        Port rs(ev->sender.client, ev->sender.port);        Port rd(ev->dest.client, ev->dest.port); @@ -389,7 +386,7 @@ void AlsaMidi::removeConnection(snd_seq_connect_t* ev)              if (dst == rd) {                    RouteList* irl = iport->outRoutes();                    for (iRoute r = irl->begin(); r != irl->end(); ++r) { -                        if (!r->disconnected && (r->port == rs)) { +                        if (!r->disconnected && (r->src.port == rs)) {                                iport->inRoutes()->erase(r);                                break;                                } @@ -406,7 +403,7 @@ void AlsaMidi::removeConnection(snd_seq_connect_t* ev)              if (src == rs) {                    RouteList* orl = oport->outRoutes();                    for (iRoute r = orl->begin(); r != orl->end(); ++r) { -                        if (!r->disconnected && (r->port == rd)) { +                        if (!r->disconnected && (r->dst.port == rd)) {                                orl->erase(r);                                break;                                } @@ -414,7 +411,6 @@ void AlsaMidi::removeConnection(snd_seq_connect_t* ev)                    break;                    }              } -#endif        }  //--------------------------------------------------------- diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp index 96a2da64..c67a42d9 100644 --- a/muse/muse/driver/jack.cpp +++ b/muse/muse/driver/jack.cpp @@ -304,18 +304,10 @@ static int graph_callback(void*)  //    by graph_callback()  //--------------------------------------------------------- -struct RouteRoute { -      Route src; -      Route dst; -      }; -  void JackAudio::graphChanged()        { -#if 0 //TODOA -      QList<RouteRoute> rr; -      QList<RouteRoute> ra; +      RouteList rr, ra; -// printf("graphChanged\n");        InputList* il = song->inputs();        for (iAudioInput ii = il->begin(); ii != il->end(); ++ii) {              AudioInput* it = *ii; @@ -332,10 +324,10 @@ void JackAudio::graphChanged()                    // check for disconnects                    //--------------------------------------- -                  foreach (Route r, *irl) { -                        if (r.channel != channel) +                  foreach (const Route& r, *irl) { +                        if (r.dst.channel != channel)                                continue; -                        const char* name = jack_port_name(r.port.jackPort()); +                        const char* name = jack_port_name(r.src.port.jackPort());                          bool found      = false;                          for (const char** pn = ports; pn && *pn; ++pn) {                                if (strcmp(*pn, name) == 0) { @@ -343,12 +335,8 @@ void JackAudio::graphChanged()                                      break;                                      }                                } -                        if (!found) { -                              RouteRoute a; -                              a.src = Route(r.port, channel, Route::AUDIOPORT); -                              a.dst = Route(it, channel); -                              rr.append(a); -                              } +                        if (!found) +                              rr.append(r);                          }                    //--------------------------------------- @@ -358,36 +346,33 @@ void JackAudio::graphChanged()                    if (ports) {                          for (const char** pn = ports; *pn; ++pn) {                                bool found = false; -                              foreach(Route r, *irl) { -                                    if (r.channel != channel) +                              foreach(const Route& r, *irl) { +                                    if (r.dst.channel != channel)                                            continue; -                                    const char* name = jack_port_name(r.port.jackPort()); +                                    const char* name = jack_port_name(r.src.port.jackPort());                                      if (strcmp(*pn, name) == 0) {                                            found = true;                                            break;                                            }                                      }                                if (!found) { -                                    RouteRoute a; +                                    Route a;                                      Port port(jack_port_by_name(_client, *pn)); -                                    a.src = Route(port, channel, Route::AUDIOPORT); -                                    a.dst = Route(it, channel); +                                    a.src = RouteNode(port, -1, RouteNode::AUDIOPORT); +                                    a.dst = RouteNode(it, channel);                                      ra.append(a);                                      }                                } -                          free(ports);                          }                    }              }  // printf("  input: remove %d add %d routes\n", rr.size(), ra.size()); -      foreach(RouteRoute a, rr) { -            audio->msgRemoveRoute1(a.src, a.dst); -            } -      foreach(RouteRoute a, ra) { -            audio->msgAddRoute1(a.src, a.dst); -            } +      foreach(Route r, rr) +            audio->msgRemoveRoute1(r); +      foreach(Route r, ra) +            audio->msgAddRoute1(r);        rr.clear();        ra.clear();       @@ -406,10 +391,10 @@ void JackAudio::graphChanged()                    // check for disconnects                    //--------------------------------------- -                  foreach(Route r, *rl) { -                        if (r.channel != channel) +                  foreach(const Route& r, *rl) { +                        if (r.src.channel != channel)                                continue; -                        const char* name = jack_port_name(r.port.jackPort()); +                        const char* name = jack_port_name(r.dst.port.jackPort());                          bool found = false;                          const char** pn = ports;                          while (pn && *pn) { @@ -419,12 +404,8 @@ void JackAudio::graphChanged()                                      }                                ++pn;                                } -                        if (!found) { -                              RouteRoute a; -                              a.src = Route(it, channel); -                              a.dst = Route(r.port, channel, Route::AUDIOPORT); -                              rr.append(a); -                              } +                        if (!found) +                              rr.append(r);                          }                    //--------------------------------------- @@ -435,20 +416,20 @@ void JackAudio::graphChanged()                          const char** pn = ports;                          while (*pn) {                                bool found = false; -                              for (iRoute irl = rl->begin(); irl != rl->end(); ++irl) { -                                    if (irl->channel != channel) +                              foreach (const Route& r, *rl) { +                                    if (r.src.channel != channel)                                            continue; -                                    const char* name = jack_port_name(irl->port.jackPort()); +                                    const char* name = jack_port_name(r.dst.port.jackPort());                                      if (strcmp(*pn, name) == 0) {                                            found = true;                                            break;                                            }                                      }                                if (!found) { -                                    RouteRoute a; -                                    a.src = Route(it, channel); +                                    Route a;                                      Port port(jack_port_by_name(_client, *pn)); -                                    a.dst = Route(port, channel, Route::AUDIOPORT); +                                    a.src = RouteNode(it, channel, RouteNode::TRACK); +                                    a.dst = RouteNode(port, -1, RouteNode::AUDIOPORT);                                      ra.append(a);                                      }                                ++pn; @@ -458,11 +439,10 @@ void JackAudio::graphChanged()                    }              }  // printf("  output: remove %d add %d routes\n", rr.size(), ra.size()); -      foreach(RouteRoute a, rr) -            audio->msgRemoveRoute1(a.src, a.dst); -      foreach(RouteRoute a, ra) -            audio->msgAddRoute1(a.src, a.dst); -#endif +      foreach(Route r, rr) +            audio->msgRemoveRoute1(r); +      foreach(Route r, ra) +            audio->msgAddRoute1(r);        }  //static int xrun_callback(void*) diff --git a/muse/muse/gconfig.cpp b/muse/muse/gconfig.cpp index c926d919..231238ad 100644 --- a/muse/muse/gconfig.cpp +++ b/muse/muse/gconfig.cpp @@ -89,12 +89,12 @@ GlobalConfigValues config = {        QRect(0, 0, 600, 400),        // GeometryDrumedit;        {           QRect(0, 0, 300, 500),        // Mixer1 -         false, true, true, true, true, +         false, true, true, true,            true, true, true, true, true, true           },        {           QRect(200, 200, 300, 500),    // Mixer2 -         false, true, true, true, true, +         false, true, true, true,           true, true, true, true, true, true           },        false,                        // TransportVisible diff --git a/muse/muse/gconfig.h b/muse/muse/gconfig.h index 58299403..00ef43d5 100644 --- a/muse/muse/gconfig.h +++ b/muse/muse/gconfig.h @@ -43,7 +43,6 @@ struct MixerConfig {        bool showMidiInPorts;        bool showMidiSyntiPorts;        bool showMidiOutPorts; -      bool showMidiChannels;        bool showOutputTracks;        bool showWaveTracks;        bool showGroupTracks; diff --git a/muse/muse/instruments/minstrument.h b/muse/muse/instruments/minstrument.h index 5d6a5ab3..64f86393 100644 --- a/muse/muse/instruments/minstrument.h +++ b/muse/muse/instruments/minstrument.h @@ -117,10 +117,7 @@ class MidiInstrument {  //   MidiInstrumentList  //--------------------------------------------------------- -class MidiInstrumentList : public std::vector<MidiInstrument*> { - -   public: -      MidiInstrumentList() {} +class MidiInstrumentList : public QList<MidiInstrument*> {        };  typedef MidiInstrumentList::iterator iMidiInstrument; diff --git a/muse/muse/midiout.cpp b/muse/muse/midiout.cpp index e4edf5b1..6ab98da7 100644 --- a/muse/muse/midiout.cpp +++ b/muse/muse/midiout.cpp @@ -36,7 +36,6 @@ static const unsigned char mmcDeferredPlayMsg[] = { 0x7f, 0x7f, 0x06, 0x03 };  MidiOut::MidiOut()        {        track = 0; -      _instrument = 0;        }  //--------------------------------------------------------- diff --git a/muse/muse/midiout.h b/muse/muse/midiout.h index d521ff89..9df88569 100644 --- a/muse/muse/midiout.h +++ b/muse/muse/midiout.h @@ -28,7 +28,6 @@  class Track;  class MidiInstrument; -class MidiChannel;  //---------------------------------------------------------  //    MidiOut @@ -49,8 +48,6 @@ class MidiOut        MidiOut();        void processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,            unsigned fromFrame, unsigned toFrame); -      MidiInstrument* instrument()          { return _instrument; } -      void setInstrument(MidiInstrument* i) { _instrument = i; }        void seek(unsigned, unsigned);        void stop(); diff --git a/muse/muse/midioutport.cpp b/muse/muse/midioutport.cpp index 899dc70c..698970a8 100644 --- a/muse/muse/midioutport.cpp +++ b/muse/muse/midioutport.cpp @@ -42,8 +42,6 @@ MidiOutPort::MidiOutPort()        {        track      = this;        _instrument = genericMidiInstrument; -//      for (int ch = 0; ch < MIDI_CHANNELS; ++ch) -//            _channel[ch] = new MidiChannel(this, ch);        setDeviceId(127);        // all        addMidiController(_instrument, CTRL_MASTER_VOLUME);        _channels = 1; diff --git a/muse/muse/midioutport.h b/muse/muse/midioutport.h index 246db9f3..75620283 100644 --- a/muse/muse/midioutport.h +++ b/muse/muse/midioutport.h @@ -31,6 +31,7 @@  class MidiOutPort : public MidiTrackBase, public MidiOut {        Q_OBJECT +      MidiInstrument* _instrument;        void routeEvent(const MidiEvent&);        void queueAlsaEvent(const MidiEvent& event);        void queueJackEvent(const MidiEvent& event); @@ -49,7 +50,8 @@ class MidiOutPort : public MidiTrackBase, public MidiOut {        virtual bool isMute() const         { return _mute; }        virtual Part* newPart(Part*, bool)  { return 0; } -      MidiInstrument* instrument() const  { return _instrument; } +      virtual MidiInstrument* instrument()  { return _instrument; } +      virtual MidiOut* midiOut() { return this; }        void setInstrument(MidiInstrument* i);        bool guiVisible() const; diff --git a/muse/muse/miditrack.cpp b/muse/muse/miditrack.cpp index 31c6afae..e10cacf3 100644 --- a/muse/muse/miditrack.cpp +++ b/muse/muse/miditrack.cpp @@ -465,17 +465,6 @@ bool MidiTrack::isMute() const        return _mute;        } -#if 0 -//--------------------------------------------------------- -//   changeDrumMap -//--------------------------------------------------------- - -void MidiTrack::changeDrumMap() const -	{ -      emit drumMapChanged(); -      } -#endif -  //---------------------------------------------------------  //   getEvents  //    from/to - midi ticks @@ -655,21 +644,15 @@ void MidiTrack::setUseDrumMap(bool val)              }        } -  //---------------------------------------------------------  //   instrument  //--------------------------------------------------------- -MidiInstrument* MidiTrack::instrument() const +MidiInstrument* MidiTrack::instrument()        {        if (_outRoutes.isEmpty())              return genericMidiInstrument; -      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; +      return _outRoutes[0].dst.track->instrument();        }  //--------------------------------------------------------- @@ -678,8 +661,8 @@ MidiInstrument* MidiTrack::instrument() const  int MidiTrack::channelNo() const        { -      if (_outRoutes.isEmpty()) -            return -1; +      if (_outRoutes.isEmpty())     // TODO: better: remember old channel setting +            return 0;        return _outRoutes[0].dst.channel;        } @@ -687,16 +670,26 @@ int MidiTrack::channelNo() const  //   midiOut  //--------------------------------------------------------- -MidiOut* MidiTrack::midiOut() const +MidiOut* MidiTrack::midiOut()        {        if (_outRoutes.isEmpty())              return 0; -      Track* track = _outRoutes[0].dst.track; -      if (track->type() == AUDIO_SOFTSYNTH) { -            SynthI* s = (SynthI*) track; -            return s; -            } -      MidiOutPort* op = (MidiOutPort*) track; -      return op; +      return _outRoutes[0].dst.track->midiOut();        } +//--------------------------------------------------------- +//   setChannel +//--------------------------------------------------------- + +void MidiTrack::setChannel(int n) +      { +      if (_outRoutes.isEmpty()) +            return; +      Route r = _outRoutes[0]; +      if (r.dst.channel == n) +            return; +      audio->msgRemoveRoute(r); +      r.dst.channel = n; +      audio->msgAddRoute(r); +	emit channelChanged(n); +      } diff --git a/muse/muse/miditrack.h b/muse/muse/miditrack.h index 7763a189..de7723a1 100644 --- a/muse/muse/miditrack.h +++ b/muse/muse/miditrack.h @@ -62,7 +62,10 @@ class MidiTrack : public MidiTrackBase {     signals:        void drumMapChanged() const;        void useDrumMapChanged(bool); -      void outChannelChanged(int); +      void channelChanged(int); + +   public slots: +      void setChannel(int);     public:        MidiTrack(); @@ -104,8 +107,9 @@ class MidiTrack : public MidiTrackBase {        int channelNo() const;        virtual void emitControllerChanged(int id); -      MidiOut* midiOut() const; -      MidiInstrument* instrument() const; + +      virtual MidiOut* midiOut(); +      virtual MidiInstrument* instrument();        };  typedef QList<MidiTrack*> MidiTrackList; diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp index 4b712674..dc75b6e7 100644 --- a/muse/muse/mixer/astrip.cpp +++ b/muse/muse/mixer/astrip.cpp @@ -246,11 +246,8 @@ void AudioStrip::songChanged(int val)        AudioTrack* src = (AudioTrack*)track;        if (val & SC_TRACK_MODIFIED)              updateLabel(); -      if (val & SC_ROUTE) { -            if (pre) { -                  pre->setChecked(src->prefader()); -                  } -            } +      if ((val & SC_ROUTE) && pre) +            pre->setChecked(src->prefader());        if (val & SC_CHANNELS)              updateChannels();        } diff --git a/muse/muse/mixer/astrip.h b/muse/muse/mixer/astrip.h index 056e18ed..5fd73200 100644 --- a/muse/muse/mixer/astrip.h +++ b/muse/muse/mixer/astrip.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: astrip.h,v 1.26 2005/11/04 12:03:47 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __ASTRIP_H__  #define __ASTRIP_H__ diff --git a/muse/muse/mixer/midirack.cpp b/muse/muse/mixer/midirack.cpp index 29d2e748..1b65b31c 100644 --- a/muse/muse/mixer/midirack.cpp +++ b/muse/muse/mixer/midirack.cpp @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: midirack.cpp,v 1.11 2006/01/12 14:49:13 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2005 Werner Schweer (ws@seh.de) -//========================================================= +//  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. +//=============================================================================  #include "icons.h"  #include "gconfig.h" diff --git a/muse/muse/mixer/midirack.h b/muse/muse/mixer/midirack.h index 12389554..7f83ca42 100644 --- a/muse/muse/mixer/midirack.h +++ b/muse/muse/mixer/midirack.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: midirack.h,v 1.7 2005/12/28 13:13:26 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2005 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __MIDIRACK_H__  #define __MIDIRACK_H__ diff --git a/muse/muse/mixer/mixer.cpp b/muse/muse/mixer/mixer.cpp index 70c9395f..bb0786fc 100644 --- a/muse/muse/mixer/mixer.cpp +++ b/muse/muse/mixer/mixer.cpp @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: mixer.cpp,v 1.18 2006/01/12 18:15:28 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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. +//=============================================================================  #include "muse.h"  #include "mixer.h" @@ -280,12 +292,6 @@ void Mixer::songChanged(int flags)                    action |= STRIP_REMOVED;              if (flags & SC_TRACK_INSERTED)                    action |= STRIP_INSERTED; -            if (flags &SC_ROUTE) { -                  // update if midi channel gets conncted/disconnected -                  // delay update -                  mustUpdateMixer = true; -                  return; -                  }              }        if (action != NO_UPDATE)              updateMixer(action); diff --git a/muse/muse/mixer/mixer.h b/muse/muse/mixer/mixer.h index f7bd17a7..68ccf2d1 100644 --- a/muse/muse/mixer/mixer.h +++ b/muse/muse/mixer/mixer.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: mixer.h,v 1.9 2006/01/12 14:49:13 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2005 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __AMIXER_H__  #define __AMIXER_H__ diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp index d8f404d6..690a5b0c 100644 --- a/muse/muse/mixer/mstrip.cpp +++ b/muse/muse/mixer/mstrip.cpp @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: mstrip.cpp,v 1.70 2006/01/12 14:49:13 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2005 Werner Schweer (ws@seh.de) -//========================================================= +//  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. +//=============================================================================  #include "midictrl.h"  #include "mstrip.h" diff --git a/muse/muse/mixer/mstrip.h b/muse/muse/mixer/mstrip.h index 1f167739..e4645173 100644 --- a/muse/muse/mixer/mstrip.h +++ b/muse/muse/mixer/mstrip.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: mstrip.h,v 1.27 2005/10/03 21:38:14 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __MSTRIP_H__  #define __MSTRIP_H__ diff --git a/muse/muse/mixer/rack.cpp b/muse/muse/mixer/rack.cpp index 646625fa..afab6a77 100644 --- a/muse/muse/mixer/rack.cpp +++ b/muse/muse/mixer/rack.cpp @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: rack.cpp,v 1.27 2006/01/25 16:24:33 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2003 Werner Schweer (ws@seh.de) -//========================================================= +//  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. +//=============================================================================  #include "rack.h"  #include "song.h" diff --git a/muse/muse/mixer/rack.h b/muse/muse/mixer/rack.h index bdd4a243..c468d8b9 100644 --- a/muse/muse/mixer/rack.h +++ b/muse/muse/mixer/rack.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: rack.h,v 1.12 2006/01/14 23:44:57 spamatica Exp $ +//  $Id:$  // -//  (C) Copyright 2000 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __RACK_H__  #define __RACK_H__ diff --git a/muse/muse/mixer/routedialog.cpp b/muse/muse/mixer/routedialog.cpp index 364e69e3..0a883646 100644 --- a/muse/muse/mixer/routedialog.cpp +++ b/muse/muse/mixer/routedialog.cpp @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: routedialog.cpp,v 1.12 2006/01/06 22:48:09 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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. +//=============================================================================  #include "routedialog.h"  #include "track.h" diff --git a/muse/muse/mixer/routedialog.h b/muse/muse/mixer/routedialog.h index 8b53411b..2bcbf471 100644 --- a/muse/muse/mixer/routedialog.h +++ b/muse/muse/mixer/routedialog.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: routedialog.h,v 1.5 2006/01/06 22:48:09 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __ROUTEDIALOG_H__  #define __ROUTEDIALOG_H__ diff --git a/muse/muse/mixer/strip.cpp b/muse/muse/mixer/strip.cpp index 20441f3f..a4b66181 100644 --- a/muse/muse/mixer/strip.cpp +++ b/muse/muse/mixer/strip.cpp @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: strip.cpp,v 1.40 2006/01/11 16:14:29 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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. +//=============================================================================  #include "gconfig.h"  #include "song.h" diff --git a/muse/muse/mixer/strip.h b/muse/muse/mixer/strip.h index da59d39d..8c89f40e 100644 --- a/muse/muse/mixer/strip.h +++ b/muse/muse/mixer/strip.h @@ -1,10 +1,22 @@ -//========================================================= +//=============================================================================  //  MusE  //  Linux Music Editor -//  $Id: strip.h,v 1.21 2006/01/12 14:49:13 wschweer Exp $ +//  $Id:$  // -//  (C) Copyright 2000-2004 Werner Schweer (ws@seh.de) -//========================================================= +//  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 __STRIP_H__  #define __STRIP_H__ diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp index 953defaf..f4e1509d 100644 --- a/muse/muse/route.cpp +++ b/muse/muse/route.cpp @@ -37,7 +37,6 @@ RouteNode::RouteNode()        track   = 0;        channel = -1;        type    = TRACK; -      disconnected = false;        }  RouteNode::RouteNode(Port p, int ch, RouteNodeType t) @@ -45,7 +44,6 @@ RouteNode::RouteNode(Port p, int ch, RouteNodeType t)        port    = p;        channel = ch;        type    = t; -      disconnected = false;        }  RouteNode::RouteNode(Port p, RouteNodeType t) @@ -53,7 +51,6 @@ RouteNode::RouteNode(Port p, RouteNodeType t)        port    = p;        channel = -1;        type    = t; -      disconnected = false;        }  RouteNode::RouteNode(Track* tr) @@ -61,7 +58,6 @@ RouteNode::RouteNode(Track* tr)        track   = tr;        channel = -1;        type    = TRACK; -      disconnected = false;        }  RouteNode::RouteNode(AuxPluginIF* p) @@ -69,7 +65,6 @@ RouteNode::RouteNode(AuxPluginIF* p)        plugin  = p;        channel = -1;        type    = AUXPLUGIN; -      disconnected = false;        }  RouteNode::RouteNode(Track* tr, int ch, RouteNodeType t) @@ -77,7 +72,6 @@ RouteNode::RouteNode(Track* tr, int ch, RouteNodeType t)        track   = tr;        channel = ch;        type    = t; -      disconnected = false;        }  //--------------------------------------------------------- @@ -290,9 +284,8 @@ void Song::readRoute(QDomNode n)                d.tname(), d.channel, d.name().toLatin1().data());              return;              } -      s.disconnected = true; -      d.disconnected = true;        Route r(s, d); +      r.disconnected = true;        addRoute(r);        } diff --git a/muse/muse/route.h b/muse/muse/route.h index a57b6405..05a506eb 100644 --- a/muse/muse/route.h +++ b/muse/muse/route.h @@ -51,9 +51,6 @@ struct RouteNode {              AuxPluginIF* plugin;              };        int channel;            // route to/from JACK can specify a channel to connect to -      bool disconnected;      // if true, do not remove route in graphChanged() -                              // or removeConnection() -        RouteNodeType type;        RouteNode(); @@ -88,8 +85,10 @@ struct RouteNode {  struct Route {        RouteNode src;        RouteNode dst; +      bool disconnected;      // if true, do not remove route in graphChanged() +                              // or removeConnection() -      Route() {} +      Route() { disconnected = false; }        Route(const RouteNode& s, const RouteNode& d) : src(s), dst(d) {}        bool operator==(const Route& a) const {               return (src==a.src) && (dst==a.dst); diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp index 1b5d09fa..3e61056b 100644 --- a/muse/muse/synth.cpp +++ b/muse/muse/synth.cpp @@ -187,9 +187,6 @@ SynthI::SynthI()        _sif        = 0;        // setVolume(1.0);        // setPan(0.0); -      _instrument = this; -//      for (int ch = 0; ch < MIDI_CHANNELS; ++ch) -//            _channel[ch] = new MidiChannel(this, ch);        }  //--------------------------------------------------------- @@ -200,8 +197,6 @@ SynthI::~SynthI()        {        deactivate2();        deactivate3(); -//      for (int ch = 0; ch < MIDI_CHANNELS; ++ch) -//            delete _channel[ch];        }  //--------------------------------------------------------- @@ -211,8 +206,6 @@ SynthI::~SynthI()  void SynthI::setName(const QString& s)        {        Track::setName(s); -//      for (int ch = 0; ch < MIDI_CHANNELS; ++ch) -//            _channel[ch]->setDefaultName();        }  //--------------------------------------------------------- diff --git a/muse/muse/synth.h b/muse/muse/synth.h index 5ac241fd..62ae5c05 100644 --- a/muse/muse/synth.h +++ b/muse/muse/synth.h @@ -179,6 +179,9 @@ class SynthI : public AudioTrack, public MidiOut, public MidiInstrument        bool isActivated() const         { return synthesizer && _sif; }        virtual bool hasAuxSend() const  { return _sif->hasAuxSend(); }        void processMidi(unsigned fromTick, unsigned toTick, unsigned fromFrame, unsigned toFrame); + +      virtual MidiOut* midiOut() { return this; } +      virtual MidiInstrument* instrument() { return this; }        };  //--------------------------------------------------------- diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp index 425b32fb..6e0e4a99 100644 --- a/muse/muse/track.cpp +++ b/muse/muse/track.cpp @@ -977,29 +977,29 @@ void Track::activate2()        foreach(Route r, _outRoutes) {              if (r.dst.type == RouteNode::JACKMIDIPORT) {                    audioDriver->connect(_jackPort[0], r.dst.port); -                  r.dst.disconnected = false; +                  r.disconnected = false;                    }              else if (r.dst.type == RouteNode::AUDIOPORT) {                    audioDriver->connect(_jackPort[r.src.channel], r.dst.port); -                  r.dst.disconnected = false; +                  r.disconnected = false;                    }              else if (r.dst.type == RouteNode::MIDIPORT) {                    midiDriver->connect(_alsaPort[0], r.dst.port); -                  r.dst.disconnected = false; +                  r.disconnected = false;                    }              }        foreach(Route r, _inRoutes) {              if (r.src.type == RouteNode::JACKMIDIPORT) {                    audioDriver->connect(r.src.port, _jackPort[0]); -                  r.src.disconnected = false; +                  r.disconnected = false;                    }              else if (r.src.type == RouteNode::AUDIOPORT) {                    audioDriver->connect(r.src.port, _jackPort[r.dst.channel]); -                  r.src.disconnected = false; +                  r.disconnected = false;                    }              else if (r.src.type == RouteNode::MIDIPORT) {                    midiDriver->connect(r.src.port, _alsaPort[0]); -                  r.src.disconnected = false; +                  r.disconnected = false;                    }              }        } @@ -1014,29 +1014,29 @@ void Track::deactivate()  // printf("deactivate<%s>\n", name().toLatin1().data());        foreach(Route r, _outRoutes) {              if (r.dst.type == RouteNode::JACKMIDIPORT) { -                  r.dst.disconnected = true; +                  r.disconnected = true;                    audioDriver->disconnect(_jackPort[0], r.dst.port);                    }              else if (r.dst.type == RouteNode::AUDIOPORT) {                    audioDriver->disconnect(_jackPort[r.src.channel], r.dst.port); -                  r.dst.disconnected = true; +                  r.disconnected = true;                    }              else if (r.dst.type == RouteNode::MIDIPORT) { -                  r.dst.disconnected = true; +                  r.disconnected = true;                    midiDriver->disconnect(_alsaPort[0], r.dst.port);                    }              }        foreach(Route r, _inRoutes) {              if (r.src.type == RouteNode::JACKMIDIPORT) { -                  r.src.disconnected = true; +                  r.disconnected = true;                    audioDriver->disconnect(r.src.port, _jackPort[0]);                    }              else if (r.src.type == RouteNode::AUDIOPORT) { -                  r.src.disconnected = true; +                  r.disconnected = true;                    audioDriver->disconnect(r.src.port, _jackPort[r.dst.channel]);                    }              else if (r.src.type == RouteNode::MIDIPORT) { -                  r.src.disconnected = true; +                  r.disconnected = true;                    midiDriver->disconnect(r.src.port, _alsaPort[0]);                    }              } diff --git a/muse/muse/track.h b/muse/muse/track.h index 7940aa75..d71a9e64 100644 --- a/muse/muse/track.h +++ b/muse/muse/track.h @@ -46,7 +46,7 @@ class PartList;  class Part;  class MidiOutPort;  class MidiInPort; -class MidiChannel; +class MidiOut;  #ifndef __APPLE__  // actually it should check for ALSA but I don't know how to do that @@ -325,8 +325,12 @@ class Track : public QObject {        void setDeviceId(int val) { _deviceId = val; }        virtual bool muteDefault() const { return false; } +      virtual MidiOut* midiOut() { return 0;     } +      virtual MidiInstrument* instrument() { return 0; }        }; +Q_DECLARE_METATYPE(class Track*); +  //---------------------------------------------------------  //   MidiTrackBase  //--------------------------------------------------------- | 
