summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-04-05 20:30:31 +0000
committerTim E. Real <termtech@rogers.com>2010-04-05 20:30:31 +0000
commit3a4f52873754d5599f58968909cbd8a9a104f31a (patch)
tree77924980ff302a0505a753196869c23761563d2d
parent1151c236e1710d6b99225a7a1e5914b0d793be88 (diff)
See ChangeLog
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/muse/confmport.cpp539
-rw-r--r--muse/muse/confmport.h17
-rw-r--r--muse/muse/driver/jackmidi.cpp51
-rw-r--r--muse/muse/driver/jackmidi.h2
-rw-r--r--muse/muse/dssihost.cpp57
-rw-r--r--muse/muse/dssihost.h1
-rw-r--r--muse/muse/mididev.h2
-rw-r--r--muse/muse/wavetrack.cpp2
9 files changed, 457 insertions, 216 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 7ab4d115..d21480ec 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,6 +1,8 @@
05.04.2010
* Added: Rec enabled track moved with selection when only one track is rec enabled (rj)
* Changed: Made canvas show grid the default (rj)
+ * Added: Jack midi ports can now be renamed in the ports list dialog, by clicking on the name. (T356)
+ - Also cleaned up ports list behaviour and added tooltips.
30.03.2010
* Major reworks: Jack midi, routing system, multichannel synth ins/outs, midi strips and trackinfo pane. (T356)
- WORK IN PROGRESS. Should be usable for current projects.
diff --git a/muse/muse/confmport.cpp b/muse/muse/confmport.cpp
index 61960910..f03fe361 100644
--- a/muse/muse/confmport.cpp
+++ b/muse/muse/confmport.cpp
@@ -27,6 +27,7 @@
#include <qtooltip.h>
#include <qfiledialog.h>
#include <qtoolbutton.h>
+#include <qmessagebox.h>
#include "confmport.h"
#include "app.h"
@@ -56,10 +57,57 @@ enum { DEVCOL_NO = 0, DEVCOL_GUI, DEVCOL_REC, DEVCOL_PLAY, DEVCOL_INSTR, DEVCOL_
DEVCOL_ROUTES, DEVCOL_STATE };
//---------------------------------------------------------
+// mdevViewItemRenamed
+//---------------------------------------------------------
+
+void MPConfig::mdevViewItemRenamed(QListViewItem* item, int col, const QString& s)
+{
+ //printf("MPConfig::mdevViewItemRenamed col:%d txt:%s\n", col, s.latin1());
+ if(item == 0)
+ return;
+ switch(col)
+ {
+ case DEVCOL_NAME:
+ {
+ QString id = item->text(DEVCOL_NO);
+ int no = atoi(id.latin1()) - 1;
+ if(no < 0 || no >= MIDI_PORTS)
+ return;
+
+ MidiPort* port = &midiPorts[no];
+ MidiDevice* dev = port->device();
+ // Only Jack midi devices.
+ if(!dev || dev->deviceType() != MidiDevice::JACK_MIDI)
+ return;
+ if(dev->name() == s)
+ return;
+
+ if(midiDevices.find(s))
+ {
+ QMessageBox::critical(this,
+ tr("MusE: bad device name"),
+ tr("please choose a unique device name"),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton);
+ songChanged(-1);
+ return;
+ }
+ dev->setName(s);
+ song->update();
+ }
+ break;
+ default:
+ printf("MPConfig::mdevViewItemRenamed unknown column clicked col:%d txt:%s\n", col, s.latin1());
+ break;
+ }
+}
+
+//---------------------------------------------------------
// rbClicked
//---------------------------------------------------------
-void MPConfig::rbClicked(QListViewItem* item, const QPoint&, int col)
+void MPConfig::rbClicked(QListViewItem* item, const QPoint& cpt, int col)
{
if (item == 0)
return;
@@ -74,32 +122,51 @@ void MPConfig::rbClicked(QListViewItem* item, const QPoint&, int col)
int rwFlags = dev ? dev->rwFlags() : 0;
int openFlags = dev ? dev->openFlags() : 0;
QListView* listView = item->listView();
+ //printf("MPConfig::rbClicked cpt x:%d y:%d\n", cpt.x(), cpt.y());
+ //printf("MPConfig::rbClicked new cpt x:%d y:%d\n", cpt.x(), cpt.y());
+ //printf("MPConfig::rbClicked new mapped cpt x:%d y:%d\n", cpt.x(), cpt.y());
QPoint ppt = listView->itemRect(item).bottomLeft();
+ //printf("MPConfig::rbClicked ppt x:%d y:%d\n", ppt.x(), ppt.y());
ppt += QPoint(listView->header()->sectionPos(col), listView->header()->height());
+ //printf("MPConfig::rbClicked new ppt x:%d y:%d\n", ppt.x(), ppt.y());
ppt = listView->mapToGlobal(ppt);
+ //printf("MPConfig::rbClicked new mapped ppt x:%d y:%d\n", ppt.x(), ppt.y());
switch (col) {
case DEVCOL_GUI:
if (dev == 0)
- break;
+ //break;
+ return;
if (port->hasGui())
+ {
port->instrument()->showGui(!port->guiVisible());
- break;
-
+ item->setPixmap(DEVCOL_GUI, port->guiVisible() ? *dotIcon : *dothIcon);
+ }
+ //break;
+ return;
+
case DEVCOL_REC:
if (dev == 0 || !(rwFlags & 2))
- break;
+ //break;
+ return;
openFlags ^= 0x2;
dev->setOpenFlags(openFlags);
midiSeq->msgSetMidiDevice(port, dev); // reopen device
- break;
+ item->setPixmap(DEVCOL_REC, openFlags & 2 ? *dotIcon : *dothIcon);
+ //break;
+ return;
+
case DEVCOL_PLAY:
if (dev == 0 || !(rwFlags & 1))
- break;
+ //break;
+ return;
openFlags ^= 0x1;
dev->setOpenFlags(openFlags);
midiSeq->msgSetMidiDevice(port, dev); // reopen device
- break;
+ item->setPixmap(DEVCOL_PLAY, openFlags & 1 ? *dotIcon : *dothIcon);
+ //break;
+ return;
+
case DEVCOL_ROUTES:
{
if(!checkAudioDevice())
@@ -239,211 +306,232 @@ void MPConfig::rbClicked(QListViewItem* item, const QPoint&, int col)
}
- break;
+ //break;
+ return;
+
case DEVCOL_NAME:
{
- QPopupMenu* pup = new QPopupMenu(this);
-
- pup->setCheckable(true);
-
- pup->insertItem(tr("Create") + QT_TR_NOOP(" Jack") + tr(" input"), 0);
- pup->insertItem(tr("Create") + QT_TR_NOOP(" Jack") + tr(" output"), 1);
-
- typedef std::map<std::string, int > asmap;
- typedef std::map<std::string, int >::iterator imap;
+ //printf("MPConfig::rbClicked DEVCOL_NAME\n");
- asmap mapALSA;
- asmap mapJACK;
- asmap mapSYNTH;
-
- int aix = 2;
- int jix = 0x10000000;
- int six = 0x20000000;
- for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
+ // Did we click in the text area?
+ if((cpt.x() - ppt.x()) > buttondownIcon->width())
{
- //devALSA = dynamic_cast<MidiAlsaDevice*>(*i);
- //if(devALSA)
- if((*i)->deviceType() == MidiDevice::ALSA_MIDI)
- {
- //mapALSA.insert( std::pair<std::string, int> (std::string(devALSA->name().lower().latin1()), ii) );
- mapALSA.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), aix) );
- ++aix;
- }
- else
- if((*i)->deviceType() == MidiDevice::JACK_MIDI)
- {
- //devJACK = dynamic_cast<MidiJackDevice*>(*i);
- //if(devJACK)
- //mapJACK.insert( std::pair<std::string, int> (std::string(devJACK->name().lower().latin1()), ii) );
- mapJACK.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), jix) );
- ++jix;
- }
- else
- if((*i)->deviceType() == MidiDevice::SYNTH_MIDI)
- {
- mapSYNTH.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), six) );
- ++six;
- }
- else
- printf("MPConfig::rbClicked unknown midi device: %s\n", (*i)->name().latin1());
+ //printf("MPConfig::rbClicked starting item rename... enabled?:%d\n", item->renameEnabled(DEVCOL_NAME));
+ // Start the renaming of the cell...
+ if(item->renameEnabled(DEVCOL_NAME))
+ item->startRename(DEVCOL_NAME);
+
+ return;
}
-
- //int sz = midiDevices.size();
- if(!mapALSA.empty())
+ else
+ // We clicked the 'down' button.
{
- pup->insertSeparator();
- pup->insertItem(new MenuTitleItem(QT_TR_NOOP("ALSA:")));
+ QPopupMenu* pup = new QPopupMenu(this);
+
+ pup->setCheckable(true);
+
+ pup->insertItem(tr("Create") + QT_TR_NOOP(" Jack") + tr(" input"), 0);
+ pup->insertItem(tr("Create") + QT_TR_NOOP(" Jack") + tr(" output"), 1);
- for(imap i = mapALSA.begin(); i != mapALSA.end(); ++i)
+ typedef std::map<std::string, int > asmap;
+ typedef std::map<std::string, int >::iterator imap;
+
+ asmap mapALSA;
+ asmap mapJACK;
+ asmap mapSYNTH;
+
+ int aix = 2;
+ int jix = 0x10000000;
+ int six = 0x20000000;
+ for(iMidiDevice i = midiDevices.begin(); i != midiDevices.end(); ++i)
{
- int idx = i->second;
- //if(idx > sz) // Sanity check
- // continue;
- QString s(i->first.c_str());
- MidiDevice* md = midiDevices.find(s, MidiDevice::ALSA_MIDI);
- if(md)
+ //devALSA = dynamic_cast<MidiAlsaDevice*>(*i);
+ //if(devALSA)
+ if((*i)->deviceType() == MidiDevice::ALSA_MIDI)
{
- //if(!dynamic_cast<MidiAlsaDevice*>(md))
- if(md->deviceType() != MidiDevice::ALSA_MIDI)
- continue;
-
- //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
- pup->insertItem(QT_TR_NOOP(md->name()), idx);
-
- //for(int k = 0; k < MIDI_PORTS; ++k)
- //{
- //MidiDevice* dev = midiPorts[k].device();
- //if(dev && s == dev->name())
- if(md == dev)
- {
- //pup->setItemEnabled(idx + 3, false);
- //pup->setItemChecked(idx + 3, true);
- pup->setItemChecked(idx, true);
- //break;
- }
- //}
+ //mapALSA.insert( std::pair<std::string, int> (std::string(devALSA->name().lower().latin1()), ii) );
+ mapALSA.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), aix) );
+ ++aix;
}
+ else
+ if((*i)->deviceType() == MidiDevice::JACK_MIDI)
+ {
+ //devJACK = dynamic_cast<MidiJackDevice*>(*i);
+ //if(devJACK)
+ //mapJACK.insert( std::pair<std::string, int> (std::string(devJACK->name().lower().latin1()), ii) );
+ mapJACK.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), jix) );
+ ++jix;
+ }
+ else
+ if((*i)->deviceType() == MidiDevice::SYNTH_MIDI)
+ {
+ mapSYNTH.insert( std::pair<std::string, int> (std::string((*i)->name().latin1()), six) );
+ ++six;
+ }
+ else
+ printf("MPConfig::rbClicked unknown midi device: %s\n", (*i)->name().latin1());
}
- }
-
- if(!mapJACK.empty())
- {
- pup->insertSeparator();
- pup->insertItem(new MenuTitleItem(QT_TR_NOOP("JACK:")));
- for(imap i = mapJACK.begin(); i != mapJACK.end(); ++i)
+ //int sz = midiDevices.size();
+ if(!mapALSA.empty())
{
- int idx = i->second;
- //if(idx > sz)
- // continue;
- QString s(i->first.c_str());
- MidiDevice* md = midiDevices.find(s, MidiDevice::JACK_MIDI);
- if(md)
+ pup->insertSeparator();
+ pup->insertItem(new MenuTitleItem(QT_TR_NOOP("ALSA:")));
+
+ for(imap i = mapALSA.begin(); i != mapALSA.end(); ++i)
{
- //if(!dynamic_cast<MidiJackDevice*>(md))
- if(md->deviceType() != MidiDevice::JACK_MIDI)
- continue;
+ int idx = i->second;
+ //if(idx > sz) // Sanity check
+ // continue;
+ QString s(i->first.c_str());
+ MidiDevice* md = midiDevices.find(s, MidiDevice::ALSA_MIDI);
+ if(md)
+ {
+ //if(!dynamic_cast<MidiAlsaDevice*>(md))
+ if(md->deviceType() != MidiDevice::ALSA_MIDI)
+ continue;
+
+ //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
+ pup->insertItem(QT_TR_NOOP(md->name()), idx);
- //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
- pup->insertItem(QT_TR_NOOP(md->name()), idx);
-
- //for(int k = 0; k < MIDI_PORTS; ++k)
- //{
- //MidiDevice* dev = midiPorts[k].device();
- //if(dev && s == dev->name())
- if(md == dev)
- {
- //pup->setItemEnabled(idx + 3, false);
- //pup->setItemChecked(idx + 3, true);
- pup->setItemChecked(idx, true);
- //break;
- }
- //}
- }
- }
- }
-
- if(!mapSYNTH.empty())
- {
- pup->insertSeparator();
- pup->insertItem(new MenuTitleItem(QT_TR_NOOP("SYNTH:")));
+ //for(int k = 0; k < MIDI_PORTS; ++k)
+ //{
+ //MidiDevice* dev = midiPorts[k].device();
+ //if(dev && s == dev->name())
+ if(md == dev)
+ {
+ //pup->setItemEnabled(idx + 3, false);
+ //pup->setItemChecked(idx + 3, true);
+ pup->setItemChecked(idx, true);
+ //break;
+ }
+ //}
+ }
+ }
+ }
- for(imap i = mapSYNTH.begin(); i != mapSYNTH.end(); ++i)
+ if(!mapJACK.empty())
{
- int idx = i->second;
- //if(idx > sz)
- // continue;
- QString s(i->first.c_str());
- MidiDevice* md = midiDevices.find(s, MidiDevice::SYNTH_MIDI);
- if(md)
+ pup->insertSeparator();
+ pup->insertItem(new MenuTitleItem(QT_TR_NOOP("JACK:")));
+
+ for(imap i = mapJACK.begin(); i != mapJACK.end(); ++i)
{
- //if(!dynamic_cast<MidiJackDevice*>(md))
- if(md->deviceType() != MidiDevice::SYNTH_MIDI)
- continue;
+ int idx = i->second;
+ //if(idx > sz)
+ // continue;
+ QString s(i->first.c_str());
+ MidiDevice* md = midiDevices.find(s, MidiDevice::JACK_MIDI);
+ if(md)
+ {
+ //if(!dynamic_cast<MidiJackDevice*>(md))
+ if(md->deviceType() != MidiDevice::JACK_MIDI)
+ continue;
+
+ //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
+ pup->insertItem(QT_TR_NOOP(md->name()), idx);
- //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
- pup->insertItem(QT_TR_NOOP(md->name()), idx);
-
- //for(int k = 0; k < MIDI_PORTS; ++k)
- //{
- //MidiDevice* dev = midiPorts[k].device();
- //if(dev && s == dev->name())
- if(md == dev)
- {
- //pup->setItemEnabled(idx + 3, false);
- //pup->setItemChecked(idx + 3, true);
- pup->setItemChecked(idx, true);
- //break;
- }
- //}
- }
+ //for(int k = 0; k < MIDI_PORTS; ++k)
+ //{
+ //MidiDevice* dev = midiPorts[k].device();
+ //if(dev && s == dev->name())
+ if(md == dev)
+ {
+ //pup->setItemEnabled(idx + 3, false);
+ //pup->setItemChecked(idx + 3, true);
+ pup->setItemChecked(idx, true);
+ //break;
+ }
+ //}
+ }
+ }
+ }
+
+ if(!mapSYNTH.empty())
+ {
+ pup->insertSeparator();
+ pup->insertItem(new MenuTitleItem(QT_TR_NOOP("SYNTH:")));
+
+ for(imap i = mapSYNTH.begin(); i != mapSYNTH.end(); ++i)
+ {
+ int idx = i->second;
+ //if(idx > sz)
+ // continue;
+ QString s(i->first.c_str());
+ MidiDevice* md = midiDevices.find(s, MidiDevice::SYNTH_MIDI);
+ if(md)
+ {
+ //if(!dynamic_cast<MidiJackDevice*>(md))
+ if(md->deviceType() != MidiDevice::SYNTH_MIDI)
+ continue;
+
+ //pup->insertItem(QT_TR_NOOP(md->name()), idx + 3);
+ pup->insertItem(QT_TR_NOOP(md->name()), idx);
+
+ //for(int k = 0; k < MIDI_PORTS; ++k)
+ //{
+ //MidiDevice* dev = midiPorts[k].device();
+ //if(dev && s == dev->name())
+ if(md == dev)
+ {
+ //pup->setItemEnabled(idx + 3, false);
+ //pup->setItemChecked(idx + 3, true);
+ pup->setItemChecked(idx, true);
+ //break;
+ }
+ //}
+ }
+ }
}
- }
-
- n = pup->exec(ppt, 0);
- if(n == -1)
- {
- delete pup;
- break;
- }
-
- //printf("MPConfig::rbClicked n:%d\n", n);
-
- MidiDevice* sdev = 0;
- if(n < 2)
- {
- delete pup;
- if(n == 0)
- sdev = MidiJackDevice::createJackMidiDevice(QString(), 2); // 2: Readable.
+
+ n = pup->exec(ppt, 0);
+ if(n == -1)
+ {
+ delete pup;
+ //break;
+ return;
+ }
+
+ //printf("MPConfig::rbClicked n:%d\n", n);
+
+ MidiDevice* sdev = 0;
+ if(n < 2)
+ {
+ delete pup;
+ if(n == 0)
+ sdev = MidiJackDevice::createJackMidiDevice(QString(), 2); // 2: Readable.
+ else
+ if(n == 1)
+ sdev = MidiJackDevice::createJackMidiDevice(QString(), 1); // 1:Writable.
+ }
else
- if(n == 1)
- sdev = MidiJackDevice::createJackMidiDevice(QString(), 1); // 1:Writable.
- }
- else
- {
- int typ = MidiDevice::ALSA_MIDI;
- if(n >= 0x10000000)
- typ = MidiDevice::JACK_MIDI;
- if(n >= 0x20000000)
- typ = MidiDevice::SYNTH_MIDI;
+ {
+ int typ = MidiDevice::ALSA_MIDI;
+ if(n >= 0x10000000)
+ typ = MidiDevice::JACK_MIDI;
+ if(n >= 0x20000000)
+ typ = MidiDevice::SYNTH_MIDI;
+
+ sdev = midiDevices.find(pup->text(n), typ);
+ delete pup;
+ // Is it the current device? Reset it to <none>.
+ if(sdev == dev)
+ sdev = 0;
+ }
- sdev = midiDevices.find(pup->text(n), typ);
- delete pup;
- // Is it the current device? Reset it to <none>.
- if(sdev == dev)
- sdev = 0;
- }
-
- midiSeq->msgSetMidiDevice(port, sdev);
- muse->changeConfig(true); // save configuration file
- song->update();
+ midiSeq->msgSetMidiDevice(port, sdev);
+ muse->changeConfig(true); // save configuration file
+ song->update();
+ }
}
- break;
+ //break;
+ return;
case DEVCOL_INSTR:
{
if (dev && dev->isSynti())
- break;
+ //break;
+ return;
if (instrPopup == 0)
instrPopup = new QPopupMenu(this);
instrPopup->clear();
@@ -461,7 +549,8 @@ void MPConfig::rbClicked(QListViewItem* item, const QPoint&, int col)
}
n = instrPopup->exec(ppt, 0);
if (n == -1)
- break;
+ //break;
+ return;
QString s = instrPopup->text(n);
item->setText(DEVCOL_INSTR, s);
for (iMidiInstrument i = midiInstruments.begin(); i
@@ -473,9 +562,37 @@ void MPConfig::rbClicked(QListViewItem* item, const QPoint&, int col)
}
song->update();
}
- break;
+ //break;
+ return;
}
- songChanged(-1);
+ //songChanged(-1);
+ }
+
+//---------------------------------------------------------
+// MPHeaderTip::maybeTip
+//---------------------------------------------------------
+
+void MPHeaderTip::maybeTip(const QPoint &pos)
+ {
+ QHeader* w = (QHeader*)parentWidget();
+ int section = w->sectionAt(pos.x());
+ if (section == -1)
+ return;
+ QRect r(w->sectionPos(section), 0, w->sectionSize(section),
+ w->height());
+ QString p;
+ switch (section) {
+ case DEVCOL_NO: p = QHeader::tr("Port Number"); break;
+ case DEVCOL_GUI: p = QHeader::tr("Enable gui"); break;
+ case DEVCOL_REC: p = QHeader::tr("Enable reading"); break;
+ case DEVCOL_PLAY: p = QHeader::tr("Enable writing"); break;
+ case DEVCOL_INSTR: p = QHeader::tr("Port instrument"); break;
+ case DEVCOL_NAME: p = QHeader::tr("Midi device name. Click to edit (Jack)"); break;
+ case DEVCOL_ROUTES: p = QHeader::tr("Jack midi ports"); break;
+ case DEVCOL_STATE: p = QHeader::tr("Device state"); break;
+ default: return;
+ }
+ tip(r, p);
}
//---------------------------------------------------------
@@ -491,14 +608,14 @@ QString MPWhatsThis::text(const QPoint& pos)
case DEVCOL_NO:
return QHeader::tr("Port Number");
case DEVCOL_GUI:
- return QHeader::tr("enable gui for device");
+ return QHeader::tr("Enable gui for device");
case DEVCOL_REC:
- return QHeader::tr("enables reading from device");
+ return QHeader::tr("Enable reading from device");
case DEVCOL_PLAY:
- return QHeader::tr("enables writing to device");
+ return QHeader::tr("Enable writing to device");
case DEVCOL_NAME:
return QHeader::tr("Name of the midi device associated with"
- " this port number");
+ " this port number. Click to edit Jack midi name.");
case DEVCOL_INSTR:
return QHeader::tr("Instrument connected to port");
case DEVCOL_ROUTES:
@@ -519,6 +636,7 @@ QString MPWhatsThis::text(const QPoint& pos)
MPConfig::MPConfig(QWidget* parent, char* name)
: SynthConfigBase(parent, name)
{
+ _mptooltip = 0;
popup = 0;
instrPopup = 0;
_showAliases = -1; // 0: Show first aliases, if available. Nah, stick with -1: none at first.
@@ -547,9 +665,12 @@ MPConfig::MPConfig(QWidget* parent, char* name)
instanceList->setColumnAlignment(1, AlignHCenter);
new MPWhatsThis(mdevView, mdevView->header());
+ _mptooltip = new MPHeaderTip(mdevView->header());
connect(mdevView, SIGNAL(pressed(QListViewItem*,const QPoint&,int)),
this, SLOT(rbClicked(QListViewItem*,const QPoint&,int)));
+ connect(mdevView, SIGNAL(itemRenamed(QListViewItem*,int,const QString&)),
+ this, SLOT(mdevViewItemRenamed(QListViewItem*,int,const QString&)));
connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
connect(synthList, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
@@ -560,6 +681,12 @@ MPConfig::MPConfig(QWidget* parent, char* name)
songChanged(0);
}
+
+MPConfig::~MPConfig()
+{
+ delete _mptooltip;
+}
+
//---------------------------------------------------------
// selectionChanged
//---------------------------------------------------------
@@ -580,8 +707,21 @@ void MPConfig::songChanged(int flags)
if(flags == SC_MIDI_CONTROLLER)
return;
+ // Get currently selected index...
+ int no = -1;
+ QListViewItem* sitem = mdevView->selectedItem();
+ if(sitem)
+ {
+ QString id = sitem->text(DEVCOL_NO);
+ no = atoi(id.latin1()) - 1;
+ if(no < 0 || no >= MIDI_PORTS)
+ no = -1;
+ }
+
+ sitem = 0;
mdevView->clear();
- for (int i = MIDI_PORTS-1; i >= 0; --i) {
+ for (int i = MIDI_PORTS-1; i >= 0; --i)
+ {
MidiPort* port = &midiPorts[i];
MidiDevice* dev = port->device();
QString s;
@@ -633,8 +773,15 @@ void MPConfig::songChanged(int flags)
}
mdevView->insertItem(item);
- }
-
+ if(i == no)
+ sitem = item;
+ }
+ if(sitem)
+ {
+ mdevView->setSelected(sitem, true);
+ mdevView->ensureItemVisible(sitem);
+ }
+
QString s;
synthList->clear();
for (std::vector<Synth*>::iterator i = synthis.begin();
diff --git a/muse/muse/confmport.h b/muse/muse/confmport.h
index 577c0afd..8a743423 100644
--- a/muse/muse/confmport.h
+++ b/muse/muse/confmport.h
@@ -11,6 +11,7 @@
#include <qwidget.h>
#include <qwhatsthis.h>
+#include <qtooltip.h>
#include "synthconfigbase.h"
@@ -21,6 +22,19 @@ class QPopupMenu;
class QHeader;
class Xml;
+//----------------------------------------------------------
+// MPHeaderTip
+//----------------------------------------------------------
+
+class MPHeaderTip : public QToolTip {
+
+ public:
+ MPHeaderTip(QWidget * parent) : QToolTip(parent) {}
+ virtual ~MPHeaderTip() {}
+ protected:
+ void maybeTip(const QPoint &);
+ };
+
//---------------------------------------------------------
// MPWhatsThis
//---------------------------------------------------------
@@ -43,6 +57,7 @@ class MPWhatsThis : public QWhatsThis {
//---------------------------------------------------------
class MPConfig : public SynthConfigBase {
+ MPHeaderTip* _mptooltip;
QPopupMenu* popup;
QPopupMenu* instrPopup;
@@ -52,6 +67,7 @@ class MPConfig : public SynthConfigBase {
private slots:
void rbClicked(QListViewItem*, const QPoint&,int);
+ void mdevViewItemRenamed(QListViewItem*, int, const QString&);
void songChanged(int);
void selectionChanged();
void addInstanceClicked();
@@ -59,6 +75,7 @@ class MPConfig : public SynthConfigBase {
public:
MPConfig(QWidget* parent, char* name);
+ ~MPConfig();
};
#endif
diff --git a/muse/muse/driver/jackmidi.cpp b/muse/muse/driver/jackmidi.cpp
index d27d83d6..c5c565c4 100644
--- a/muse/muse/driver/jackmidi.cpp
+++ b/muse/muse/driver/jackmidi.cpp
@@ -28,11 +28,11 @@
#include "../mplugins/mitplugin.h"
#include "xml.h"
-extern unsigned int volatile lastExtMidiSyncTick;
-
// Turn on debug messages.
//#define JACK_MIDI_DEBUG
+extern unsigned int volatile lastExtMidiSyncTick;
+
///int jackmidi_pi[2];
///int jackmidi_po[2];
@@ -225,13 +225,16 @@ MidiDevice* MidiJackDevice::createJackMidiDevice(QString name, int rwflags) // 1
//snprintf(buf, 80, "midi-out-%d", i);
name.sprintf("midi-out-%d", i);
- // Does not work.
- //if(!audioDevice->findPort(buf))
- // break;
- //client_jackport = (jack_port_t*)audioDevice->registerOutPort(buf, true);
- client_jackport = (jack_port_t*)audioDevice->registerOutPort(name.latin1(), true);
- if(client_jackport)
- break;
+ if(!midiDevices.find(name))
+ {
+ // Does not work.
+ //if(!audioDevice->findPort(buf))
+ // break;
+ //client_jackport = (jack_port_t*)audioDevice->registerOutPort(buf, true);
+ client_jackport = (jack_port_t*)audioDevice->registerOutPort(name.latin1(), true);
+ if(client_jackport)
+ break;
+ }
if(i == 65535)
{
@@ -300,13 +303,16 @@ MidiDevice* MidiJackDevice::createJackMidiDevice(QString name, int rwflags) // 1
//snprintf(buf, 80, "midi-in-%d", i);
name.sprintf("midi-in-%d", i);
- // Does not work.
- //if(!audioDevice->findPort(buf))
- // break;
- //client_jackport = (jack_port_t*)audioDevice->registerInPort(buf, true);
- client_jackport = (jack_port_t*)audioDevice->registerInPort(name.latin1(), true);
- if(client_jackport)
- break;
+ if(!midiDevices.find(name))
+ {
+ // Does not work.
+ //if(!audioDevice->findPort(buf))
+ // break;
+ //client_jackport = (jack_port_t*)audioDevice->registerInPort(buf, true);
+ client_jackport = (jack_port_t*)audioDevice->registerInPort(name.latin1(), true);
+ if(client_jackport)
+ break;
+ }
if(i == 65535)
{
@@ -349,6 +355,19 @@ MidiDevice* MidiJackDevice::createJackMidiDevice(QString name, int rwflags) // 1
}
//---------------------------------------------------------
+// setName
+//---------------------------------------------------------
+
+void MidiJackDevice::setName(const QString& s)
+{
+ #ifdef JACK_MIDI_DEBUG
+ printf("MidiJackDevice::setName %s new name:%s\n", name().latin1(), s.latin1());
+ #endif
+ _name = s;
+ audioDevice->setPortName(clientPort(), s.latin1());
+}
+
+//---------------------------------------------------------
// open
//---------------------------------------------------------
diff --git a/muse/muse/driver/jackmidi.h b/muse/muse/driver/jackmidi.h
index a143b7ff..12b967a9 100644
--- a/muse/muse/driver/jackmidi.h
+++ b/muse/muse/driver/jackmidi.h
@@ -123,6 +123,8 @@ class MidiJackDevice : public MidiDevice {
virtual inline int deviceType() { return JACK_MIDI; }
+ virtual void setName(const QString&);
+
virtual void processMidi();
virtual ~MidiJackDevice();
//virtual int selectRfd();
diff --git a/muse/muse/dssihost.cpp b/muse/muse/dssihost.cpp
index eb07b1d1..318d78bb 100644
--- a/muse/muse/dssihost.cpp
+++ b/muse/muse/dssihost.cpp
@@ -1274,7 +1274,61 @@ iMPEvent DssiSynthIF::getData(MidiPort* /*mp*/, MPEventList* el, iMPEvent /*i*/,
for(; k < synth->_outports; ++k)
descr->connect_port(handle, synth->oIdx[k], audioOutBuffers[k]);
-
+ /*
+ //
+ // p3.3.39 Handle inputs...
+ //
+ //if((song->bounceTrack != this) && !noInRoute())
+ if(!((AudioTrack*)synti)->noInRoute())
+ {
+ RouteList* irl = ((AudioTrack*)synti)->inRoutes();
+ iRoute i = irl->begin();
+ if(!i->track->isMidiTrack())
+ {
+ //if(debugMsg)
+ printf("DssiSynthIF::getData: Error: First route is a midi track route!\n");
+ }
+ else
+ {
+ int ch = i->channel == -1 ? 0 : i->channel;
+ int remch = i->remoteChannel == -1 ? 0 : i->remoteChannel;
+ int chs = i->channels == -1 ? 0 : i->channels;
+
+ // TODO:
+ //if(ch >= synth->_inports)
+ //iUsedIdx[ch] = true;
+ //if(chs == 2)
+ // iUsedIdx[ch + 1] = true;
+
+ //((AudioTrack*)i->track)->copyData(framePos, channels, nframe, bp);
+ ((AudioTrack*)i->track)->copyData(pos, ports,
+ //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0,
+ i->channel,
+ i->channels,
+ n, bp);
+ }
+
+ //unsigned pos, int ports, unsigned n, float** buffer
+
+ ++i;
+ for(; i != irl->end(); ++i)
+ {
+ if(i->track->isMidiTrack())
+ {
+ //if(debugMsg)
+ printf("DssiSynthIF::getData: Error: Route is a midi track route!\n");
+ continue;
+ }
+ //((AudioTrack*)i->track)->addData(framePos, channels, nframe, bp);
+ ((AudioTrack*)i->track)->addData(framePos, channels,
+ //(i->track->type() == Track::AUDIO_SOFTSYNTH && i->channel != -1) ? i->channel : 0,
+ i->channel,
+ i->channels,
+ nframe, bp);
+ }
+ }
+ */
+
// Run the synth for one segment. This processes events and gets/fills our local buffers...
if(synth->dssi->run_synth)
{
@@ -1399,6 +1453,7 @@ SynthIF* DssiSynth::createSIF(SynthI* synti)
{
++_inports;
iIdx.push_back(k);
+ iUsedIdx.push_back(false); // Start out with all false.
}
else if (LADSPA_IS_PORT_OUTPUT(pd))
{
diff --git a/muse/muse/dssihost.h b/muse/muse/dssihost.h
index eb3637f0..0e475de7 100644
--- a/muse/muse/dssihost.h
+++ b/muse/muse/dssihost.h
@@ -50,6 +50,7 @@ class DssiSynth : public Synth {
std::vector<int> opIdx; // This is sometimes a latency port and...?
std::vector<int> iIdx;
std::vector<int> oIdx;
+ std::vector<bool> iUsedIdx; // This is for audio input ports during process to tell whether an input port was used by any input routes.
int _inports, _outports, _controller, _controllerOut;
MidiCtl2LadspaPortMap midiCtl2PortMap;
bool _hasGui;
diff --git a/muse/muse/mididev.h b/muse/muse/mididev.h
index 36b33c27..1b2cf055 100644
--- a/muse/muse/mididev.h
+++ b/muse/muse/mididev.h
@@ -82,7 +82,7 @@ class MidiDevice {
bool noOutRoute() const { return _outRoutes.empty(); }
const QString& name() const { return _name; }
- void setName(const QString& s) { _name = s; }
+ virtual void setName(const QString& s) { _name = s; }
int midiPort() const { return _port; }
void setPort(int p) { _port = p; }
diff --git a/muse/muse/wavetrack.cpp b/muse/muse/wavetrack.cpp
index c4fe7071..30945e9c 100644
--- a/muse/muse/wavetrack.cpp
+++ b/muse/muse/wavetrack.cpp
@@ -190,7 +190,6 @@ Part* WaveTrack::newPart(Part*p, bool clone)
bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float** bp)
{
- // Added by Tim. p3.3.16
//if(debugMsg)
// printf("WaveTrack::getData framePos:%u channels:%d nframe:%u processed?:%d\n", framePos, channels, nframe, processed());
@@ -288,7 +287,6 @@ bool WaveTrack::getData(unsigned framePos, int channels, unsigned nframe, float*
else {
*/
- // Added by Tim. p3.3.16
//printf("WaveTrack::getData no out routes\n");
if (audio->freewheel()) {