diff options
| author | terminator356 <termtech@rogers.com> | 2014-01-07 02:00:22 -0500 | 
|---|---|---|
| committer | terminator356 <termtech@rogers.com> | 2014-01-07 02:00:22 -0500 | 
| commit | 7a6952bbdbcf8bd6573543d1c28e6fa75d50d4e4 (patch) | |
| tree | cc4f8980591848591ba05389cf1791d8c611d4d1 | |
| parent | 42ecd9fd47fe44c999bfd7f4f051179806735b0a (diff) | |
Instrument can now be changed from trackinfo panel. Tweaks, cleanups.
Midi instrument can now be changed from midi track info panel.
Some minor code tweaks, code cleanup in mtrackinfo.cpp, confmport.cpp.
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | muse2/muse/conf.cpp | 2 | ||||
| -rw-r--r-- | muse2/muse/confmport.cpp | 98 | ||||
| -rw-r--r-- | muse2/muse/confmport.h | 4 | ||||
| -rw-r--r-- | muse2/muse/instruments/minstrument.cpp | 26 | ||||
| -rw-r--r-- | muse2/muse/instruments/minstrument.h | 3 | ||||
| -rw-r--r-- | muse2/muse/widgets/mtrackinfo.cpp | 508 | ||||
| -rw-r--r-- | muse2/muse/widgets/mtrackinfo.h | 3 | ||||
| -rw-r--r-- | muse2/muse/widgets/mtrackinfobase.ui | 452 | 
9 files changed, 455 insertions, 648 deletions
@@ -1,3 +1,10 @@ +06.01.2014: +         - Midi instrument can now be changed from midi track info panel. (Tim)  +         - Some minor code tweaks, code cleanup in mtrackinfo.cpp, confmport.cpp.  +06.01.2014: +         - Added (and fixed) Roland SD-50 .idf file by Patrick. Needs more work: split in two .idfs (Tim) +         - Added GM2 .idf file created by me Tim. +         - Fixed a couple of improper "&apos" xml substitutions in xml.cpp  17.10.2013:           - Fixed drag&drop plugins sometimes not working when built with optimize (rj)  10.10.2013: diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 56d648ad..2d2a35e2 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -1625,7 +1625,7 @@ void MidiFileConfig::updateValues()        {        importDefaultInstr->clear();        for(MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i)  -        if(!dynamic_cast<MusECore::SynthI*>(*i))      // Sorry, no synths for now. +        if(!(*i)->isSynti())                            // Sorry, no synths for now.            importDefaultInstr->addItem((*i)->iname());        int idx = importDefaultInstr->findText(MusEGlobal::config.importMidiDefaultInstr);        if(idx != -1) diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index b0e68b09..ddd8d2a5 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -297,81 +297,6 @@ void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item)      return;    switch(col)    { -    // Enabled: Use editor (Not good - only responds if text changed. We need to respond always). -    // Disabled: Use pop-up menu. DELETETHIS? -    #if 0 -    case DEVCOL_DEF_IN_CHANS: -    { -      QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text(); -      int no = atoi(id.toLatin1().constData()) - 1; -      if(no < 0 || no >= MIDI_PORTS) -        return; -      int allch = (1 << MIDI_CHANNELS) - 1;   -      int ch = allch & string2bitmap(s);   -      MusEGlobal::midiPorts[no].setDefaultInChannels(ch); -       -      if(!MusEGlobal::song->midis()->empty() && MusEGlobal::midiPorts[no].device())  // Only if there are tracks, and device is valid.  -      { -        int ret = QMessageBox::question(this, tr("Default input connections"), -                                      tr("Setting will apply to new midi tracks.\n" -                                          "Do you want to apply to all existing midi tracks now?"), -                                      QMessageBox::Yes | QMessageBox::No, -                                      QMessageBox::No); -        if(ret == QMessageBox::Yes)  -        { -          MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); -          for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) -          { -            // Remove all routes from this port to the tracks first. -            MusEGlobal::audio->msgRemoveRoute(MusECore::Route(no, allch), MusECore::Route(*it, allch)); -            if(ch) -              MusEGlobal::audio->msgAddRoute(MusECore::Route(no, ch), MusECore::Route(*it, ch)); -          }   -        }   -      } -      MusEGlobal::song->update(); -    } -    break;     -    #endif -     -    // Enabled: Use editor (Not good - only responds if text changed. We need to respond always). -    // Disabled: Use pop-up menu. -    // Only turn on if and when multiple output routes are supported. DELETETHIS? -    #if 0 -    case DEVCOL_DEF_OUT_CHANS: -    { -      QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text(); -      int no = atoi(id.toLatin1().constData()) - 1; -      if(no < 0 || no >= MIDI_PORTS) -        return; -      int allch = (1 << MIDI_CHANNELS) - 1;   -      int ch = allch & string2bitmap(s);   -      MusEGlobal::midiPorts[no].setDefaultOutChannels(ch); -       -      if(!MusEGlobal::song->midis()->empty() && MusEGlobal::midiPorts[no].device())  // Only if there are tracks, and device is valid.  -      { -        int ret = QMessageBox::question(this, tr("Default output connections"), -                                      tr("Setting will apply to new midi tracks.\n" -                                          "Do you want to apply to all existing midi tracks now?"), -                                      QMessageBox::Yes | QMessageBox::No, -                                      QMessageBox::No); -        if(ret == QMessageBox::Yes)  -        { -          MusECore::MidiTrackList* mtl = MusEGlobal::song->midis(); -          for(MusECore::iMidiTrack it = mtl->begin(); it != mtl->end(); ++it) -          { -            // Remove all routes from the tracks to this port first. -            MusEGlobal::audio->msgRemoveRoute(MusECore::Route(*it, allch), MusECore::Route(no, allch)); -            if(ch) -              MusEGlobal::audio->msgAddRoute(MusECore::Route(*it, ch), MusECore::Route(no, ch)); -          }   -        }   -      } -      MusEGlobal::song->update(); -    } -    break;     -    # endif -          case DEVCOL_NAME:      {        QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text(); @@ -652,9 +577,6 @@ void MPConfig::rbClicked(QTableWidgetItem* item)                      act->setEnabled(!MusEGlobal::song->midis()->empty());  // && MusEGlobal::midiPorts[no].device()); DELETETHIS                      connect(defpup, SIGNAL(triggered(QAction*)), SLOT(changeDefInputRoutes(QAction*))); -                    // DELETETHIS 2 -                    //connect(defpup, SIGNAL(aboutToHide()), MusEGlobal::muse, SLOT(routingPopupMenuAboutToHide())); -                    //defpup->popup(QCursor::pos());                      defpup->exec(QCursor::pos());                      delete defpup;                      defpup = 0; @@ -763,16 +685,12 @@ void MPConfig::rbClicked(QTableWidgetItem* item)                          for(imap i = mapALSA.begin(); i != mapALSA.end(); ++i)                           {                            int idx = i->second; -                          //if(idx > sz)           // Sanity check DELETETHIS 2 -                          //  continue;                            QString s(i->first.c_str());                            MusECore::MidiDevice* md = MusEGlobal::midiDevices.find(s, MusECore::MidiDevice::ALSA_MIDI);                            if(md)                            { -                            //if(!dynamic_cast<MidiAlsaDevice*>(md)) DELETETHIS                              if(md->deviceType() != MusECore::MidiDevice::ALSA_MIDI)                                  continue; -                                                            act = pup->addAction(md->name());                              act->setData(idx);                              act->setCheckable(true); @@ -970,20 +888,8 @@ void MPConfig::rbClicked(QTableWidgetItem* item)                    if (dev && dev->isSynti())                          return;                    if (instrPopup == 0) -                        instrPopup = new QMenu(this); -                  instrPopup->clear(); -                  for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i -                     != MusECore::midiInstruments.end(); ++i)  -                     { -                        // By T356. -                        // Do not list synths. Although it is possible to assign a synth -                        //  as an instrument to a non-synth device, we should not allow this. -                        // (One reason is that the 'show gui' column is then enabled, which -                        //  makes no sense for a non-synth device). -                        MusECore::SynthI* si = dynamic_cast<MusECore::SynthI*>(*i); -                        if(!si) -                          instrPopup->addAction((*i)->iname()); -                     } +                        instrPopup = new PopupMenu(this); +                  MusECore::MidiInstrument::populateInstrPopup(instrPopup, port->instrument(), false);                       QAction* act = instrPopup->exec(ppt);                    if(!act) diff --git a/muse2/muse/confmport.h b/muse2/muse/confmport.h index 39e29bb6..4b5635ae 100644 --- a/muse2/muse/confmport.h +++ b/muse2/muse/confmport.h @@ -50,8 +50,8 @@ class PopupMenu;  class MPConfig : public QDialog, Ui::SynthConfigBase {        Q_OBJECT -      QMenu* instrPopup; -      MusEGui::PopupMenu* defpup; +      PopupMenu* instrPopup; +      PopupMenu* defpup;        int _showAliases; // -1: None. 0: First aliases. 1: Second aliases etc.        void setWhatsThis(QTableWidgetItem *item, int col);        void setToolTip(QTableWidgetItem *item, int col); diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index c119f0bc..ecfc2da4 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -472,13 +472,13 @@ MType MidiInstrument::midiType() const  void MidiInstrument::reset(int portNo)  {        MusECore::MidiPort* port = &MusEGlobal::midiPorts[portNo]; -      if(port->device() == 0)  // p4.0.15 +      if(port->device() == 0)          return;        MusECore::MidiPlayEvent ev;        ev.setType(0x90);        ev.setPort(portNo); -      ev.setTime(0);          // p4.0.15 +      ev.setTime(0);        for (int chan = 0; chan < MIDI_CHANNELS; ++chan)         { @@ -692,7 +692,7 @@ void SysEx::write(int level, Xml& xml)  void MidiInstrument::readMidiState(Xml& xml)  { -  // p4.0.27 A kludge to support old midistates by wrapping them in the proper header. +  // A kludge to support old midistates by wrapping them in the proper header.    _tmpMidiStateVersion = 1;    // Assume old (unmarked) first version 1.    for (;;)     { @@ -918,7 +918,6 @@ void MidiInstrument::read(Xml& xml)                          else if (tag == "Controller") {                                MidiController* mc = new MidiController();                                mc->read(xml); -                              // Added by Tim. Copied from muse 2.                                //                                // HACK: make predefined "Program" controller overloadable                                // @@ -1041,6 +1040,25 @@ void MidiInstrument::write(int level, Xml& xml)  //--------------------------------------------------------- +//   populateInstrPopup  (static) +//--------------------------------------------------------- + +void MidiInstrument::populateInstrPopup(MusEGui::PopupMenu* menu, MidiInstrument* /*current*/, bool show_synths) +      { +      menu->clear(); +      for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i +          != MusECore::midiInstruments.end(); ++i)  +          { +            // Do not list synths. Although it is possible to assign a synth +            //  as an instrument to a non-synth device, we should not allow this. +            // (One reason is that the 'show gui' column is then enabled, which +            //  makes no sense for a non-synth device). +            if(show_synths || !(*i)->isSynti()) +              menu->addAction((*i)->iname()); +          } +    } + +//---------------------------------------------------------  //   populatePatchPopup  //--------------------------------------------------------- diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h index 5a520e67..4f532719 100644 --- a/muse2/muse/instruments/minstrument.h +++ b/muse2/muse/instruments/minstrument.h @@ -202,8 +202,8 @@ class MidiInstrument {        const QString& iname() const      { return _name; }        void setIName(const QString& txt) { _name = txt; }        MType midiType() const; +      virtual bool isSynti() const     { return false; } -      //MidiInstrument& uniqueCopy(const MidiInstrument&);        // Assign will 'delete' all existing patches and groups from the instrument.        MidiInstrument& assign(const MidiInstrument&);        QString filePath() const               { return _filePath;   } @@ -240,6 +240,7 @@ class MidiInstrument {        virtual void reset(int);         virtual QString getPatchName(int,int,bool) const;        virtual void populatePatchPopup(MusEGui::PopupMenu*, int, bool); +      static void populateInstrPopup(MusEGui::PopupMenu*, MidiInstrument* current = 0, bool show_synths = false);  // Static        void read(Xml&);        void write(int level, Xml&); diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp index a73eb212..2872385c 100644 --- a/muse2/muse/widgets/mtrackinfo.cpp +++ b/muse2/muse/widgets/mtrackinfo.cpp @@ -125,6 +125,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid    progRecButton->setFocusPolicy(Qt::NoFocus);    volRecButton->setFocusPolicy(Qt::NoFocus);    panRecButton->setFocusPolicy(Qt::NoFocus); +  instrPushButton->setFocusPolicy(Qt::NoFocus);    iPatch->setFocusPolicy(Qt::NoFocus);    iOutput->setFocusPolicy(Qt::NoFocus); @@ -153,33 +154,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid    //trackNameLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));    if(selected) -  {      trackNameLabel->setObjectName(selected->cname()); -     -    /*QPalette pal; -    QColor c; -    //pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue -    if(selected->type() == MusECore::Track::DRUM) -      c = MusEGlobal::config.drumTrackLabelBg;  -    else   -      c = MusEGlobal::config.midiTrackLabelBg;  -     -    QLinearGradient gradient(trackNameLabel->geometry().topLeft(), trackNameLabel->geometry().bottomLeft()); -    //gradient.setColorAt(0, c.darker()); -    //gradient.setColorAt(0, c); -    //gradient.setColorAt(1, c.darker()); -    gradient.setColorAt(0, c.lighter()); -    gradient.setColorAt(1, c); -    //palette.setBrush(QPalette::Button, gradient); -    //palette.setBrush(QPalette::Window, gradient); -    pal.setBrush(trackNameLabel->backgroundRole(), gradient); -    trackNameLabel->setPalette(pal);  */ -  }  -  //else -  //{ -  //  pal.setColor(trackNameLabel->backgroundRole(), MusEGlobal::config.midiTrackLabelBg);  -  //  trackNameLabel->setPalette(pal); -  //}      //trackNameLabel->setStyleSheet(QString("background-color: ") + QColor(0, 160, 255).name()); // Med blue    trackNameLabel->setWordWrap(true); @@ -192,18 +167,27 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid    setLabelText();    setLabelFont(); +  MusECore::MidiInstrument* minstr = NULL;  +  MusECore::MidiTrack* track = static_cast<MusECore::MidiTrack*>(selected); +  if(track) +    minstr = MusEGlobal::midiPorts[track->outPort()].instrument(); +  if(minstr) +  { +    instrPushButton->setText(minstr->iname()); +    if(minstr->isSynti()) +      instrPushButton->setEnabled(false); +    else +      instrPushButton->setEnabled(true); +  } +  else +    instrPushButton->setText(tr("<unknown>")); +      //setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding)); -  connect(iPatch, SIGNAL(released()), SLOT(instrPopup())); - -  //pop = new QMenu(iPatch); -  //pop->setCheckable(false); // not needed in Qt4 +  connect(instrPushButton, SIGNAL(released()), SLOT(instrPopup())); +  connect(iPatch, SIGNAL(released()), SLOT(patchPopup())); -  // Removed by Tim. p3.3.9 -  //connect(iName, SIGNAL(returnPressed()), SLOT(iNameChanged())); -      connect(iOutputChannel, SIGNAL(valueChanged(int)), SLOT(iOutputChannelChanged(int))); -  ///connect(iInputChannel, SIGNAL(textChanged(const QString&)), SLOT(iInputChannelChanged(const QString&)));    connect(iHBank, SIGNAL(valueChanged(int)), SLOT(iProgHBankChanged()));    connect(iLBank, SIGNAL(valueChanged(int)), SLOT(iProgLBankChanged()));    connect(iProgram, SIGNAL(valueChanged(int)), SLOT(iProgramChanged())); @@ -220,7 +204,6 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid    connect(iPan, SIGNAL(valueChanged(int)), SLOT(iPanChanged(int)));    connect(iPan, SIGNAL(ctrlDoubleClicked()), SLOT(iPanDoubleClicked()));    connect(iOutput, SIGNAL(activated(int)), SLOT(iOutputPortChanged(int))); -  ///connect(iInput, SIGNAL(textChanged(const QString&)), SLOT(iInputPortChanged(const QString&)));    connect(recordButton, SIGNAL(clicked()), SLOT(recordClicked()));    connect(progRecButton, SIGNAL(clicked()), SLOT(progRecClicked()));    connect(volRecButton, SIGNAL(clicked()), SLOT(volRecClicked())); @@ -259,11 +242,6 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid    connect(iLen, SIGNAL(escapePressed()), SIGNAL(escapePressed()));    connect(iKompr, SIGNAL(escapePressed()), SIGNAL(escapePressed()));    connect(iPan, SIGNAL(escapePressed()), SIGNAL(escapePressed())); -   -  // TODO: Works OK, but disabled for now, until we figure out what to do about multiple out routes and display values... -  // Enabled (for Midi Port to Audio Input routing). p4.0.14 Tim. -  //oRButton->setEnabled(false); -  //oRButton->setVisible(false);    connect(oRButton, SIGNAL(pressed()), SLOT(outRoutesPressed()));    connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t))); @@ -278,7 +256,6 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, MusECore::Track* sel_track) : QWid  void MidiTrackInfo::heartBeat()  { -  ///if(!showTrackinfoFlag || !selected)    if(_blockHeartbeatCount < 0)  // error    {      fprintf(stderr, "ERROR: MidiTrackInfo::heartBeat: _blockHeartbeatCount is < 0, resetting to 0\n"); @@ -297,81 +274,44 @@ void MidiTrackInfo::heartBeat()        int outChannel = track->outChannel();        int outPort    = track->outPort(); -      ///int ichMask    = track->inChannelMask(); -      //int iptMask    = track->inPortMask(); -      ///unsigned int iptMask    = track->inPortMask(); -              MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outPort]; -      // Set record echo. -      //if(recEchoButton->isChecked() != track->recEcho()) -      //{ -      //  recEchoButton->blockSignals(true); -      //  recEchoButton->setChecked(track->recEcho()); -      //  recEchoButton->blockSignals(false); -      //} -              // Check for detection of midi general activity on chosen channels...        int mpt = 0; -      //int mch = 0;        MusECore::RouteList* rl = track->inRoutes();        MusECore::ciRoute r = rl->begin(); -      //for( ; mpt < MIDI_PORTS; ++mpt)        for( ; r != rl->end(); ++r)        { -        //if(!r->isValid() || ((r->type != Route::ALSA_MIDI_ROUTE) && (r->type != Route::JACK_MIDI_ROUTE))) -        //if(!r->isValid() || (r->type != Route::MIDI_DEVICE_ROUTE)) -        if(!r->isValid() || (r->type != MusECore::Route::MIDI_PORT_ROUTE))   // p3.3.49 +        if(!r->isValid() || (r->type != MusECore::Route::MIDI_PORT_ROUTE))            continue;          // NOTE: TODO: Code for channelless events like sysex, ** IF we end up using the 'special channel 17' method.          //if(r->channel == -1) -        if(r->channel == -1 || r->channel == 0)  // p3.3.50 +        if(r->channel == -1 || r->channel == 0)            continue;          // No port assigned to the device? -        //mpt = r->device->midiPort(); -        mpt = r->midiPort;              // p3.3.49 +        mpt = r->midiPort;          if(mpt < 0 || mpt >= MIDI_PORTS)            continue; -        //for(; mch < MIDI_CHANNELS; ++mch) -        //{ -          //if(MusEGlobal::midiPorts[mpt].syncInfo().actDetect(mch) && (iptMask & (1 << mpt)) && (ichMask & (1 << mch)) ) -          //if((iptMask & bitShiftLU[mpt]) && (MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & ichMask) ) -          //if(MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & bitShiftLU[r->channel])  -          if(MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & r->channel)          // p3.3.50 Use new channel mask. +        if(MusEGlobal::midiPorts[mpt].syncInfo().actDetectBits() & r->channel) +        { +          if(!_midiDetect)            { -            //if(iChanTextLabel->paletteBackgroundColor() != green) -            //  iChanTextLabel->setPaletteBackgroundColor(green); -            //if(iChanDetectLabel->pixmap() != greendotIcon) -            if(!_midiDetect) -            { -              //printf("Arranger::midiTrackInfoHeartBeat setting green icon\n"); -           -              _midiDetect = true; -              //iChanDetectLabel->setPixmap(*greendotIcon); -              iChanDetectLabel->setPixmap(*redLedIcon); -            }   -            break;   -          } -        //} +            _midiDetect = true; +            iChanDetectLabel->setPixmap(*redLedIcon); +          }   +          break;   +        }        }        // No activity detected? -      //if(mch == MIDI_CHANNELS) -      //if(mpt == MIDI_PORTS)        if(r == rl->end())        { -        //if(iChanTextLabel->paletteBackgroundColor() != darkGreen) -        //  iChanTextLabel->setPaletteBackgroundColor(darkGreen); -        //if(iChanDetectLabel->pixmap() != darkgreendotIcon)          if(_midiDetect)          { -          //printf("Arranger::midiTrackInfoHeartBeat setting darkgreen icon\n"); -                      _midiDetect = false; -          //iChanDetectLabel->setPixmap(*darkgreendotIcon);            iChanDetectLabel->setPixmap(*darkRedLedIcon);          }          } @@ -381,8 +321,6 @@ void MidiTrackInfo::heartBeat()        {          if(program != MusECore::CTRL_VAL_UNKNOWN)          { -          //printf("Arranger::midiTrackInfoHeartBeat setting program to unknown\n"); -                      program = MusECore::CTRL_VAL_UNKNOWN;            if(iHBank->value() != 0)            { @@ -427,7 +365,7 @@ void MidiTrackInfo::heartBeat()        }        else        { -        // p4.0.27 The optimizing below, to avoid repeatedly calling getPatchName, generally worked OK.  +        // The optimizing below, to avoid repeatedly calling getPatchName, generally worked OK.           // But Fluidsynth revealed a flaw. When loading a song, updateTrackInfo is called which correctly           //  sets program = nprogram. But a synth will not receive midistate sysexes until later.           // With Fluidsynth, that messed up our optimizing because the soundfont has not loaded yet.  @@ -447,30 +385,20 @@ void MidiTrackInfo::heartBeat()          {                program = nprogram; -              //int hb, lb, pr; -              //if (program == MusECore::CTRL_VAL_UNKNOWN) { -              //      hb = lb = pr = 0; -              //      iPatch->setText("---"); -              //      } -              //else  -              //{ -                    MusECore::MidiInstrument* instr = mp->instrument(); -                    const QString name = instr->getPatchName(outChannel, program, track->isDrumTrack()); -                    if(iPatch->text() != name) -                      iPatch->setText(name); -   -                    int hb = ((program >> 16) & 0xff) + 1; -                    if (hb == 0x100) -                          hb = 0; -                    int lb = ((program >> 8) & 0xff) + 1; -                    if (lb == 0x100) -                          lb = 0; -                    int pr = (program & 0xff) + 1; -                    if (pr == 0x100) -                          pr = 0; -              //} -               -              //printf("Arranger::midiTrackInfoHeartBeat setting program\n"); +              MusECore::MidiInstrument* instr = mp->instrument(); +              const QString name = instr->getPatchName(outChannel, program, track->isDrumTrack()); +              if(iPatch->text() != name) +                iPatch->setText(name); + +              int hb = ((program >> 16) & 0xff) + 1; +              if (hb == 0x100) +                    hb = 0; +              int lb = ((program >> 8) & 0xff) + 1; +              if (lb == 0x100) +                    lb = 0; +              int pr = (program & 0xff) + 1; +              if (pr == 0x100) +                    pr = 0;                if(iHBank->value() != hb)                { @@ -498,12 +426,7 @@ void MidiTrackInfo::heartBeat()        int mn = mc->minVal();        int v = mp->hwCtrlState(outChannel, MusECore::CTRL_VOLUME);        if(v == MusECore::CTRL_VAL_UNKNOWN) -      //{ -        //v = mc->initVal(); -        //if(v == MusECore::CTRL_VAL_UNKNOWN) -        //  v = 0;          v = mn - 1; -      //}          else          // Auto bias...          v -= mc->bias(); @@ -512,10 +435,7 @@ void MidiTrackInfo::heartBeat()          volume = v;          if(iLautst->value() != v)          { -          //printf("Arranger::midiTrackInfoHeartBeat setting volume\n"); -                      iLautst->blockSignals(true); -          //iLautst->setRange(mn - 1, mc->maxVal());            iLautst->setValue(v);            iLautst->blockSignals(false);          } @@ -525,12 +445,7 @@ void MidiTrackInfo::heartBeat()        mn = mc->minVal();        v = mp->hwCtrlState(outChannel, MusECore::CTRL_PANPOT);        if(v == MusECore::CTRL_VAL_UNKNOWN) -      //{ -        //v = mc->initVal(); -        //if(v == MusECore::CTRL_VAL_UNKNOWN) -        //  v = 0;          v = mn - 1; -      //}          else          // Auto bias...          v -= mc->bias(); @@ -539,31 +454,11 @@ void MidiTrackInfo::heartBeat()          pan = v;          if(iPan->value() != v)          { -          //printf("Arranger::midiTrackInfoHeartBeat setting pan\n"); -                      iPan->blockSignals(true); -          //iPan->setRange(mn - 1, mc->maxVal());            iPan->setValue(v);            iPan->blockSignals(false);          }          }   -       -      // Does it include a midi controller value adjustment? Then handle it... -      //if(flags & SC_MIDI_CONTROLLER) -      //  seek(); - -      /* -      if(iTransp->value() != track->transposition) -        iTransp->setValue(track->transposition); -      if(iAnschl->value() != track->velocity) -        iAnschl->setValue(track->velocity); -      if(iVerz->value() != track->delay) -        iVerz->setValue(track->delay); -      if(iLen->value() != track->len) -        iLen->setValue(track->len); -      if(iKompr->value() != track->compression) -        iKompr->setValue(track->compression); -      */        }        break; @@ -583,8 +478,6 @@ void MidiTrackInfo::heartBeat()  void MidiTrackInfo::configChanged()        { -      //printf("MidiTrackInfo::configChanged\n"); -              //if (MusEGlobal::config.canvasBgPixmap.isEmpty()) {        //      canvas->setBg(MusEGlobal::config.partCanvasBg);        //      canvas->setBg(QPixmap()); @@ -629,7 +522,6 @@ void MidiTrackInfo::setLabelText()        {            QPalette pal;          QColor c; -        //pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue          if(track->type() == MusECore::Track::DRUM)            c = MusEGlobal::config.drumTrackLabelBg;           else if (track->type() == MusECore::Track::MIDI) @@ -640,14 +532,9 @@ void MidiTrackInfo::setLabelText()            printf("THIS SHOULD NEVER HAPPEN: track is not a MIDI track in MidiTrackInfo::setLabelText()!\n");          QLinearGradient gradient(trackNameLabel->geometry().topLeft(), trackNameLabel->geometry().bottomLeft()); -        //gradient.setColorAt(0, c.darker()); -        //gradient.setColorAt(0, c); -        //gradient.setColorAt(1, c.darker());          gradient.setColorAt(0, c);          gradient.setColorAt(0.5, c.lighter());          gradient.setColorAt(1, c); -        //palette.setBrush(QPalette::Button, gradient); -        //palette.setBrush(QPalette::Window, gradient);          pal.setBrush(trackNameLabel->backgroundRole(), gradient);          trackNameLabel->setPalette(pal);        }   @@ -659,10 +546,6 @@ void MidiTrackInfo::setLabelText()  void MidiTrackInfo::setLabelFont()  { -      //if(!selected) -      //  return; -      //MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected; -                // Use the new font #6 I created just for these labels (so far).        // Set the label's font.        trackNameLabel->setFont(MusEGlobal::config.fonts[6]); @@ -686,8 +569,8 @@ void MidiTrackInfo::iOutputChannelChanged(int channel)              track->setOutChanAndUpdate(channel);              MusEGlobal::audio->msgIdle(false); -            MusEGlobal::audio->msgUpdateSoloStates();                   // p4.0.14 -            MusEGlobal::song->update(SC_MIDI_TRACK_PROP);               // +            MusEGlobal::audio->msgUpdateSoloStates(); +            MusEGlobal::song->update(SC_MIDI_TRACK_PROP);              --_blockHeartbeatCount;              }        } @@ -711,8 +594,8 @@ void MidiTrackInfo::iOutputPortChanged(int index)        track->setOutPortAndUpdate(port_num);        MusEGlobal::audio->msgIdle(false); -      MusEGlobal::audio->msgUpdateSoloStates();                   // p4.0.14 -      MusEGlobal::song->update(SC_MIDI_TRACK_PROP);               // +      MusEGlobal::audio->msgUpdateSoloStates(); +      MusEGlobal::song->update(SC_MIDI_TRACK_PROP);        --_blockHeartbeatCount;        } @@ -727,7 +610,6 @@ void MidiTrackInfo::inRoutesPressed()    if(!selected->isMidiTrack())      return; -  //RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();    RoutePopupMenu* pup = new RoutePopupMenu();    pup->exec(QCursor::pos(), selected, false);    delete pup; @@ -745,7 +627,6 @@ void MidiTrackInfo::outRoutesPressed()    if(!selected->isMidiTrack())      return; -  //RoutePopupMenu* pup = MusEGlobal::muse->getRoutingPopupMenu();    RoutePopupMenu* pup = new RoutePopupMenu();    pup->exec(QCursor::pos(), selected, true);    delete pup; @@ -1128,13 +1009,11 @@ void MidiTrackInfo::iPanChanged(int val)      }  //--------------------------------------------------------- -//   instrPopupActivated +//   patchPopupActivated  //--------------------------------------------------------- -void MidiTrackInfo::instrPopupActivated(QAction* act) +void MidiTrackInfo::patchPopupActivated(QAction* act)  { -  //printf("MidiTrackInfo::instrPopupActivated\n");  -      if(act && selected)     {      int rv = act->data().toInt(); @@ -1160,6 +1039,46 @@ void MidiTrackInfo::instrPopup()        {        if(!selected)          return; +      MusECore::MidiTrack* track = static_cast<MusECore::MidiTrack*>(selected); +      int port = track->outPort(); +      MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); +      PopupMenu* pup = new PopupMenu(false); +       +      MusECore::MidiInstrument::populateInstrPopup(pup, instr, false); + +      if(pup->actions().count() == 0) +      { +        delete pup; +        return; +      }   +       +      QAction *act = pup->exec(instrPushButton->mapToGlobal(QPoint(10,5))); +      if(act)  +      { +        QString s = act->text(); +        for (MusECore::iMidiInstrument i = MusECore::midiInstruments.begin(); i != MusECore::midiInstruments.end(); ++i)  +        { +          if((*i)->iname() == s)  +          { +            MusEGlobal::midiPorts[port].setInstrument(*i); +            // Make sure device initializations are sent if necessary. +            MusEGlobal::audio->msgInitMidiDevices(false);  // false = Don't force +            MusEGlobal::song->update(); +            break; +          } +        } +      } +      delete pup;       +      } + +//--------------------------------------------------------- +//   patchPopup +//--------------------------------------------------------- + +void MidiTrackInfo::patchPopup() +      { +      if(!selected) +        return;        MusECore::MidiTrack* track = (MusECore::MidiTrack*)selected;        int channel = track->outChannel();        int port    = track->outPort(); @@ -1174,8 +1093,7 @@ void MidiTrackInfo::instrPopup()          return;        }   -      connect(pup, SIGNAL(triggered(QAction*)), SLOT(instrPopupActivated(QAction*))); -      //connect(pup, SIGNAL(hovered(QAction*)), SLOT(instrPopupActivated(QAction*))); +      connect(pup, SIGNAL(triggered(QAction*)), SLOT(patchPopupActivated(QAction*)));        QAction *act = pup->exec(iPatch->mapToGlobal(QPoint(10,5)));        if(act)  @@ -1234,20 +1152,10 @@ void MidiTrackInfo::iProgHBankDoubleCLicked()      if(lastv == MusECore::CTRL_VAL_UNKNOWN)      {        int kiv = mctl->initVal(); -      //int kiv = lrint(_knob->value());        if(kiv == MusECore::CTRL_VAL_UNKNOWN)          kiv = 0; -      //else -      //{   -        //if(kiv < mctrl->minVal()) -        //  kiv = mctrl->minVal(); -        //if(kiv > mctrl->maxVal()) -        //  kiv = mctrl->maxVal(); -        //kiv += mctrl->bias(); -      //}            ++_blockHeartbeatCount; -      //MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, num, kiv);        MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, kiv);        MusEGlobal::audio->msgPlayMidiEvent(&ev);        --_blockHeartbeatCount; @@ -1290,8 +1198,6 @@ void MidiTrackInfo::iProgHBankDoubleCLicked()        MusEGlobal::audio->msgSetHwCtrlState(mp, chan, MusECore::CTRL_PROGRAM, MusECore::CTRL_VAL_UNKNOWN);        --_blockHeartbeatCount;      } -//     MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, curv); -//     MusEGlobal::audio->msgPlayMidiEvent(&ev);    }    MusEGlobal::song->update(SC_MIDI_CONTROLLER); @@ -1324,17 +1230,8 @@ void MidiTrackInfo::iProgLBankDoubleCLicked()      if(lastv == MusECore::CTRL_VAL_UNKNOWN)      {        int kiv = mctl->initVal(); -      //int kiv = lrint(_knob->value());        if(kiv == MusECore::CTRL_VAL_UNKNOWN)          kiv = 0xff0000; -      //else -      //{   -        //if(kiv < mctrl->minVal()) -        //  kiv = mctrl->minVal(); -        //if(kiv > mctrl->maxVal()) -        //  kiv = mctrl->maxVal(); -        //kiv += mctrl->bias(); -      //}            //MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, num, kiv);        MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, kiv); @@ -1420,19 +1317,9 @@ void MidiTrackInfo::iProgramDoubleClicked()      if(lastv == MusECore::CTRL_VAL_UNKNOWN)      {        int kiv = mctl->initVal(); -      //int kiv = lrint(_knob->value());        if(kiv == MusECore::CTRL_VAL_UNKNOWN)          kiv = 0xffff00; -      //else -      //{   -        //if(kiv < mctrl->minVal()) -        //  kiv = mctrl->minVal(); -        //if(kiv > mctrl->maxVal()) -        //  kiv = mctrl->maxVal(); -        //kiv += mctrl->bias(); -      //}     -      //MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, num, kiv);        MusECore::MidiPlayEvent ev(0, port, chan, MusECore::ME_CONTROLLER, MusECore::CTRL_PROGRAM, kiv);        MusEGlobal::audio->msgPlayMidiEvent(&ev);      } @@ -1478,7 +1365,6 @@ void MidiTrackInfo::iLautstDoubleClicked()      if(lastv == MusECore::CTRL_VAL_UNKNOWN)      {        int kiv = mctl->initVal(); -      //int kiv = lrint(_knob->value());        if(kiv == MusECore::CTRL_VAL_UNKNOWN)          // Set volume to 78% of range, so that if range is 0 - 127, then value is 100.          kiv = lround(double(mctl->maxVal() - mctl->minVal()) * 0.7874); @@ -1536,7 +1422,6 @@ void MidiTrackInfo::iPanDoubleClicked()      if(lastv == MusECore::CTRL_VAL_UNKNOWN)      {        int kiv = mctl->initVal(); -      //int kiv = lrint(_knob->value());        if(kiv == MusECore::CTRL_VAL_UNKNOWN)          // Set volume to 50% of range, so that if range is 0 - 127, then value is 64.          kiv = lround(double(mctl->maxVal() - mctl->minVal()) * 0.5); @@ -1608,22 +1493,17 @@ void MidiTrackInfo::updateTrackInfo(MusECore::SongChangedFlags_t flags)          iKompr->blockSignals(false);          int outChannel = track->outChannel(); -        ///int inChannel  = track->inChannelMask();          int outPort    = track->outPort(); -        //int inPort     = track->inPortMask(); -        ///unsigned int inPort     = track->inPortMask();          iOutput->blockSignals(true); -        //iInput->clear();          iOutput->clear();          int item_idx = 0;          for (int i = 0; i < MIDI_PORTS; ++i) {                MusECore::MidiDevice* md = MusEGlobal::midiPorts[i].device();  -              if(!md)  // In the case of this combo box, don't bother listing empty ports.             p4.0.41 +              if(!md)  // In the case of this combo box, don't bother listing empty ports.                  continue; -              //if(!(md->rwFlags() & 1 || md->isSynti()) && (i != outPort))   -              if(!(md->rwFlags() & 1) && (i != outPort))   // Only writeable ports, or current one.    p4.0.41 +              if(!(md->rwFlags() & 1) && (i != outPort))   // Only writeable ports, or current one.                  continue;                QString name;                name.sprintf("%d:%s", i+1, MusEGlobal::midiPorts[i].portname().toLatin1().constData()); @@ -1634,21 +1514,21 @@ void MidiTrackInfo::updateTrackInfo(MusECore::SongChangedFlags_t flags)                }          iOutput->blockSignals(false); -        //iInput->setText(bitmap2String(inPort)); -        ///iInput->setText(u32bitmap2String(inPort)); -         -        //iInputChannel->setText(bitmap2String(inChannel)); -   -        // Removed by Tim. p3.3.9 -        //if (iName->text() != selected->name()) { -        //      iName->setText(selected->name()); -        //      iName->home(false); -        //      } +        MusECore::MidiInstrument* minstr = MusEGlobal::midiPorts[outPort].instrument(); +        if(minstr) +        { +          instrPushButton->setText(minstr->iname()); +          if(minstr->isSynti()) +            instrPushButton->setEnabled(false); +          else +            instrPushButton->setEnabled(true); +        } +        else +          instrPushButton->setText(tr("<unknown>"));          iOutputChannel->blockSignals(true);          iOutputChannel->setValue(outChannel+1);          iOutputChannel->blockSignals(false); -        ///iInputChannel->setText(bitmap2String(inChannel));          // Set record echo.          if(recEchoButton->isChecked() != track->recEcho()) @@ -1658,112 +1538,91 @@ void MidiTrackInfo::updateTrackInfo(MusECore::SongChangedFlags_t flags)            recEchoButton->blockSignals(false);          }          recEchoButton->setIcon(track->recEcho() ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon)); -        //recEchoButton->setIconSize(midiThruOnIcon->size());          } -        int outChannel = track->outChannel(); -        int outPort    = track->outPort(); -        MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outPort]; -        int nprogram = mp->hwCtrlState(outChannel, MusECore::CTRL_PROGRAM); +      int outChannel = track->outChannel(); +      int outPort    = track->outPort(); +      MusECore::MidiPort* mp = &MusEGlobal::midiPorts[outPort]; +      int nprogram = mp->hwCtrlState(outChannel, MusECore::CTRL_PROGRAM); +      if(nprogram == MusECore::CTRL_VAL_UNKNOWN) +      { +        iHBank->blockSignals(true); +        iLBank->blockSignals(true); +        iProgram->blockSignals(true); +        iHBank->setValue(0); +        iLBank->setValue(0); +        iProgram->setValue(0); +        iHBank->blockSignals(false); +        iLBank->blockSignals(false); +        iProgram->blockSignals(false); +         +        program = MusECore::CTRL_VAL_UNKNOWN; +        nprogram = mp->lastValidHWCtrlState(outChannel, MusECore::CTRL_PROGRAM);          if(nprogram == MusECore::CTRL_VAL_UNKNOWN) -        { -          iHBank->blockSignals(true); -          iLBank->blockSignals(true); -          iProgram->blockSignals(true); -          iHBank->setValue(0); -          iLBank->setValue(0); -          iProgram->setValue(0); -          iHBank->blockSignals(false); -          iLBank->blockSignals(false); -          iProgram->blockSignals(false); -           -          program = MusECore::CTRL_VAL_UNKNOWN; -          nprogram = mp->lastValidHWCtrlState(outChannel, MusECore::CTRL_PROGRAM); -          if(nprogram == MusECore::CTRL_VAL_UNKNOWN) -            //iPatch->setText(QString("<unknown>")); -            iPatch->setText(tr("<unknown>")); -          else -          { -            MusECore::MidiInstrument* instr = mp->instrument(); -            iPatch->setText(instr->getPatchName(outChannel, nprogram, track->isDrumTrack())); -          }          -        } +          iPatch->setText(tr("<unknown>"));          else -        //if (program != nprogram)           { -              program = nprogram; +          MusECore::MidiInstrument* instr = mp->instrument(); +          iPatch->setText(instr->getPatchName(outChannel, nprogram, track->isDrumTrack())); +        }          +      } +      else +      { +            program = nprogram; -              //int hb, lb, pr; -              //if (program == MusECore::CTRL_VAL_UNKNOWN) { -              //      hb = lb = pr = 0; -              //      iPatch->setText("---"); -              //      } -              //else  -              //{ -                    MusECore::MidiInstrument* instr = mp->instrument(); -                    iPatch->setText(instr->getPatchName(outChannel, program, track->isDrumTrack())); - -                    int hb = ((program >> 16) & 0xff) + 1; -                    if (hb == 0x100) -                          hb = 0; -                    int lb = ((program >> 8) & 0xff) + 1; -                    if (lb == 0x100) -                          lb = 0; -                    int pr = (program & 0xff) + 1; -                    if (pr == 0x100) -                          pr = 0; -              //} -              iHBank->blockSignals(true); -              iLBank->blockSignals(true); -              iProgram->blockSignals(true); - -              iHBank->setValue(hb); -              iLBank->setValue(lb); -              iProgram->setValue(pr); - -              iHBank->blockSignals(false); -              iLBank->blockSignals(false); -              iProgram->blockSignals(false); -        } -         -        MusECore::MidiController* mc = mp->midiController(MusECore::CTRL_VOLUME); -        int mn = mc->minVal(); -        int v = mp->hwCtrlState(outChannel, MusECore::CTRL_VOLUME); -        volume = v; -        if(v == MusECore::CTRL_VAL_UNKNOWN) -        //{ -          //v = mc->initVal(); -          //if(v == MusECore::CTRL_VAL_UNKNOWN) -          //  v = 0; -          v = mn - 1; -        //}   -        else -          // Auto bias... -          v -= mc->bias(); -        iLautst->blockSignals(true); -        iLautst->setRange(mn - 1, mc->maxVal()); -        iLautst->setValue(v); -        iLautst->blockSignals(false); -         -        mc = mp->midiController(MusECore::CTRL_PANPOT); -        mn = mc->minVal(); -        v = mp->hwCtrlState(outChannel, MusECore::CTRL_PANPOT); -        pan = v; -        if(v == MusECore::CTRL_VAL_UNKNOWN) -        //{ -          //v = mc->initVal(); -          //if(v == MusECore::CTRL_VAL_UNKNOWN) -          //  v = 0; -          v = mn - 1; -        //}   -        else -          // Auto bias... -          v -= mc->bias(); -        iPan->blockSignals(true); -        iPan->setRange(mn - 1, mc->maxVal()); -        iPan->setValue(v); -        iPan->blockSignals(false); -      //} +            MusECore::MidiInstrument* instr = mp->instrument(); +            iPatch->setText(instr->getPatchName(outChannel, program, track->isDrumTrack())); + +            int hb = ((program >> 16) & 0xff) + 1; +            if (hb == 0x100) +                  hb = 0; +            int lb = ((program >> 8) & 0xff) + 1; +            if (lb == 0x100) +                  lb = 0; +            int pr = (program & 0xff) + 1; +            if (pr == 0x100) +                  pr = 0; +                   +            iHBank->blockSignals(true); +            iLBank->blockSignals(true); +            iProgram->blockSignals(true); + +            iHBank->setValue(hb); +            iLBank->setValue(lb); +            iProgram->setValue(pr); + +            iHBank->blockSignals(false); +            iLBank->blockSignals(false); +            iProgram->blockSignals(false); +      } +       +      MusECore::MidiController* mc = mp->midiController(MusECore::CTRL_VOLUME); +      int mn = mc->minVal(); +      int v = mp->hwCtrlState(outChannel, MusECore::CTRL_VOLUME); +      volume = v; +      if(v == MusECore::CTRL_VAL_UNKNOWN) +        v = mn - 1; +      else +        // Auto bias... +        v -= mc->bias(); +      iLautst->blockSignals(true); +      iLautst->setRange(mn - 1, mc->maxVal()); +      iLautst->setValue(v); +      iLautst->blockSignals(false); +       +      mc = mp->midiController(MusECore::CTRL_PANPOT); +      mn = mc->minVal(); +      v = mp->hwCtrlState(outChannel, MusECore::CTRL_PANPOT); +      pan = v; +      if(v == MusECore::CTRL_VAL_UNKNOWN) +        v = mn - 1; +      else +        // Auto bias... +        v -= mc->bias(); +      iPan->blockSignals(true); +      iPan->setRange(mn - 1, mc->maxVal()); +      iPan->setValue(v); +      iPan->blockSignals(false);        --_blockHeartbeatCount;  } @@ -1888,7 +1747,6 @@ void MidiTrackInfo::recordClicked()  void MidiTrackInfo::resizeEvent(QResizeEvent* ev)  { -  //printf("MidiTrackInfo::resizeEvent\n");      QWidget::resizeEvent(ev);    setLabelText();      setLabelFont(); diff --git a/muse2/muse/widgets/mtrackinfo.h b/muse2/muse/widgets/mtrackinfo.h index bb14423d..7a992a8c 100644 --- a/muse2/muse/widgets/mtrackinfo.h +++ b/muse2/muse/widgets/mtrackinfo.h @@ -66,6 +66,7 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase        void iKomprChanged(int);        void iPanChanged(int);        void iPanDoubleClicked(); +      void patchPopup();        void instrPopup();        void recordClicked();        void progRecClicked(); @@ -74,7 +75,7 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase        void recEchoToggled(bool);        void inRoutesPressed();        void outRoutesPressed(); -      void instrPopupActivated(QAction*); +      void patchPopupActivated(QAction*);     protected slots:        virtual void heartBeat(); diff --git a/muse2/muse/widgets/mtrackinfobase.ui b/muse2/muse/widgets/mtrackinfobase.ui index f566d207..94bff6e2 100644 --- a/muse2/muse/widgets/mtrackinfobase.ui +++ b/muse2/muse/widgets/mtrackinfobase.ui @@ -6,8 +6,8 @@     <rect>      <x>0</x>      <y>0</y> -    <width>94</width> -    <height>417</height> +    <width>93</width> +    <height>437</height>     </rect>    </property>    <property name="sizePolicy"> @@ -59,16 +59,103 @@     <property name="spacing">      <number>0</number>     </property> -   <item row="0" column="0" colspan="2"> -    <widget class="QLabel" name="trackNameLabel"> +   <item row="7" column="0"> +    <widget class="MusEGui::SpinBox" name="iTransp">       <property name="sizePolicy"> -      <sizepolicy hsizetype="Ignored" vsizetype="Minimum"> +      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +       <horstretch>0</horstretch> +       <verstretch>0</verstretch> +      </sizepolicy> +     </property> +     <property name="autoFillBackground"> +      <bool>false</bool> +     </property> +     <property name="specialValueText"> +      <string>off</string> +     </property> +     <property name="minimum"> +      <number>-127</number> +     </property> +     <property name="maximum"> +      <number>127</number> +     </property> +     <property name="value"> +      <number>1</number> +     </property> +    </widget> +   </item> +   <item row="10" column="0"> +    <widget class="MusEGui::SpinBox" name="iLen"> +     <property name="sizePolicy"> +      <sizepolicy hsizetype="Maximum" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> +     <property name="autoFillBackground"> +      <bool>false</bool> +     </property> +     <property name="suffix"> +      <string>%</string> +     </property> +     <property name="minimum"> +      <number>25</number> +     </property> +     <property name="maximum"> +      <number>200</number> +     </property> +     <property name="value"> +      <number>100</number> +     </property> +    </widget> +   </item> +   <item row="3" column="1"> +    <widget class="QLabel" name="TextLabel2"> +     <property name="sizePolicy"> +      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +       <horstretch>0</horstretch> +       <verstretch>0</verstretch> +      </sizepolicy> +     </property> +     <property name="text"> +      <string>Out ch</string> +     </property>       <property name="wordWrap"> -      <bool>true</bool> +      <bool>false</bool> +     </property> +     <property name="margin"> +      <number>0</number> +     </property> +     <property name="indent"> +      <number>1</number> +     </property> +    </widget> +   </item> +   <item row="11" column="0"> +    <widget class="MusEGui::SpinBox" name="iAnschl"> +     <property name="sizePolicy"> +      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +       <horstretch>0</horstretch> +       <verstretch>0</verstretch> +      </sizepolicy> +     </property> +     <property name="baseSize"> +      <size> +       <width>8</width> +       <height>5</height> +      </size> +     </property> +     <property name="autoFillBackground"> +      <bool>false</bool> +     </property> +     <property name="minimum"> +      <number>-127</number> +     </property> +     <property name="maximum"> +      <number>127</number> +     </property> +     <property name="value"> +      <number>0</number>       </property>      </widget>     </item> @@ -85,54 +172,42 @@       </property>      </widget>     </item> -   <item row="2" column="0"> -    <widget class="MusEGui::SpinBox" name="iOutputChannel"> +   <item row="8" column="0" rowspan="2"> +    <widget class="MusEGui::SpinBox" name="iVerz">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="toolTip"> -      <string>output channel</string> -     </property> -     <property name="whatsThis"> -      <string>all midi events are sent to this output channel</string> -     </property>       <property name="autoFillBackground">        <bool>false</bool>       </property> +     <property name="specialValueText"> +      <string>off</string> +     </property>       <property name="minimum"> -      <number>1</number> +      <number>-1000</number>       </property>       <property name="maximum"> -      <number>16</number> +      <number>1000</number>       </property>      </widget>     </item> -   <item row="2" column="1"> -    <widget class="QLabel" name="TextLabel2"> +   <item row="0" column="0" colspan="2"> +    <widget class="QLabel" name="trackNameLabel">       <property name="sizePolicy"> -      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +      <sizepolicy hsizetype="Ignored" vsizetype="Minimum">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="text"> -      <string>Out ch</string> -     </property>       <property name="wordWrap"> -      <bool>false</bool> -     </property> -     <property name="margin"> -      <number>0</number> -     </property> -     <property name="indent"> -      <number>1</number> +      <bool>true</bool>       </property>      </widget>     </item> -   <item row="3" column="0" colspan="2"> +   <item row="6" column="0" colspan="2">      <layout class="QHBoxLayout" name="horizontalLayout">       <property name="spacing">        <number>0</number> @@ -251,33 +326,8 @@       </item>      </layout>     </item> -   <item row="4" column="0"> -    <widget class="MusEGui::SpinBox" name="iTransp"> -     <property name="sizePolicy"> -      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> -       <horstretch>0</horstretch> -       <verstretch>0</verstretch> -      </sizepolicy> -     </property> -     <property name="autoFillBackground"> -      <bool>false</bool> -     </property> -     <property name="specialValueText"> -      <string>off</string> -     </property> -     <property name="minimum"> -      <number>-127</number> -     </property> -     <property name="maximum"> -      <number>127</number> -     </property> -     <property name="value"> -      <number>1</number> -     </property> -    </widget> -   </item> -   <item row="4" column="1" rowspan="2"> -    <widget class="QLabel" name="TextLabel9"> +   <item row="10" column="1"> +    <widget class="QLabel" name="TextLabel11">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch> @@ -285,10 +335,10 @@        </sizepolicy>       </property>       <property name="toolTip"> -      <string>Transpose notes up or down</string> +      <string>Change note length in percent of actual length</string>       </property>       <property name="text"> -      <string>Transp.</string> +      <string>Length</string>       </property>       <property name="wordWrap">        <bool>false</bool> @@ -298,30 +348,30 @@       </property>      </widget>     </item> -   <item row="5" column="0" rowspan="2"> -    <widget class="MusEGui::SpinBox" name="iVerz"> +   <item row="9" column="1"> +    <widget class="QLabel" name="TextLabel10">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="autoFillBackground"> -      <bool>false</bool> +     <property name="toolTip"> +      <string>Offset playback of notes before or after actual note</string>       </property> -     <property name="specialValueText"> -      <string>off</string> +     <property name="text"> +      <string>Delay</string>       </property> -     <property name="minimum"> -      <number>-1000</number> +     <property name="wordWrap"> +      <bool>false</bool>       </property> -     <property name="maximum"> -      <number>1000</number> +     <property name="indent"> +      <number>2</number>       </property>      </widget>     </item> -   <item row="6" column="1"> -    <widget class="QLabel" name="TextLabel10"> +   <item row="7" column="1" rowspan="2"> +    <widget class="QLabel" name="TextLabel9">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch> @@ -329,10 +379,10 @@        </sizepolicy>       </property>       <property name="toolTip"> -      <string>Offset playback of notes before or after actual note</string> +      <string>Transpose notes up or down</string>       </property>       <property name="text"> -      <string>Delay</string> +      <string>Transp.</string>       </property>       <property name="wordWrap">        <bool>false</bool> @@ -342,8 +392,8 @@       </property>      </widget>     </item> -   <item row="7" column="0"> -    <widget class="MusEGui::SpinBox" name="iLen"> +   <item row="12" column="0"> +    <widget class="MusEGui::SpinBox" name="iKompr">       <property name="sizePolicy">        <sizepolicy hsizetype="Maximum" vsizetype="Fixed">         <horstretch>0</horstretch> @@ -356,6 +406,9 @@       <property name="suffix">        <string>%</string>       </property> +     <property name="prefix"> +      <string/> +     </property>       <property name="minimum">        <number>25</number>       </property> @@ -367,8 +420,8 @@       </property>      </widget>     </item> -   <item row="7" column="1"> -    <widget class="QLabel" name="TextLabel11"> +   <item row="16" column="0"> +    <widget class="MusEGui::SpinBox" name="iHBank">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch> @@ -376,99 +429,80 @@        </sizepolicy>       </property>       <property name="toolTip"> -      <string>Change note length in percent of actual length</string> -     </property> -     <property name="text"> -      <string>Length</string> -     </property> -     <property name="wordWrap"> -      <bool>false</bool> -     </property> -     <property name="indent"> -      <number>2</number> -     </property> -    </widget> -   </item> -   <item row="8" column="0"> -    <widget class="MusEGui::SpinBox" name="iAnschl"> -     <property name="sizePolicy"> -      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> -       <horstretch>0</horstretch> -       <verstretch>0</verstretch> -      </sizepolicy> -     </property> -     <property name="baseSize"> -      <size> -       <width>8</width> -       <height>5</height> -      </size> +      <string>Bank Select MSB. Ctrl-double-click on/off.</string>       </property>       <property name="autoFillBackground">        <bool>false</bool>       </property> +     <property name="specialValueText"> +      <string>off</string> +     </property>       <property name="minimum"> -      <number>-127</number> +      <number>0</number>       </property>       <property name="maximum"> -      <number>127</number> +      <number>128</number>       </property>       <property name="value">        <number>0</number>       </property>      </widget>     </item> -   <item row="8" column="1"> -    <widget class="QLabel" name="TextLabel12"> +   <item row="16" column="1"> +    <widget class="QLabel" name="TextLabel4">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="toolTip"> -      <string><html><head/><body><p>Add or substract velocity to notes on track.</p><p><span style=" font-style:italic;">Since the midi note range is 0-127 this <br/>might mean that the notes do not reach <br/>the combined velocity, note + Velocity.</span></p></body></html></string> +     <property name="lineWidth"> +      <number>1</number>       </property>       <property name="text"> -      <string>Velocity</string> +      <string>H-Bank</string>       </property>       <property name="wordWrap">        <bool>false</bool>       </property> -     <property name="indent"> +     <property name="margin">        <number>0</number>       </property> +     <property name="indent"> +      <number>2</number> +     </property>      </widget>     </item> -   <item row="9" column="0"> -    <widget class="MusEGui::SpinBox" name="iKompr"> +   <item row="17" column="0"> +    <widget class="MusEGui::SpinBox" name="iLBank">       <property name="sizePolicy"> -      <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> +      <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> +     <property name="toolTip"> +      <string>Bank Select LSB. Ctrl-double-click on/off.</string> +     </property>       <property name="autoFillBackground">        <bool>false</bool>       </property> -     <property name="suffix"> -      <string>%</string> -     </property> -     <property name="prefix"> -      <string/> +     <property name="specialValueText"> +      <string>off</string>       </property>       <property name="minimum"> -      <number>25</number> +      <number>0</number>       </property>       <property name="maximum"> -      <number>200</number> +      <number>128</number>       </property>       <property name="value"> -      <number>100</number> +      <number>0</number>       </property>      </widget>     </item> -   <item row="9" column="1"> -    <widget class="QLabel" name="TextLabel13"> +   <item row="3" column="0"> +    <widget class="MusEGui::SpinBox" name="iOutputChannel">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch> @@ -476,67 +510,45 @@        </sizepolicy>       </property>       <property name="toolTip"> -      <string>Compress the notes velocity range, in percent of actual velocity</string> +      <string>output channel</string>       </property> -     <property name="text"> -      <string>Compr.</string> +     <property name="whatsThis"> +      <string>all midi events are sent to this output channel</string>       </property> -     <property name="wordWrap"> +     <property name="autoFillBackground">        <bool>false</bool>       </property> -     <property name="indent"> -      <number>2</number> +     <property name="minimum"> +      <number>1</number> +     </property> +     <property name="maximum"> +      <number>16</number>       </property>      </widget>     </item> -   <item row="10" column="0" colspan="2"> -    <widget class="QLabel" name="TextLabel1_2"> +   <item row="11" column="1"> +    <widget class="QLabel" name="TextLabel12">       <property name="sizePolicy"> -      <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> +      <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="frameShape"> -      <enum>QFrame::WinPanel</enum> -     </property> -     <property name="frameShadow"> -      <enum>QFrame::Raised</enum> -     </property> -     <property name="lineWidth"> -      <number>1</number> -     </property> -     <property name="midLineWidth"> -      <number>1</number> +     <property name="toolTip"> +      <string><html><head/><body><p>Add or substract velocity to notes on track.</p><p><span style=" font-style:italic;">Since the midi note range is 0-127 this <br/>might mean that the notes do not reach <br/>the combined velocity, note + Velocity.</span></p></body></html></string>       </property>       <property name="text"> -      <string>Channel Info</string> -     </property> -     <property name="alignment"> -      <set>Qt::AlignCenter</set> +      <string>Velocity</string>       </property>       <property name="wordWrap">        <bool>false</bool>       </property> -    </widget> -   </item> -   <item row="11" column="0" colspan="2"> -    <widget class="QPushButton" name="iPatch"> -     <property name="sizePolicy"> -      <sizepolicy hsizetype="Ignored" vsizetype="Fixed"> -       <horstretch>0</horstretch> -       <verstretch>0</verstretch> -      </sizepolicy> -     </property> -     <property name="toolTip"> -      <string>Select instrument patch</string> -     </property> -     <property name="text"> -      <string><unknown></string> +     <property name="indent"> +      <number>0</number>       </property>      </widget>     </item> -   <item row="12" column="0"> +   <item row="15" column="0">      <widget class="QLabel" name="textLabel1">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> @@ -555,7 +567,7 @@       </property>      </widget>     </item> -   <item row="12" column="1"> +   <item row="15" column="1">      <layout class="QHBoxLayout" name="horizontalLayout_3">       <property name="spacing">        <number>0</number> @@ -594,61 +606,55 @@       </item>      </layout>     </item> -   <item row="13" column="0"> -    <widget class="MusEGui::SpinBox" name="iHBank"> +   <item row="13" column="0" colspan="2"> +    <widget class="QLabel" name="TextLabel1_2">       <property name="sizePolicy"> -      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +      <sizepolicy hsizetype="Minimum" vsizetype="Maximum">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="toolTip"> -      <string>Bank Select MSB. Ctrl-double-click on/off.</string> +     <property name="frameShape"> +      <enum>QFrame::WinPanel</enum>       </property> -     <property name="autoFillBackground"> -      <bool>false</bool> +     <property name="frameShadow"> +      <enum>QFrame::Raised</enum>       </property> -     <property name="specialValueText"> -      <string>off</string> +     <property name="lineWidth"> +      <number>1</number>       </property> -     <property name="minimum"> -      <number>0</number> +     <property name="midLineWidth"> +      <number>1</number>       </property> -     <property name="maximum"> -      <number>128</number> +     <property name="text"> +      <string>Channel Info</string>       </property> -     <property name="value"> -      <number>0</number> +     <property name="alignment"> +      <set>Qt::AlignCenter</set> +     </property> +     <property name="wordWrap"> +      <bool>false</bool>       </property>      </widget>     </item> -   <item row="13" column="1"> -    <widget class="QLabel" name="TextLabel4"> +   <item row="14" column="0" colspan="2"> +    <widget class="QPushButton" name="iPatch">       <property name="sizePolicy"> -      <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> +      <sizepolicy hsizetype="Ignored" vsizetype="Fixed">         <horstretch>0</horstretch>         <verstretch>0</verstretch>        </sizepolicy>       </property> -     <property name="lineWidth"> -      <number>1</number> +     <property name="toolTip"> +      <string>Select instrument patch</string>       </property>       <property name="text"> -      <string>H-Bank</string> -     </property> -     <property name="wordWrap"> -      <bool>false</bool> -     </property> -     <property name="margin"> -      <number>0</number> -     </property> -     <property name="indent"> -      <number>2</number> +      <string><unknown></string>       </property>      </widget>     </item> -   <item row="14" column="0"> -    <widget class="MusEGui::SpinBox" name="iLBank"> +   <item row="12" column="1"> +    <widget class="QLabel" name="TextLabel13">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">         <horstretch>0</horstretch> @@ -656,26 +662,20 @@        </sizepolicy>       </property>       <property name="toolTip"> -      <string>Bank Select LSB. Ctrl-double-click on/off.</string> -     </property> -     <property name="autoFillBackground"> -      <bool>false</bool> -     </property> -     <property name="specialValueText"> -      <string>off</string> +      <string>Compress the notes velocity range, in percent of actual velocity</string>       </property> -     <property name="minimum"> -      <number>0</number> +     <property name="text"> +      <string>Compr.</string>       </property> -     <property name="maximum"> -      <number>128</number> +     <property name="wordWrap"> +      <bool>false</bool>       </property> -     <property name="value"> -      <number>0</number> +     <property name="indent"> +      <number>2</number>       </property>      </widget>     </item> -   <item row="14" column="1"> +   <item row="17" column="1">      <widget class="QLabel" name="TextLabel5">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> @@ -700,7 +700,7 @@       </property>      </widget>     </item> -   <item row="15" column="0"> +   <item row="18" column="0">      <widget class="MusEGui::SpinBox" name="iProgram">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> @@ -728,7 +728,7 @@       </property>      </widget>     </item> -   <item row="15" column="1"> +   <item row="18" column="1">      <layout class="QHBoxLayout" name="horizontalLayout_4">       <property name="spacing">        <number>0</number> @@ -767,7 +767,7 @@       </item>      </layout>     </item> -   <item row="16" column="0"> +   <item row="19" column="0">      <widget class="MusEGui::SpinBox" name="iLautst">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> @@ -795,7 +795,7 @@       </property>      </widget>     </item> -   <item row="16" column="1"> +   <item row="19" column="1">      <layout class="QHBoxLayout" name="horizontalLayout_5">       <property name="spacing">        <number>0</number> @@ -834,7 +834,7 @@       </item>      </layout>     </item> -   <item row="17" column="0"> +   <item row="20" column="0">      <widget class="MusEGui::SpinBox" name="iPan">       <property name="sizePolicy">        <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> @@ -865,7 +865,7 @@       </property>      </widget>     </item> -   <item row="17" column="1"> +   <item row="20" column="1">      <layout class="QHBoxLayout" name="horizontalLayout_6">       <property name="spacing">        <number>0</number> @@ -904,7 +904,7 @@       </item>      </layout>     </item> -   <item row="18" column="0"> +   <item row="21" column="0">      <spacer name="spacer5">       <property name="orientation">        <enum>Qt::Vertical</enum> @@ -920,6 +920,22 @@       </property>      </spacer>     </item> +   <item row="4" column="0" colspan="2"> +    <widget class="QPushButton" name="instrPushButton"> +     <property name="sizePolicy"> +      <sizepolicy hsizetype="Ignored" vsizetype="Fixed"> +       <horstretch>0</horstretch> +       <verstretch>0</verstretch> +      </sizepolicy> +     </property> +     <property name="toolTip"> +      <string>Select instrument</string> +     </property> +     <property name="text"> +      <string><unknown></string> +     </property> +    </widget> +   </item>    </layout>   </widget>   <layoutdefault spacing="6" margin="11"/>  | 
