summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-06-08 13:01:37 +0000
committerWerner Schweer <ws.seh.de>2006-06-08 13:01:37 +0000
commite7af11295d22d1506ae2b729412f46a510d91f91 (patch)
tree8ba1f383ef96da193430c8f3f261b23fb9426995
parent52d1753ad03a5e2d427502fb580820d4e61f7378 (diff)
MidiPort deviceId
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/muse/CMakeLists.txt3
-rw-r--r--muse/muse/arranger/arranger.cpp19
-rw-r--r--muse/muse/arranger/arranger.h13
-rw-r--r--muse/muse/arranger/midichannelinfo.ui56
-rw-r--r--muse/muse/arranger/midiportinfo.ui70
-rw-r--r--muse/muse/arranger/miditrackinfo.ui184
-rw-r--r--muse/muse/arranger/trackinfo.cpp291
-rw-r--r--muse/muse/arranger/trackinfo.h20
-rw-r--r--muse/muse/conf.cpp9
-rw-r--r--muse/muse/midi.cpp29
-rw-r--r--muse/muse/midiport.cpp8
-rw-r--r--muse/muse/sync.cpp5
-rw-r--r--muse/muse/sync.h4
-rw-r--r--muse/muse/track.h4
-rw-r--r--muse/muse/widgets/midisync.cpp8
16 files changed, 538 insertions, 187 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 5fae2df6..52aea99a 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,5 @@
+8.6.
+ * implemented deviceId for MidiPort
3.6. (rj)
* fixed plugin drag&drop problem
* enabled tool shortcuts in arranger
diff --git a/muse/muse/CMakeLists.txt b/muse/muse/CMakeLists.txt
index b9a5ea93..100dc6d6 100644
--- a/muse/muse/CMakeLists.txt
+++ b/muse/muse/CMakeLists.txt
@@ -52,6 +52,9 @@ set (muse_uics
midiedit/quantconfig
mixer/routedialog
arranger/configtrack
+ arranger/miditrackinfo
+ arranger/midiportinfo
+ arranger/midichannelinfo
)
set(muse_mocs
diff --git a/muse/muse/arranger/arranger.cpp b/muse/muse/arranger/arranger.cpp
index 6626627d..975cdc85 100644
--- a/muse/muse/arranger/arranger.cpp
+++ b/muse/muse/arranger/arranger.cpp
@@ -77,6 +77,15 @@ TrGroupList glist[Track::TRACK_TYPES];
extern void populateAddTrack(QMenu*);
//---------------------------------------------------------
+// sizeHint
+//---------------------------------------------------------
+
+QSize InfoStack::sizeHint() const
+ {
+ return QSize(infoWidth, height());
+ }
+
+//---------------------------------------------------------
// TLayout
// simple layout for trackList
//---------------------------------------------------------
@@ -290,10 +299,9 @@ Arranger::Arranger(QMainWindow* parent)
infoDock = new QDockWidget(tr("TrackInfo"));
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
- infoDock->setFixedWidth(infoWidth);
+ infoDock->setMinimumWidth(infoWidth);
infoDock->layout()->setMargin(0);
infoDock->layout()->setSpacing(0);
- infoDock->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
infoDockAction = infoDock->toggleViewAction();
mixerDock = new QDockWidget(tr("Mix"));
@@ -301,7 +309,6 @@ Arranger::Arranger(QMainWindow* parent)
mixerDock->setFixedWidth(STRIP_WIDTH);
mixerDock->layout()->setMargin(0);
mixerDock->layout()->setSpacing(0);
- mixerDock->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
mixerDockAction = mixerDock->toggleViewAction();
parent->addDockWidget(Qt::LeftDockWidgetArea, infoDock, Qt::Horizontal);
@@ -309,11 +316,12 @@ Arranger::Arranger(QMainWindow* parent)
infoView = new QScrollArea;
infoDock->setWidget(infoView);
- infoView->setFixedWidth(infoWidth);
infoView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- trackInfo = new QStackedWidget;
+
+ trackInfo = new InfoStack();
infoView->setWidget(trackInfo);
infoView->setWidgetResizable(true);
+ trackInfo->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);
trackInfoVisible = false;
mixerStripVisible = false;
@@ -328,7 +336,6 @@ Arranger::Arranger(QMainWindow* parent)
tlsvLayout = new TlsvLayout;
tlsv->setLayout(tlsvLayout);
trackList = new QWidget;
-// trackList->setAttribute(Qt::WA_NoSystemBackground);
trackList->setAttribute(Qt::WA_StaticContents);
trackList->setMouseTracking(true);
diff --git a/muse/muse/arranger/arranger.h b/muse/muse/arranger/arranger.h
index 044fcfc9..8a8632b4 100644
--- a/muse/muse/arranger/arranger.h
+++ b/muse/muse/arranger/arranger.h
@@ -45,6 +45,19 @@ class TlsvLayout;
class TLayout;
//---------------------------------------------------------
+// InfoStack
+//---------------------------------------------------------
+
+class InfoStack : public QStackedWidget {
+ Q_OBJECT;
+
+ virtual QSize sizeHint() const;
+
+ public:
+ InfoStack() : QStackedWidget() {}
+ };
+
+//---------------------------------------------------------
// TrackListWidget
//---------------------------------------------------------
diff --git a/muse/muse/arranger/midichannelinfo.ui b/muse/muse/arranger/midichannelinfo.ui
new file mode 100644
index 00000000..85fb5e9f
--- /dev/null
+++ b/muse/muse/arranger/midichannelinfo.ui
@@ -0,0 +1,56 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>MidiChannelInfoBase</class>
+ <widget class="QWidget" name="MidiChannelInfoBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>134</width>
+ <height>83</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>6</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="patch" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" >
+ <string>Instrument Patch</string>
+ </property>
+ <property name="text" >
+ <string>???</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/muse/muse/arranger/midiportinfo.ui b/muse/muse/arranger/midiportinfo.ui
new file mode 100644
index 00000000..d59b6eed
--- /dev/null
+++ b/muse/muse/arranger/midiportinfo.ui
@@ -0,0 +1,70 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>MidiPortInfoBase</class>
+ <widget class="QWidget" name="MidiPortInfoBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>142</width>
+ <height>96</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>6</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item row="0" column="0" colspan="2" >
+ <widget class="QComboBox" name="instrument" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" >
+ <string>Midi Instrument</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QSpinBox" name="deviceId" >
+ <property name="maximum" >
+ <number>127</number>
+ </property>
+ <property name="value" >
+ <number>127</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Device-Id:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/muse/muse/arranger/miditrackinfo.ui b/muse/muse/arranger/miditrackinfo.ui
new file mode 100644
index 00000000..cd143b28
--- /dev/null
+++ b/muse/muse/arranger/miditrackinfo.ui
@@ -0,0 +1,184 @@
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>MidiTrackInfoBase</class>
+ <widget class="QWidget" name="MidiTrackInfoBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>134</width>
+ <height>133</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>6</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_5" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Compr.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Transp.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Delay</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Length</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="label_4" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Velocity</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QSpinBox" name="transposition" >
+ <property name="toolTip" >
+ <string>Pitch Transpose</string>
+ </property>
+ <property name="maximum" >
+ <number>127</number>
+ </property>
+ <property name="minimum" >
+ <number>-127</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QSpinBox" name="delay" >
+ <property name="toolTip" >
+ <string>Track Delay (ticks)</string>
+ </property>
+ <property name="maximum" >
+ <number>1000</number>
+ </property>
+ <property name="minimum" >
+ <number>-1000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QSpinBox" name="length" >
+ <property name="toolTip" >
+ <string>Modify Note Length</string>
+ </property>
+ <property name="suffix" >
+ <string>%</string>
+ </property>
+ <property name="maximum" >
+ <number>200</number>
+ </property>
+ <property name="minimum" >
+ <number>25</number>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QSpinBox" name="velocity" >
+ <property name="toolTip" >
+ <string>Modify Note Velocity</string>
+ </property>
+ <property name="maximum" >
+ <number>127</number>
+ </property>
+ <property name="minimum" >
+ <number>-127</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QSpinBox" name="compression" >
+ <property name="toolTip" >
+ <string>Compress Note Velocity</string>
+ </property>
+ <property name="suffix" >
+ <string>%</string>
+ </property>
+ <property name="maximum" >
+ <number>200</number>
+ </property>
+ <property name="minimum" >
+ <number>25</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/muse/muse/arranger/trackinfo.cpp b/muse/muse/arranger/trackinfo.cpp
index 3346e05d..fb0f3127 100644
--- a/muse/muse/arranger/trackinfo.cpp
+++ b/muse/muse/arranger/trackinfo.cpp
@@ -60,6 +60,7 @@ TrackInfo* Arranger::createTrackInfo()
//---------------------------------------------------------
TrackInfo::TrackInfo()
+ : QWidget()
{
label = new QLabel;
label->setToolTip(tr("Track Type"));
@@ -73,9 +74,11 @@ TrackInfo::TrackInfo()
grid->setMargin(0);
grid->setSpacing(0);
setLayout(grid);
+
grid->addWidget(label, 0, 0, 1, 2);
grid->addWidget(name, 1, 0, 1, 2);
connect(name, SIGNAL(contentChanged(QString)), SLOT(nameChanged(QString)));
+ resize(QSize(infoWidth, height()));
}
//---------------------------------------------------------
@@ -121,88 +124,49 @@ void TrackInfo::songChanged(int val)
MidiTrackInfo::MidiTrackInfo()
: TrackInfo()
{
- QLabel* l1 = new QLabel(tr("Transp."));
- QLabel* l2 = new QLabel(tr("Delay"));
- QLabel* l3 = new QLabel(tr("Length"));
- QLabel* l4 = new QLabel(tr("Velocity"));
- QLabel* l5 = new QLabel(tr("Compr."));
-
- transposition = new QSpinBox;
- transposition->setRange(-127, 127);
- transposition->setToolTip(tr("Pitch Transpose"));
-
- delay = new QSpinBox;
- delay->setRange(-1000, 1000);
- delay->setToolTip(tr("Track Delay (ticks)"));
-
- length = new QSpinBox;
- length->setRange(25, 200);
- length->setToolTip(tr("Modify Note Length"));
- length->setSuffix("%");
-
- velocity = new QSpinBox;
- velocity->setRange(-127, 127);
- velocity->setToolTip(tr("Modify Note Velocity"));
-
- compression = new QSpinBox;
- compression->setRange(25, 200);
- compression->setSuffix("%");
- compression->setToolTip(tr("Compress Note Velocity"));
+ QWidget* midiTrackInfo = new QWidget;
+ mt.setupUi(midiTrackInfo);
- grid->addWidget(transposition, 2, 0);
- grid->addWidget(l1, 2, 1);
+ QWidget* midiChannelInfo = new QWidget;
+ mc.setupUi(midiChannelInfo);
- grid->addWidget(delay, 3, 0);
- grid->addWidget(l2, 3, 1);
+ QWidget* midiPortInfo = new QWidget;
+ mp.setupUi(midiPortInfo);
- grid->addWidget(length, 4, 0);
- grid->addWidget(l3, 4, 1);
+ grid->addWidget(midiTrackInfo, 2, 0, 1, 2);
- grid->addWidget(velocity, 5, 0);
- grid->addWidget(l4, 5, 1);
-
- grid->addWidget(compression, 6, 0);
- grid->addWidget(l5, 6, 1);
-
- //
- // Midi Channel
- //
- QLabel* label = new QLabel(tr("Midi Channel"));
+ QLabel* label = new QLabel;
+ label->setText(tr("Midi Channel"));
label->setLineWidth(2);
label->setFrameStyle(QFrame::Panel | QFrame::Raised);
- grid->addWidget(label, 7, 0, 1, 2);
+ grid->addWidget(label, 3, 0, 1, 2);
+
channel = new QComboBox;
- grid->addWidget(channel, 8, 0, 1, 2);
- patch = new QPushButton;
- patch->setText("???");
- patch->setToolTip(tr("Instrument Patch"));
- grid->addWidget(patch, 9, 0, 1, 2);
- pop = new QMenu(patch);
+ grid->addWidget(channel, 4, 0, 1, 2);
+ grid->addWidget(midiChannelInfo, 5, 0, 1, 2);
- //
- // Midi Out Port
- //
- label = new QLabel(tr("Midi Out Port"));
+ label = new QLabel;
+ label->setText(tr("Midi Port"));
label->setLineWidth(2);
label->setFrameStyle(QFrame::Panel | QFrame::Raised);
- grid->addWidget(label, 10, 0, 1, 2);
- port = new QComboBox;
- grid->addWidget(port, 11, 0, 1, 2);
+ grid->addWidget(label, 6, 0, 1, 2);
- instrument = new QComboBox;
- instrument->setFixedWidth(infoWidth);
- instrument->setToolTip(tr("Midi Instrument"));
- grid->addWidget(instrument, 12, 0, 1, 2);
-
- connect(transposition, SIGNAL(valueChanged(int)), SLOT(transpositionChanged(int)));
- connect(velocity, SIGNAL(valueChanged(int)), SLOT(velocityChanged(int)));
- connect(delay, SIGNAL(valueChanged(int)), SLOT(delayChanged(int)));
- connect(length, SIGNAL(valueChanged(int)), SLOT(lenChanged(int)));
- connect(compression, SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int)));
- connect(patch, SIGNAL(clicked()), SLOT(patchClicked()));
- connect(channel, SIGNAL(activated(int)), SLOT(channelSelected(int)));
- connect(port, SIGNAL(activated(int)), SLOT(portSelected(int)));
- connect(instrument, SIGNAL(activated(int)), SLOT(instrumentSelected(int)));
+ port = new QComboBox;
+ grid->addWidget(port, 7, 0, 1, 2);
+ grid->addWidget(midiPortInfo, 8, 0, 1, 2);
+
+ pop = new QMenu(mc.patch);
+
+ connect(mt.transposition, SIGNAL(valueChanged(int)), SLOT(transpositionChanged(int)));
+ connect(mt.velocity, SIGNAL(valueChanged(int)), SLOT(velocityChanged(int)));
+ connect(mt.delay, SIGNAL(valueChanged(int)), SLOT(delayChanged(int)));
+ connect(mt.length, SIGNAL(valueChanged(int)), SLOT(lenChanged(int)));
+ connect(mt.compression, SIGNAL(valueChanged(int)), SLOT(iKomprChanged(int)));
+ connect(mc.patch, SIGNAL(clicked()), SLOT(patchClicked()));
+ connect(channel, SIGNAL(activated(int)), SLOT(channelSelected(int)));
+ connect(port, SIGNAL(activated(int)), SLOT(portSelected(int)));
+ connect(mp.instrument, SIGNAL(activated(int)), SLOT(instrumentSelected(int)));
+ connect(mp.deviceId, SIGNAL(valueChanged(int)), SLOT(deviceIdChanged(int)));
connect(song, SIGNAL(autoReadChanged(Track*,bool)), SLOT(autoChanged(Track*,bool)));
connect(song, SIGNAL(autoWriteChanged(Track*,bool)), SLOT(autoChanged(Track*,bool)));
grid->setRowStretch(grid->rowCount(), 100);
@@ -215,14 +179,14 @@ MidiTrackInfo::MidiTrackInfo()
void MidiTrackInfo::init(Track* t)
{
TrackInfo::init(t);
- transposition->setValue(((MidiTrack*)track)->transposition);
- delay->setValue(((MidiTrack*)track)->delay);
- length->setValue(((MidiTrack*)track)->len);
- velocity->setValue(((MidiTrack*)track)->velocity);
- compression->setValue(((MidiTrack*)track)->compression);
-
- instrument->clear();
- MidiChannel* mc = ((MidiTrack*)track)->channel();
+ mt.transposition->setValue(((MidiTrack*)track)->transposition);
+ mt.delay->setValue(((MidiTrack*)track)->delay);
+ mt.length->setValue(((MidiTrack*)track)->len);
+ mt.velocity->setValue(((MidiTrack*)track)->velocity);
+ mt.compression->setValue(((MidiTrack*)track)->compression);
+
+ mp.instrument->clear();
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
int portIndex = 0;
int channelIndex = 0;
@@ -234,18 +198,18 @@ void MidiTrackInfo::init(Track* t)
int k = 0;
for (iMidiOutPort i = opl->begin(); i != opl->end(); ++i, ++k) {
port->addItem((*i)->name(), k);
- if (mc && mc->port() == *i)
+ if (midic && midic->port() == *i)
portIndex = k + 1;
}
- if (mc) {
- MidiOutPort* op = mc->port();
+ if (midic) {
+ MidiOutPort* op = midic->port();
for (int i = 0; i < MIDI_CHANNELS; ++i) {
MidiChannel* c = op->channel(i);
- if (mc == c)
+ if (midic == c)
channelIndex = i + 1;
channel->addItem(c->name(), i);
}
- connect(mc, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
+ connect(midic, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
connect(op, SIGNAL(instrumentChanged()), SLOT(instrumentChanged()));
channel->setCurrentIndex(channelIndex);
port->setCurrentIndex(portIndex);
@@ -253,21 +217,23 @@ void MidiTrackInfo::init(Track* t)
int idx = 0;
int curIdx = 0;
for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
- instrument->addItem((*i)->iname());
+ mp.instrument->addItem((*i)->iname());
if ((*i)->iname() == mi->iname())
curIdx = idx;
}
- instrument->setCurrentIndex(curIdx);
- autoChanged(mc, false); // update enable
- int val = mc->ctrlVal(CTRL_PROGRAM).i;
- patch->setText(mi->getPatchName(mc->channelNo(), val));
+ mp.instrument->setCurrentIndex(curIdx);
+ mp.deviceId->setValue(op->deviceId());
+ autoChanged(midic, false); // update enable
+ int val = midic->ctrlVal(CTRL_PROGRAM).i;
+ int channelno = midic->channelNo();
+ mc.patch->setText(mi->getPatchName(channelno, val));
}
else {
channel->setCurrentIndex(0);
port->setCurrentIndex(0);
- instrument->addItem("--");
- instrument->setCurrentIndex(0);
- patch->setText("--");
+ mp.instrument->addItem("--");
+ mp.instrument->setCurrentIndex(0);
+ mc.patch->setText("--");
}
}
@@ -282,17 +248,17 @@ void MidiTrackInfo::portSelected(int portno)
--portno;
Route srcRoute(track, -1, Route::TRACK);
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- if (mc) {
- Route odstRoute(mc, -1, Route::TRACK);
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (midic) {
+ Route odstRoute(midic, -1, Route::TRACK);
audio->msgRemoveRoute(srcRoute, odstRoute);
}
- int channel = mc ? mc->channelNo() : 0;
- MidiOutPort* mp = song->midiOutPort(portno);
- mc = mp->channel(channel);
+ int channel = midic ? midic->channelNo() : 0;
+ MidiOutPort* midip = song->midiOutPort(portno);
+ midic = midip->channel(channel);
- Route dstRoute(mc, -1, Route::TRACK);
+ Route dstRoute(midic, -1, Route::TRACK);
audio->msgAddRoute(srcRoute, dstRoute);
song->update(SC_ROUTE);
@@ -308,15 +274,15 @@ void MidiTrackInfo::channelSelected(int ch)
return;
--ch;
Route srcRoute(track, -1, Route::TRACK);
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- MidiOutPort* mp = mc->port();
- if (mc) {
- Route odstRoute(mc, -1, Route::TRACK);
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ MidiOutPort* midip = midic->port();
+ if (midic) {
+ Route odstRoute(midic, -1, Route::TRACK);
audio->msgRemoveRoute(srcRoute, odstRoute);
}
- mc = mp->channel(ch);
- Route dstRoute(mc, -1, Route::TRACK);
+ midic = midip->channel(ch);
+ Route dstRoute(midic, -1, Route::TRACK);
audio->msgAddRoute(srcRoute, dstRoute);
song->update(SC_ROUTE);
@@ -329,12 +295,12 @@ void MidiTrackInfo::channelSelected(int ch)
void MidiTrackInfo::controllerChanged(int id)
{
if (id == CTRL_PROGRAM) {
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- if (mc) {
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (midic) {
+ MidiOutPort* op = midic->port();
MidiInstrument* mi = op->instrument();
- int val = mc->ctrlVal(id).i;
- patch->setText(mi->getPatchName(mc->channelNo(), val));
+ int val = midic->ctrlVal(id).i;
+ mc.patch->setText(mi->getPatchName(midic->channelNo(), val));
}
}
}
@@ -345,21 +311,21 @@ void MidiTrackInfo::controllerChanged(int id)
void MidiTrackInfo::instrumentChanged()
{
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- if (mc) {
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (midic) {
+ MidiOutPort* op = midic->port();
MidiInstrument* mi = op->instrument();
int idx = 0;
for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
if (*i == mi) {
- instrument->setCurrentIndex(idx);
+ mp.instrument->setCurrentIndex(idx);
break;
}
}
}
else {
- instrument->clear();
- instrument->setCurrentIndex(0);
+ mp.instrument->clear();
+ mp.instrument->setCurrentIndex(0);
}
}
@@ -369,13 +335,13 @@ void MidiTrackInfo::instrumentChanged()
void MidiTrackInfo::autoChanged(Track* t, bool)
{
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- if (mc != t)
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (midic != t)
return;
bool ar = t->autoRead();
bool aw = t->autoWrite();
bool en = !ar || (ar && aw);
- patch->setEnabled(en);
+ mc.patch->setEnabled(en);
}
//---------------------------------------------------------
@@ -393,19 +359,19 @@ void MidiTrackInfo::transpositionChanged(int val)
void MidiTrackInfo::patchClicked()
{
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- if (!mc)
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (!midic)
return;
-
- MidiOutPort* op = mc->port();
+
+ MidiOutPort* op = midic->port();
MidiInstrument* mi = op->instrument();
mi->populatePatchPopup(pop, 0);
- QAction* rv = pop->exec(patch->mapToGlobal(QPoint(10,5)));
+ QAction* rv = pop->exec(mc.patch->mapToGlobal(QPoint(10,5)));
if (rv != 0) {
CVal cval;
cval.i = rv->data().toInt();
- song->setControllerVal(mc, CTRL_PROGRAM, cval);
+ song->setControllerVal(midic, CTRL_PROGRAM, cval);
}
}
@@ -415,10 +381,10 @@ void MidiTrackInfo::patchClicked()
void MidiTrackInfo::instrumentSelected(int n)
{
- MidiChannel* mc = ((MidiTrack*)track)->channel();
- if (mc == 0)
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (midic == 0)
return;
- MidiOutPort* op = mc->port();
+ MidiOutPort* op = midic->port();
op->setInstrument(midiInstruments[n]);
}
@@ -459,6 +425,19 @@ void MidiTrackInfo::iKomprChanged(int val)
}
//---------------------------------------------------------
+// deviceIdChanged
+//---------------------------------------------------------
+
+void MidiTrackInfo::deviceIdChanged(int val)
+ {
+ MidiChannel* midic = ((MidiTrack*)track)->channel();
+ if (midic == 0)
+ return;
+ MidiOutPort* op = midic->port();
+ op->setDeviceId(val);
+ }
+
+//---------------------------------------------------------
// AudioOutputInfo
//---------------------------------------------------------
@@ -535,14 +514,14 @@ MidiSynthIInfo::MidiSynthIInfo()
MidiOutPortInfo::MidiOutPortInfo()
: TrackInfo()
{
- instrument = new QComboBox(this);
- instrument->setFixedWidth(infoWidth);
- instrument->setToolTip(tr("Midi Instrument"));
- grid->addWidget(instrument, 2, 0, 1, 2);
+ QWidget* midiPortInfo = new QWidget;
+ mp.setupUi(midiPortInfo);
+ grid->addWidget(midiPortInfo, 2, 0, 1, 2);
grid->setRowStretch(grid->rowCount(), 100);
- connect(instrument, SIGNAL(activated(int)), SLOT(instrumentSelected(int)));
+ connect(mp.instrument, SIGNAL(activated(int)), SLOT(instrumentSelected(int)));
+ connect(mp.deviceId, SIGNAL(valueChanged(int)), SLOT(deviceIdChanged(int)));
}
//---------------------------------------------------------
@@ -557,17 +536,27 @@ void MidiOutPortInfo::init(Track* t)
MidiInstrument* mi = op->instrument();
int idx = 0;
int curIdx = 0;
- instrument->clear();
+ mp.instrument->clear();
for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
- instrument->addItem((*i)->iname());
+ mp.instrument->addItem((*i)->iname());
if ((*i)->iname() == mi->iname())
curIdx = idx;
}
- instrument->setCurrentIndex(curIdx);
+ mp.instrument->setCurrentIndex(curIdx);
+ mp.deviceId->setValue(op->deviceId());
connect(t, SIGNAL(instrumentChanged()), SLOT(instrumentChanged()));
}
//---------------------------------------------------------
+// deviceIdChanged
+//---------------------------------------------------------
+
+void MidiOutPortInfo::deviceIdChanged(int val)
+ {
+ ((MidiOutPort*)track)->setDeviceId(val);
+ }
+
+//---------------------------------------------------------
// instrumentChanged
//---------------------------------------------------------
@@ -578,7 +567,7 @@ void MidiOutPortInfo::instrumentChanged()
int idx = 0;
for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
if (*i == mi) {
- instrument->setCurrentIndex(idx);
+ mp.instrument->setCurrentIndex(idx);
break;
}
}
@@ -650,10 +639,10 @@ MidiChannelInfo::MidiChannelInfo()
void MidiChannelInfo::init(Track* t)
{
TrackInfo::init(t);
- MidiChannel* mc = (MidiChannel*)t;
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = (MidiChannel*)t;
+ MidiOutPort* op = midic->port();
connect(op, SIGNAL(instrumentChanged()), SLOT(instrumentChanged()));
- connect(mc, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
+ connect(midic, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
portName->setText(op->name());
MidiInstrument* mi = op->instrument();
int idx = 0;
@@ -672,8 +661,8 @@ void MidiChannelInfo::init(Track* t)
void MidiChannelInfo::instrumentSelected(int n)
{
- MidiChannel* mc = (MidiChannel*)track;
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = (MidiChannel*)track;
+ MidiOutPort* op = midic->port();
op->setInstrument(midiInstruments[n]);
}
@@ -683,8 +672,8 @@ void MidiChannelInfo::instrumentSelected(int n)
void MidiChannelInfo::instrumentChanged()
{
- MidiChannel* mc = (MidiChannel*)track;
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = (MidiChannel*)track;
+ MidiOutPort* op = midic->port();
MidiInstrument* mi = op->instrument();
int idx = 0;
for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
@@ -701,8 +690,8 @@ void MidiChannelInfo::instrumentChanged()
void MidiChannelInfo::patchClicked()
{
- MidiChannel* mc = (MidiChannel*)track;
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = (MidiChannel*)track;
+ MidiOutPort* op = midic->port();
MidiInstrument* mi = op->instrument();
mi->populatePatchPopup(pop, 0);
@@ -710,7 +699,7 @@ void MidiChannelInfo::patchClicked()
if (rv != 0) {
CVal cval;
cval.i = rv->data().toInt();
- song->setControllerVal(mc, CTRL_PROGRAM, cval);
+ song->setControllerVal(midic, CTRL_PROGRAM, cval);
}
}
@@ -721,10 +710,10 @@ void MidiChannelInfo::patchClicked()
void MidiChannelInfo::controllerChanged(int id)
{
if (id == CTRL_PROGRAM) {
- MidiChannel* mc = (MidiChannel*)track;
- MidiOutPort* op = mc->port();
+ MidiChannel* midic = (MidiChannel*)track;
+ MidiOutPort* op = midic->port();
MidiInstrument* mi = op->instrument();
- int val = mc->ctrlVal(id).i;
- patch->setText(mi->getPatchName(mc->channelNo(), val));
+ int val = midic->ctrlVal(id).i;
+ patch->setText(mi->getPatchName(midic->channelNo(), val));
}
}
diff --git a/muse/muse/arranger/trackinfo.h b/muse/muse/arranger/trackinfo.h
index d4565aa4..8ef253a8 100644
--- a/muse/muse/arranger/trackinfo.h
+++ b/muse/muse/arranger/trackinfo.h
@@ -21,6 +21,10 @@
#ifndef __TRACKINFO_H__
#define __TRACKINFO_H__
+#include "ui_miditrackinfo.h"
+#include "ui_midichannelinfo.h"
+#include "ui_midiportinfo.h"
+
class Track;
class MidiTrack;
class AudioOutput;
@@ -64,15 +68,11 @@ class TrackInfo : public QWidget {
class MidiTrackInfo : public TrackInfo {
Q_OBJECT
- QSpinBox* transposition;
- QSpinBox* delay;
- QSpinBox* length;
- QSpinBox* velocity;
- QSpinBox* compression;
- QComboBox* channel;
- QPushButton* patch;
+ Ui::MidiTrackInfoBase mt;
+ Ui::MidiChannelInfoBase mc;
+ Ui::MidiPortInfoBase mp;
QComboBox* port;
- QComboBox* instrument;
+ QComboBox* channel;
QMenu* pop;
private slots:
@@ -88,6 +88,7 @@ class MidiTrackInfo : public TrackInfo {
void controllerChanged(int);
void portSelected(int);
void channelSelected(int);
+ void deviceIdChanged(int);
public:
MidiTrackInfo();
@@ -178,11 +179,12 @@ class MidiSynthIInfo : public TrackInfo {
class MidiOutPortInfo : public TrackInfo {
Q_OBJECT
- QComboBox* instrument;
+ Ui::MidiPortInfoBase mp;
private slots:
void instrumentSelected(int);
void instrumentChanged();
+ void deviceIdChanged(int);
public:
MidiOutPortInfo();
diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp
index 0c89fe62..1265acc1 100644
--- a/muse/muse/conf.cpp
+++ b/muse/muse/conf.cpp
@@ -185,10 +185,6 @@ void readConfiguration(QDomNode node)
// config.transportHandleColor = readColor(node);
else if (tag == "freewheelMode")
config.useJackFreewheelMode = i;
- else if (tag == "txDeviceId")
- txDeviceId = i;
- else if (tag == "rxDeviceId")
- rxDeviceId = i;
else if (tag == "mtctype")
AL::mtcType = i;
else if (tag == "extSync")
@@ -402,8 +398,6 @@ void MusE::writeGlobalConfiguration(Xml& xml) const
xml.strTag("startProject", config.startProject);
xml.intTag("freewheelMode", config.useJackFreewheelMode);
- xml.intTag("txDeviceId", txDeviceId);
- xml.intTag("rxDeviceId", rxDeviceId);
xml.strTag("theme", config.style);
for (int i = 0; i < 6; ++i) {
@@ -504,9 +498,6 @@ void MusE::writeConfiguration(Xml& xml) const
{
xml.tag("configuration");
- xml.intTag("txDeviceId", txDeviceId);
- xml.intTag("rxDeviceId", rxDeviceId);
-
xml.intTag("mtctype", AL::mtcType);
xml.tag("mtcoffset");
xml.put("%02d:%02d:%02d:%02d:%02d",
diff --git a/muse/muse/midi.cpp b/muse/muse/midi.cpp
index eb94c04f..6a7c7d57 100644
--- a/muse/muse/midi.cpp
+++ b/muse/muse/midi.cpp
@@ -39,9 +39,32 @@
extern void dump(const unsigned char* p, int n);
-unsigned const char gmOnMsg[] = { 0x7e, 0x7f, 0x09, 0x01 };
-unsigned const char gsOnMsg[] = { 0x41, 0x10, 0x42, 0x12, 0x40, 0x00, 0x7f, 0x00, 0x41 };
-unsigned const char xgOnMsg[] = { 0x43, 0x10, 0x4c, 0x00, 0x00, 0x7e, 0x00 };
+unsigned const char gmOnMsg[] = {
+ 0x7e, // Non-Real Time header
+ 0x7f, // ID of target device (7f = all devices)
+ 0x09,
+ 0x01
+ };
+unsigned const char gsOnMsg[] = {
+ 0x41, // roland id
+ 0x10, // Id of target device (default = 10h for roland)
+ 0x42, // model id (42h = gs devices)
+ 0x12, // command id (12h = data set)
+ 0x40, // address & value
+ 0x00,
+ 0x7f,
+ 0x00,
+ 0x41 // checksum?
+ };
+unsigned const char xgOnMsg[] = {
+ 0x43, // yamaha id
+ 0x10, // device number
+ 0x4c, // model id
+ 0x00, // address (high, mid, low)
+ 0x00,
+ 0x7e,
+ 0x00 // data
+ };
unsigned const int gmOnMsgLen = sizeof(gmOnMsg);
unsigned const int gsOnMsgLen = sizeof(gsOnMsg);
unsigned const int xgOnMsgLen = sizeof(xgOnMsg);
diff --git a/muse/muse/midiport.cpp b/muse/muse/midiport.cpp
index 84c75101..b25e95aa 100644
--- a/muse/muse/midiport.cpp
+++ b/muse/muse/midiport.cpp
@@ -57,6 +57,7 @@ MidiOutPort::MidiOutPort()
alsaPort = 0;
_nextPlayEvent = _playEvents.end();
_sendSync = false;
+ _deviceId = 127; // all
addMidiController(_instrument, CTRL_MASTER_VOLUME);
}
@@ -112,6 +113,8 @@ void MidiOutPort::write(Xml& xml) const
if (!_channel[i]->noInRoute())
_channel[i]->write(xml);
}
+ xml.intTag("sendSync", _sendSync);
+ xml.intTag("deviceId", _deviceId);
xml.etag("MidiOutPort");
}
@@ -132,6 +135,10 @@ void MidiOutPort::read(QDomNode node)
QString iname = e.text();
_instrument = registerMidiInstrument(iname);
}
+ else if (tag == "sendSync")
+ _sendSync = e.text().toInt();
+ else if (tag == "deviceId")
+ _deviceId = e.text().toInt();
else if (MidiTrackBase::readProperties(node))
printf("MusE:MidiOutPort: unknown tag %s\n", tag.toLatin1().data());
}
@@ -218,6 +225,7 @@ void MidiOutPort::putEvent(const MidiEvent& ev)
unsigned char sysex[] = {
0x7f, 0x7f, 0x04, 0x01, 0x00, 0x00
};
+ sysex[1] = _deviceId;
sysex[4] = b & 0x7f;
sysex[5] = (b >> 7) & 0x7f;
MidiEvent e(ev.time(), ME_SYSEX, sysex, 6);
diff --git a/muse/muse/sync.cpp b/muse/muse/sync.cpp
index 5a4478bb..e0c1861b 100644
--- a/muse/muse/sync.cpp
+++ b/muse/muse/sync.cpp
@@ -32,9 +32,6 @@
int rxSyncPort = -1; // receive from all ports
int txSyncPort = 1;
-int rxDeviceId = 0x7f; // ´any´ device
-int txDeviceId = 0x7f; // ´any´ device
-
bool debugSync = false;
MTC mtcOffset;
bool extSyncFlag = false;
@@ -74,6 +71,8 @@ enum {
void MidiSeq::mmcInput(int id, int cmd, const Pos& pos)
{
+ int rxDeviceId = 127;
+
if (!extSyncFlag || !acceptMMC || (id != 127 && id != rxDeviceId))
return;
diff --git a/muse/muse/sync.h b/muse/muse/sync.h
index ed8c6b33..b87bae7c 100644
--- a/muse/muse/sync.h
+++ b/muse/muse/sync.h
@@ -25,8 +25,8 @@
extern bool debugSync;
-extern int rxDeviceId;
-extern int txDeviceId;
+// extern int rxDeviceId;
+// extern int txDeviceId;
extern MTC mtcOffset;
extern bool extSyncFlag;
diff --git a/muse/muse/track.h b/muse/muse/track.h
index e00a71de..c4146276 100644
--- a/muse/muse/track.h
+++ b/muse/muse/track.h
@@ -427,6 +427,7 @@ class MidiOutPort : public MidiTrackBase {
Port alsaPort;
bool _sendSync; // this port sends mtc mmc events
+ int _deviceId; // 0-126; 127 == all
MPEventList _playEvents; // scheduled events to play
iMPEvent _nextPlayEvent;
@@ -488,6 +489,9 @@ class MidiOutPort : public MidiTrackBase {
bool sendSync() const { return _sendSync; }
void setSendSync(bool val);
+
+ int deviceId() const { return _deviceId; }
+ void setDeviceId(int val) { _deviceId = val; }
};
//---------------------------------------------------------
diff --git a/muse/muse/widgets/midisync.cpp b/muse/muse/widgets/midisync.cpp
index 65e14a3c..7b6f69df 100644
--- a/muse/muse/widgets/midisync.cpp
+++ b/muse/muse/widgets/midisync.cpp
@@ -38,8 +38,8 @@ MidiSyncConfig::MidiSyncConfig(QWidget* parent)
connect(syncMaster, SIGNAL(toggled(bool)), SLOT(syncMasterChanged(bool)));
connect(syncSlave, SIGNAL(toggled(bool)), SLOT(syncSlaveChanged(bool)));
- dstDevId->setValue(txDeviceId);
- srcDevId->setValue(rxDeviceId);
+// dstDevId->setValue(txDeviceId);
+// srcDevId->setValue(rxDeviceId);
mtcSync->setChecked(genMTCSync);
mcSync->setChecked(genMCSync);
@@ -85,8 +85,8 @@ void MidiSyncConfig::cancel()
void MidiSyncConfig::apply()
{
- txDeviceId = dstDevId->value();
- rxDeviceId = srcDevId->value();
+// txDeviceId = dstDevId->value();
+// rxDeviceId = srcDevId->value();
genMTCSync = mtcSync->isChecked();
genMCSync = mcSync->isChecked();