summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/arranger/tlist.cpp126
-rw-r--r--muse2/muse/midiedit/dlist.cpp71
-rw-r--r--muse2/muse/midiedit/drumedit.cpp4
-rw-r--r--muse2/muse/midiport.cpp31
-rw-r--r--muse2/muse/widgets/routepopup.cpp4
6 files changed, 147 insertions, 91 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index d0aabb95..04e0c297 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,5 +1,5 @@
09.10.2011:
- - Fixed track list midi port popup menu - too many ports listed. Seperated empty ports into submenu. (Tim)
+ - Fixed track list midi port popup menu - too many ports listed. Separated empty ports into submenu. (Tim)
06.10.2011:
- SigEdit, up/down arrow in denominator only moves between powers of two (decreased thick headedness),
numerator is no longer validated (rj)
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index 87179575..cca8a086 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -586,7 +586,7 @@ void TList::portsPopupMenu(MusECore::Track* t, int x, int y)
case MusECore::Track::MIDI:
case MusECore::Track::DRUM:
case MusECore::Track::AUDIO_SOFTSYNTH:
- {
+ {
MusECore::MidiTrack* track = (MusECore::MidiTrack*)t;
//QPopupMenu* p = MusECore::midiPortsPopup(0);
@@ -604,70 +604,84 @@ void TList::portsPopupMenu(MusECore::Track* t, int x, int y)
QMenu* p = MusECore::midiPortsPopup(this, port); // 0, port);
QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0);
- if (act) {
- int n = act->data().toInt();
- // Changed by T356.
- //track->setOutPort(n);
- //MusEGlobal::audio->msgSetTrackOutPort(track, n);
-
- //MusEGlobal::song->update();
- if (t->type() == MusECore::Track::DRUM) {
- bool change = QMessageBox::question(this, tr("Update drummap?"),
- tr("Do you want to use same port for all instruments in the drummap?"),
- tr("&Yes"), tr("&No"), QString::null, 0, 1);
- MusEGlobal::audio->msgIdle(true);
- if (!change)
- {
- // Delete all port controller events.
- //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(false);
- MusEGlobal::song->changeAllPortDrumCtrlEvents(false);
- track->setOutPort(n);
+ if(!act)
+ {
+ delete p;
+ break;
+ }
+
+ int n = act->data().toInt();
+ delete p;
- for (int i=0; i<DRUM_MAPSIZE; i++) //Remap all drum instruments to this port
- MusEGlobal::drumMap[i].port = track->outPort();
- // Add all port controller events.
- //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true);
- MusEGlobal::song->changeAllPortDrumCtrlEvents(true);
- }
- else
- {
- //MusEGlobal::audio->msgSetTrackOutPort(track, n);
- track->setOutPortAndUpdate(n);
- }
- MusEGlobal::audio->msgIdle(false);
- MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17
- MusEGlobal::song->update();
- }
- else
- if (t->type() == MusECore::Track::AUDIO_SOFTSYNTH)
+ if(n < 0) // Invalid item.
+ break;
+
+ if(n >= MIDI_PORTS) // Show port config dialog.
+ {
+ MusEGlobal::muse->configMidiPorts();
+ break;
+ }
+
+ // Changed by T356.
+ //track->setOutPort(n);
+ //MusEGlobal::audio->msgSetTrackOutPort(track, n);
+
+ //MusEGlobal::song->update();
+ if (t->type() == MusECore::Track::DRUM) {
+ bool change = QMessageBox::question(this, tr("Update drummap?"),
+ tr("Do you want to use same port for all instruments in the drummap?"),
+ tr("&Yes"), tr("&No"), QString::null, 0, 1);
+ MusEGlobal::audio->msgIdle(true);
+ if (!change)
{
- if(md != 0)
- {
- // Idling is already handled in msgSetMidiDevice.
- //MusEGlobal::audio->msgIdle(true);
-
- // Compiler complains if simple cast from Track to MusECore::SynthI...
- MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[n], (MusEGlobal::midiPorts[n].device() == md) ? 0 : md);
- MusEGlobal::muse->changeConfig(true); // save configuration file
-
- //MusEGlobal::audio->msgIdle(false);
- MusEGlobal::song->update();
- }
+ // Delete all port controller events.
+ //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(false);
+ MusEGlobal::song->changeAllPortDrumCtrlEvents(false);
+ track->setOutPort(n);
+
+ for (int i=0; i<DRUM_MAPSIZE; i++) //Remap all drum instruments to this port
+ MusEGlobal::drumMap[i].port = track->outPort();
+ // Add all port controller events.
+ //MusEGlobal::audio->msgChangeAllPortDrumCtrlEvents(true);
+ MusEGlobal::song->changeAllPortDrumCtrlEvents(true);
}
else
{
- MusEGlobal::audio->msgIdle(true);
//MusEGlobal::audio->msgSetTrackOutPort(track, n);
track->setOutPortAndUpdate(n);
- MusEGlobal::audio->msgIdle(false);
- //MusEGlobal::song->update();
- MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17
- MusEGlobal::song->update(SC_MIDI_TRACK_PROP); //
}
- }
- delete p;
+ MusEGlobal::audio->msgIdle(false);
+ MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17
+ MusEGlobal::song->update();
}
- break;
+ else
+ if (t->type() == MusECore::Track::AUDIO_SOFTSYNTH)
+ {
+ if(md != 0)
+ {
+ // Idling is already handled in msgSetMidiDevice.
+ //MusEGlobal::audio->msgIdle(true);
+
+ // Compiler complains if simple cast from Track to MusECore::SynthI...
+ MusEGlobal::midiSeq->msgSetMidiDevice(&MusEGlobal::midiPorts[n], (MusEGlobal::midiPorts[n].device() == md) ? 0 : md);
+ MusEGlobal::muse->changeConfig(true); // save configuration file
+
+ //MusEGlobal::audio->msgIdle(false);
+ MusEGlobal::song->update();
+ }
+ }
+ else
+ {
+ MusEGlobal::audio->msgIdle(true);
+ //MusEGlobal::audio->msgSetTrackOutPort(track, n);
+ track->setOutPortAndUpdate(n);
+ MusEGlobal::audio->msgIdle(false);
+ //MusEGlobal::song->update();
+ MusEGlobal::audio->msgUpdateSoloStates(); // (p4.0.14) p4.0.17
+ MusEGlobal::song->update(SC_MIDI_TRACK_PROP); //
+ }
+ }
+ break;
case MusECore::Track::WAVE:
case MusECore::Track::AUDIO_OUTPUT:
diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp
index c6cd9b2e..854fe552 100644
--- a/muse2/muse/midiedit/dlist.cpp
+++ b/muse2/muse/midiedit/dlist.cpp
@@ -29,6 +29,8 @@
#include <stdio.h>
+#include "globals.h"
+#include "app.h"
#include "audio.h"
#include "pitchedit.h"
#include "midiport.h"
@@ -180,37 +182,52 @@ void DList::draw(QPainter& p, const QRect& rect)
void DList::devicesPopupMenu(MusECore::DrumMap* t, int x, int y, bool changeAll)
{
- QMenu* p = MusECore::midiPortsPopup();
+ QMenu* p = MusECore::midiPortsPopup(this, t->port);
QAction* act = p->exec(mapToGlobal(QPoint(x, y)), 0);
bool doemit = false;
- if (act) {
- int n = act->data().toInt();
- if (!changeAll)
- {
- if(n != t->port)
- {
- MusEGlobal::audio->msgIdle(true);
- MusEGlobal::song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, n);
- MusEGlobal::audio->msgIdle(false);
- t->port = n;
- doemit = true;
- }
- }
- else {
- MusEGlobal::audio->msgIdle(true);
- // Delete all port controller events.
- MusEGlobal::song->changeAllPortDrumCtrlEvents(false);
-
- for (int i = 0; i < DRUM_MAPSIZE; i++)
- MusEGlobal::drumMap[i].port = n;
- // Add all port controller events.
- MusEGlobal::song->changeAllPortDrumCtrlEvents(true);
+ if(!act)
+ {
+ delete p;
+ return;
+ }
+
+ int n = act->data().toInt();
+ delete p;
+
+ if(n < 0) // Invalid item.
+ return;
+
+ if(n >= MIDI_PORTS) // Show port config dialog.
+ {
+ MusEGlobal::muse->configMidiPorts();
+ return;
+ }
- MusEGlobal::audio->msgIdle(false);
- doemit = true;
- }
+ if (!changeAll)
+ {
+ if(n != t->port)
+ {
+ MusEGlobal::audio->msgIdle(true);
+ MusEGlobal::song->remapPortDrumCtrlEvents(getSelectedInstrument(), -1, -1, n);
+ MusEGlobal::audio->msgIdle(false);
+ t->port = n;
+ doemit = true;
+ }
+ }
+ else {
+ MusEGlobal::audio->msgIdle(true);
+ // Delete all port controller events.
+ MusEGlobal::song->changeAllPortDrumCtrlEvents(false);
+
+ for (int i = 0; i < DRUM_MAPSIZE; i++)
+ MusEGlobal::drumMap[i].port = n;
+ // Add all port controller events.
+ MusEGlobal::song->changeAllPortDrumCtrlEvents(true);
+
+ MusEGlobal::audio->msgIdle(false);
+ doemit = true;
}
- delete p;
+
if(doemit)
{
int instr = getSelectedInstrument();
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 4a234481..03580142 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -118,7 +118,7 @@ void DrumEdit::setHeaderWhatsThis()
header->setWhatsThis(COL_NOTELENGTH, tr("note length"));
header->setWhatsThis(COL_NOTE, tr("this is the note which is played"));
header->setWhatsThis(COL_OUTCHANNEL, tr("output channel (hold ctl to affect all rows)"));
- header->setWhatsThis(COL_OUTPORT, tr("output port"));
+ header->setWhatsThis(COL_OUTPORT, tr("output port (hold ctl to affect all rows)"));
header->setWhatsThis(COL_LEVEL1, tr("shift + control key: draw velocity level 1"));
header->setWhatsThis(COL_LEVEL2, tr("control key: draw velocity level 2"));
header->setWhatsThis(COL_LEVEL3, tr("shift key: draw velocity level 3"));
@@ -139,7 +139,7 @@ void DrumEdit::setHeaderToolTips()
header->setToolTip(COL_NOTELENGTH, tr("note length"));
header->setToolTip(COL_NOTE, tr("this is the note which is played"));
header->setToolTip(COL_OUTCHANNEL, tr("output channel (ctl: affect all rows)"));
- header->setToolTip(COL_OUTPORT, tr("output port"));
+ header->setToolTip(COL_OUTPORT, tr("output port (ctl: affect all rows)"));
header->setToolTip(COL_LEVEL1, tr("shift + control key: draw velocity level 1"));
header->setToolTip(COL_LEVEL2, tr("control key: draw velocity level 2"));
header->setToolTip(COL_LEVEL3, tr("shift key: draw velocity level 3"));
diff --git a/muse2/muse/midiport.cpp b/muse2/muse/midiport.cpp
index 49934d7b..71a90fe7 100644
--- a/muse2/muse/midiport.cpp
+++ b/muse2/muse/midiport.cpp
@@ -38,6 +38,7 @@
#include "app.h"
#include "song.h"
#include "menutitleitem.h"
+#include "icons.h"
//#ifdef DSSI_SUPPORT
//#include "dssihost.h"
@@ -320,10 +321,34 @@ int MidiPort::portno() const
QMenu* midiPortsPopup(QWidget* parent, int checkPort)
{
QMenu* p = new QMenu(parent);
- p->addAction(new MusEGui::MenuTitleItem("Port / Device", p));
QMenu* subp = 0;
QAction *act = 0;
QString name;
+
+ // Warn if no devices available. Add an item to open midi config.
+ int pi = 0;
+ for( ; pi < MIDI_PORTS; ++pi)
+ {
+ MusECore::MidiDevice* md = MusEGlobal::midiPorts[pi].device();
+ //if(md && !md->isSynti() && (md->rwFlags() & 1))
+ //if(md && (md->rwFlags() & 1))
+ if(md && (md->rwFlags() & 1 || md->isSynti()) )
+ break;
+ }
+ if(pi == MIDI_PORTS)
+ {
+ act = p->addAction(p->tr("Warning: No output devices!"));
+ act->setCheckable(false);
+ act->setData(-1);
+ p->addSeparator();
+ }
+ act = p->addAction(QIcon(*MusEGui::settings_midiport_softsynthsIcon), p->tr("Open midi config..."));
+ act->setCheckable(false);
+ act->setData(MIDI_PORTS);
+ p->addSeparator();
+
+ p->addAction(new MusEGui::MenuTitleItem("Output port/device", p));
+
for (int i = 0; i < MIDI_PORTS; ++i) {
MidiPort* port = &MusEGlobal::midiPorts[i];
name.sprintf("%d:%s", port->portno()+1, port->portname().toLatin1().constData());
@@ -340,8 +365,8 @@ QMenu* midiPortsPopup(QWidget* parent, int checkPort)
if(!subp) // No submenu yet? Create it now.
{
subp = new QMenu(p);
- subp->setTitle(subp->tr("Empty"));
- subp->addAction(new MusEGui::MenuTitleItem("Empty Ports", subp));
+ subp->setTitle(subp->tr("Empty ports"));
+ //subp->addAction(new MusEGui::MenuTitleItem("Empty Ports", subp));
}
//act = subp->addAction(name); // No need for all those "<None>" names.
act = subp->addAction(QString().setNum(i+1));
diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp
index 799d9079..73d29c25 100644
--- a/muse2/muse/widgets/routepopup.cpp
+++ b/muse2/muse/widgets/routepopup.cpp
@@ -1069,7 +1069,7 @@ void RoutePopupMenu::prepare()
}
if(pi == MIDI_PORTS)
{
- act = _pup->addAction(tr("Warning: No midi input devices!"));
+ act = _pup->addAction(tr("Warning: No input devices!"));
act->setCheckable(false);
act->setData(-1);
_pup->addSeparator();
@@ -1080,7 +1080,7 @@ void RoutePopupMenu::prepare()
_pup->addSeparator();
++gid;
- _pup->addAction(new MenuTitleItem("Midi input ports", _pup));
+ _pup->addAction(new MenuTitleItem("Input port/device", _pup));
for(int i = 0; i < MIDI_PORTS; ++i)
{