summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-11-08 18:23:35 +0000
committerWerner Schweer <ws.seh.de>2006-11-08 18:23:35 +0000
commit9f7cb48d79c1fd9292c16c5fd3784a14aaa1000b (patch)
treef55820e4423d05cf40ecb5814ef6ac73b05a7380
parent1bd28c3efd22eb16aaaf979e2fdb0bafd364a7dc (diff)
big update
-rw-r--r--muse/ChangeLog3
-rw-r--r--muse/muse/CMakeLists.txt2
-rw-r--r--muse/muse/arranger/CMakeLists.txt1
-rw-r--r--muse/muse/arranger/arranger.cpp24
-rw-r--r--muse/muse/arranger/canvas.cpp4
-rw-r--r--muse/muse/arranger/midichannelinfo.ui56
-rw-r--r--muse/muse/arranger/miditrackinfo.ui132
-rw-r--r--muse/muse/arranger/tlswidget.cpp10
-rw-r--r--muse/muse/arranger/tlwidget.cpp16
-rw-r--r--muse/muse/arranger/trackinfo.cpp140
-rw-r--r--muse/muse/arranger/trackinfo.h49
-rw-r--r--muse/muse/audio.cpp5
-rw-r--r--muse/muse/audio.h12
-rw-r--r--muse/muse/audiotrack.cpp13
-rw-r--r--muse/muse/conf.cpp5
-rw-r--r--muse/muse/ctrl/configmidictrl.cpp24
-rw-r--r--muse/muse/ctrl/ctrldialog.cpp3
-rw-r--r--muse/muse/ctrl/ctrleditor.cpp15
-rw-r--r--muse/muse/ctrl/ctrleditor.h1
-rw-r--r--muse/muse/driver/alsamidi.cpp6
-rw-r--r--muse/muse/driver/jack.cpp2
-rw-r--r--muse/muse/exportmidi.cpp20
-rw-r--r--muse/muse/gconfig.cpp2
-rw-r--r--muse/muse/importmidi.cpp30
-rw-r--r--muse/muse/liste/CMakeLists.txt12
-rw-r--r--muse/muse/liste/ctrllistedit.cpp31
-rw-r--r--muse/muse/liste/ctrllistedit.h38
-rw-r--r--muse/muse/liste/editctrlbase.ui288
-rw-r--r--muse/muse/liste/editevent.cpp542
-rw-r--r--muse/muse/liste/editevent.h152
-rw-r--r--muse/muse/liste/editnotedialog.ui150
-rw-r--r--muse/muse/liste/listedit.cpp1376
-rw-r--r--muse/muse/liste/listedit.h223
-rw-r--r--muse/muse/midi.cpp33
-rw-r--r--muse/muse/midichannel.cpp181
-rw-r--r--muse/muse/midichannel.h78
-rw-r--r--muse/muse/midiedit/ctrledit.cpp31
-rw-r--r--muse/muse/midiedit/ctrledit.h2
-rw-r--r--muse/muse/midiedit/ecanvas.cpp4
-rw-r--r--muse/muse/midiedit/prcanvas.cpp10
-rw-r--r--muse/muse/midiinport.cpp5
-rw-r--r--muse/muse/midiout.cpp62
-rw-r--r--muse/muse/midiout.h2
-rw-r--r--muse/muse/midioutport.cpp39
-rw-r--r--muse/muse/midisynti.cpp7
-rw-r--r--muse/muse/miditrack.cpp221
-rw-r--r--muse/muse/miditrack.h49
-rw-r--r--muse/muse/mixer/astrip.cpp260
-rw-r--r--muse/muse/mixer/astrip.h4
-rw-r--r--muse/muse/mixer/mixer.cpp29
-rw-r--r--muse/muse/mixer/mixer.h1
-rw-r--r--muse/muse/mixer/mstrip.cpp748
-rw-r--r--muse/muse/mixer/mstrip.h49
-rw-r--r--muse/muse/muse.cpp32
-rw-r--r--muse/muse/muse.h12
-rw-r--r--muse/muse/preferences.cpp2
-rw-r--r--muse/muse/route.cpp171
-rw-r--r--muse/muse/route.h59
-rw-r--r--muse/muse/seqmsg.cpp97
-rw-r--r--muse/muse/song.cpp172
-rw-r--r--muse/muse/song.h5
-rw-r--r--muse/muse/songfile.cpp8
-rw-r--r--muse/muse/synth.cpp29
-rw-r--r--muse/muse/track.cpp140
-rw-r--r--muse/muse/track.h3
-rw-r--r--muse/muse/widgets/utils.cpp36
-rw-r--r--muse/muse/widgets/utils.h2
67 files changed, 1377 insertions, 4593 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index ec1564ee..e25be625 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,6 @@
+8.11 (ws)
+ - removed the suboptimal "MidiChannel" concept. MidiChannels are
+ now merged with MidiTracks.
5.11 (ws)
- simplified midi input routing
- added "Monitor" button to midi track mixer strip
diff --git a/muse/muse/CMakeLists.txt b/muse/muse/CMakeLists.txt
index 3d038136..db867b0e 100644
--- a/muse/muse/CMakeLists.txt
+++ b/muse/muse/CMakeLists.txt
@@ -74,7 +74,6 @@ QT4_WRAP_CPP ( muse_moc_headers
synth.h
exportmidi.h
importmidi.h
- midichannel.h
midiinport.h
midioutport.h
)
@@ -129,7 +128,6 @@ add_executable ( muse
midififo.cpp
midioutport.cpp
midiinport.cpp
- midichannel.cpp
midiout.cpp
projectpropsdialog.cpp
diff --git a/muse/muse/arranger/CMakeLists.txt b/muse/muse/arranger/CMakeLists.txt
index fbabb96c..812c26aa 100644
--- a/muse/muse/arranger/CMakeLists.txt
+++ b/muse/muse/arranger/CMakeLists.txt
@@ -32,7 +32,6 @@ QT4_WRAP_CPP ( arranger_mocs
QT4_WRAP_UI ( arranger_ui_headers
configtrack.ui
- midichannelinfo.ui
midiportinfo.ui
miditrackinfo.ui
)
diff --git a/muse/muse/arranger/arranger.cpp b/muse/muse/arranger/arranger.cpp
index 83b9bddc..8215028f 100644
--- a/muse/muse/arranger/arranger.cpp
+++ b/muse/muse/arranger/arranger.cpp
@@ -37,7 +37,6 @@
#include "midictrl.h"
#include "gconfig.h"
#include "part.h"
-#include "midichannel.h"
int Arranger::trackNameWidth = 80;
@@ -56,7 +55,7 @@ const TrElement trElements[] = {
| Track::M_WAVE
| Track::M_AUDIO_INPUT
| Track::M_AUDIO_SOFTSYNTH),
- TrElement(TR_DRUMMAP, 2, "use drum map", Track::M_MIDI_CHANNEL),
+ TrElement(TR_DRUMMAP, 2, "use drum map", Track::M_MIDI),
TrElement(TR_MUTE, 3, "mute", -1),
TrElement(TR_SOLO, 3, "solo", -1),
TrElement(TR_MONITOR, 3, "monitor",
@@ -67,7 +66,7 @@ const TrElement trElements[] = {
-1 & ~(Track::M_MIDI_IN | Track::M_MIDI)),
TrElement(TR_OCHANNEL, 5, "output channel", Track::M_MIDI),
TrElement(TR_INSTRUMENT, 6, "instrument", Track::M_MIDI_OUT),
- TrElement(TR_PATCH, 7, "patch", Track::M_MIDI_CHANNEL),
+ TrElement(TR_PATCH, 7, "patch", Track::M_MIDI),
};
const int nTrElements = sizeof(trElements)/sizeof(*trElements);
@@ -874,9 +873,6 @@ void Arranger::toggleMixerStrip(bool val)
case Track::MIDI_OUT:
strip = new MidiOutPortStrip(0, (MidiOutPort*)_curTrack, false);
break;
- case Track::MIDI_CHANNEL:
- strip = new MidiChannelStrip(0, (MidiChannel*)_curTrack, false);
- break;
case Track::MIDI_SYNTI:
strip = new MidiSyntiStrip(0, (MidiSynti*)_curTrack, false);
break;
@@ -1093,8 +1089,8 @@ void Arranger::setGar()
}
}
if (ar == false) {
- MidiChannelList* cl = song->midiChannel();
- for (iMidiChannel i = cl->begin(); i != cl->end(); ++i) {
+ MidiTrackList* cl = song->midis();
+ for (iMidiTrack i = cl->begin(); i != cl->end(); ++i) {
if ((*i)->autoRead()) {
ar = true;
break;
@@ -1117,8 +1113,8 @@ void Arranger::setGaw()
aw = true;
}
if (aw == false) {
- MidiChannelList* cl = song->midiChannel();
- for (iMidiChannel i = cl->begin(); i != cl->end(); ++i) {
+ MidiTrackList* cl = song->midis();
+ for (iMidiTrack i = cl->begin(); i != cl->end(); ++i) {
if ((*i)->autoWrite()) {
aw = true;
break;
@@ -1161,8 +1157,8 @@ void Arranger::offGar()
TrackList*tl = song->tracks();
for (iTrack i = tl->begin(); i != tl->end(); ++i)
song->setAutoRead(*i, false);
- MidiChannelList* cl = song->midiChannel();
- for (iMidiChannel i = cl->begin(); i != cl->end(); ++i)
+ MidiTrackList* cl = song->midis();
+ for (iMidiTrack i = cl->begin(); i != cl->end(); ++i)
song->setAutoRead(*i, false);
gar->setChecked(false);
}
@@ -1176,8 +1172,8 @@ void Arranger::offGaw()
TrackList*tl = song->tracks();
for (iTrack i = tl->begin(); i != tl->end(); ++i)
song->setAutoWrite(*i, false);
- MidiChannelList* cl = song->midiChannel();
- for (iMidiChannel i = cl->begin(); i != cl->end(); ++i)
+ MidiTrackList* cl = song->midis();
+ for (iMidiTrack i = cl->begin(); i != cl->end(); ++i)
song->setAutoWrite(*i, false);
gaw->setChecked(false);
}
diff --git a/muse/muse/arranger/canvas.cpp b/muse/muse/arranger/canvas.cpp
index de38f322..85e2305e 100644
--- a/muse/muse/arranger/canvas.cpp
+++ b/muse/muse/arranger/canvas.cpp
@@ -31,7 +31,6 @@
#include "tlswidget.h"
#include "part.h"
#include "gui.h"
-#include "midichannel.h"
#include <samplerate.h>
@@ -446,8 +445,7 @@ void PartCanvas::contextMenu(const QPoint& pos)
pop->addSeparator();
if (track->type() == Track::MIDI) {
MidiTrack* track = (MidiTrack*)part->track();
- MidiChannel* mc = track->channel();
- if (mc && mc->useDrumMap()) {
+ if (track->useDrumMap()) {
a = pop->addAction(*edit_drummsIcon, tr("drums"));
a->setData(13);
}
diff --git a/muse/muse/arranger/midichannelinfo.ui b/muse/muse/arranger/midichannelinfo.ui
deleted file mode 100644
index 85fb5e9f..00000000
--- a/muse/muse/arranger/midichannelinfo.ui
+++ /dev/null
@@ -1,56 +0,0 @@
-<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/miditrackinfo.ui b/muse/muse/arranger/miditrackinfo.ui
index cd143b28..796c7494 100644
--- a/muse/muse/arranger/miditrackinfo.ui
+++ b/muse/muse/arranger/miditrackinfo.ui
@@ -1,15 +1,12 @@
<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>
+ <width>135</width>
+ <height>165</height>
</rect>
</property>
<property name="sizePolicy" >
@@ -25,13 +22,13 @@
</property>
<layout class="QGridLayout" >
<property name="margin" >
- <number>6</number>
+ <number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_5" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
@@ -41,22 +38,20 @@
</sizepolicy>
</property>
<property name="text" >
- <string>Compr.</string>
+ <string>Transp.</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>
+ <item row="0" column="1" >
+ <widget class="QSpinBox" name="transposition" >
+ <property name="toolTip" >
+ <string>Pitch Transpose</string>
</property>
- <property name="text" >
- <string>Transp.</string>
+ <property name="maximum" >
+ <number>127</number>
+ </property>
+ <property name="minimum" >
+ <number>-127</number>
</property>
</widget>
</item>
@@ -75,6 +70,19 @@
</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="0" >
<widget class="QLabel" name="label_3" >
<property name="sizePolicy" >
@@ -90,6 +98,22 @@
</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="0" >
<widget class="QLabel" name="label_4" >
<property name="sizePolicy" >
@@ -105,10 +129,10 @@
</property>
</widget>
</item>
- <item row="0" column="1" >
- <widget class="QSpinBox" name="transposition" >
+ <item row="3" column="1" >
+ <widget class="QSpinBox" name="velocity" >
<property name="toolTip" >
- <string>Pitch Transpose</string>
+ <string>Modify Note Velocity</string>
</property>
<property name="maximum" >
<number>127</number>
@@ -118,23 +142,25 @@
</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>
+ <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="minimum" >
- <number>-1000</number>
+ <property name="text" >
+ <string>Compr.</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QSpinBox" name="length" >
+ <item row="4" column="1" >
+ <widget class="QSpinBox" name="compression" >
<property name="toolTip" >
- <string>Modify Note Length</string>
+ <string>Compress Note Velocity</string>
</property>
<property name="suffix" >
<string>%</string>
@@ -147,38 +173,26 @@
</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>
+ <item row="5" column="0" colspan="2" >
+ <widget class="QPushButton" name="patch" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</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>
+ <string>Instrument Patch</string>
</property>
- <property name="minimum" >
- <number>25</number>
+ <property name="text" >
+ <string>???</string>
</property>
</widget>
</item>
</layout>
</widget>
- <pixmapfunction></pixmapfunction>
<resources/>
<connections/>
</ui>
diff --git a/muse/muse/arranger/tlswidget.cpp b/muse/muse/arranger/tlswidget.cpp
index cd78b1a8..d3749da4 100644
--- a/muse/muse/arranger/tlswidget.cpp
+++ b/muse/muse/arranger/tlswidget.cpp
@@ -20,7 +20,6 @@
#include "song.h"
#include "track.h"
-#include "midichannel.h"
#include "tlswidget.h"
#include "tlwlayout.h"
#include "icons.h"
@@ -243,14 +242,7 @@ bool TLSWidget::setCtrl(int ctrl)
else {
at->ctrl = ctrl;
at->controller = _track->getController(ctrl);
- if (at->controller == 0 && _track->type() == Track::MIDI) {
- MidiChannel* mc = ((MidiTrack*)_track)->channel();
- at->controller = mc->getController(ctrl);
- _ctrlTrack = mc;
- connect(_ctrlTrack, SIGNAL(controllerChanged(int)), SLOT(controllerListChanged(int)));
- }
- else
- _ctrlTrack = _track;
+ _ctrlTrack = _track;
ctrlList->setText(at->controller->name());
emit controllerChanged(ctrl);
}
diff --git a/muse/muse/arranger/tlwidget.cpp b/muse/muse/arranger/tlwidget.cpp
index 84f1044e..93da0906 100644
--- a/muse/muse/arranger/tlwidget.cpp
+++ b/muse/muse/arranger/tlwidget.cpp
@@ -35,7 +35,6 @@
#include "widgets/outportcombo.h"
#include "audio.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "instruments/minstrument.h"
//---------------------------------------------------------
@@ -330,11 +329,10 @@ void TLWidget::configChanged()
case TR_DRUMMAP:
{
SimpleButton* dm = newDrumMapButton();
- MidiChannel* mt = (MidiChannel*)_track;
dm->setFixedSize(trackRowHeight, trackRowHeight);
- dm->setChecked(mt->useDrumMap());
+ dm->setChecked(((MidiTrack*)_track)->useDrumMap());
connect(dm, SIGNAL(clicked(bool)), SLOT(drumMapToggled(bool)));
- connect(mt, SIGNAL(useDrumMapChanged(bool)), dm, SLOT(setChecked(bool)));
+ connect(_track, SIGNAL(useDrumMapChanged(bool)), dm, SLOT(setChecked(bool)));
l->addWidget(dm);
wlist.push_back(dm);
}
@@ -418,9 +416,9 @@ void TLWidget::configChanged()
outChannel = new QSpinBox(this);
outChannel->setFixedSize(45, trackRowHeight);
outChannel->setRange(1, 16);
- MidiChannel* midiChannel = ((MidiTrack*)_track)->channel();
- if (midiChannel)
- outChannel->setValue(midiChannel->channelNo()+1);
+//TODOA MidiChannel* midiChannel = ((MidiTrack*)_track)->channel();
+// if (midiChannel)
+// outChannel->setValue(midiChannel->channelNo()+1);
outChannel->setToolTip(tr("Midi Output Channel"));
l->addWidget(outChannel);
wlist.push_back(outChannel);
@@ -473,7 +471,7 @@ void TLWidget::monitorToggled(bool val)
void TLWidget::drumMapToggled(bool val)
{
- ((MidiChannel*)_track)->setUseDrumMap(val);
+ ((MidiTrack*)_track)->setUseDrumMap(val);
}
//---------------------------------------------------------
@@ -527,6 +525,7 @@ void TLWidget::setOutPort(int n)
void TLWidget::outChannelChanged(int n)
{
+#if 0 //TODOA
n -= 1;
MidiChannel* mc = ((MidiTrack*)_track)->channel();
if (mc == 0) // no route to port?
@@ -538,6 +537,7 @@ void TLWidget::outChannelChanged(int n)
audio->msgRemoveRoute(Route(_track), Route(mc));
audio->msgAddRoute(Route(_track), Route(mp->channel(n)));
song->update(SC_ROUTE);
+#endif
}
//---------------------------------------------------------
diff --git a/muse/muse/arranger/trackinfo.cpp b/muse/muse/arranger/trackinfo.cpp
index b930a491..1930423b 100644
--- a/muse/muse/arranger/trackinfo.cpp
+++ b/muse/muse/arranger/trackinfo.cpp
@@ -31,7 +31,6 @@
#include "gui.h"
#include "midioutport.h"
#include "midiinport.h"
-#include "midichannel.h"
//---------------------------------------------------------
// createTrackInfo
@@ -49,7 +48,6 @@ TrackInfo* Arranger::createTrackInfo()
case Track::AUDIO_SOFTSYNTH: return new SynthIInfo();
case Track::MIDI_OUT: return new MidiOutPortInfo();
case Track::MIDI_IN: return new MidiInPortInfo();
- case Track::MIDI_CHANNEL: return new MidiChannelInfo();
case Track::MIDI_SYNTI: return new MidiSynthIInfo();
default:
printf("Arranger::createTrackInfo: type %d\n", t);
@@ -129,8 +127,8 @@ MidiTrackInfo::MidiTrackInfo()
QWidget* midiTrackInfo = new QWidget;
mt.setupUi(midiTrackInfo);
- QWidget* midiChannelInfo = new QWidget;
- mc.setupUi(midiChannelInfo);
+// QWidget* midiChannelInfo = new QWidget;
+// mc.setupUi(midiChannelInfo);
QWidget* midiPortInfo = new QWidget;
mp.setupUi(midiPortInfo);
@@ -145,7 +143,7 @@ MidiTrackInfo::MidiTrackInfo()
channel = new QComboBox;
grid->addWidget(channel, 4, 0, 1, 2);
- grid->addWidget(midiChannelInfo, 5, 0, 1, 2);
+// grid->addWidget(midiChannelInfo, 5, 0, 1, 2);
label = new QLabel;
label->setText(tr("Midi Port"));
@@ -157,14 +155,14 @@ MidiTrackInfo::MidiTrackInfo()
grid->addWidget(port, 7, 0, 1, 2);
grid->addWidget(midiPortInfo, 8, 0, 1, 2);
- pop = new QMenu(mc.patch);
+ pop = new QMenu(mt.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(mt.patch, SIGNAL(clicked()), SLOT(patchClicked()));
connect(channel, SIGNAL(activated(int)), SLOT(channelSelected(int)));
connect(port, SIGNAL(activated(int)), SLOT(portSelected(int)));
connect(mp.instrument, SIGNAL(activated(int)), SLOT(instrumentSelected(int)));
@@ -181,62 +179,61 @@ MidiTrackInfo::MidiTrackInfo()
void MidiTrackInfo::init(Track* t)
{
TrackInfo::init(t);
- 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);
+ 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;
channel->clear();
channel->addItem("---", -1);
port->clear();
port->addItem("---", -1);
+ int portIndex = 1;
+ MidiTrack* midiTrack = (MidiTrack*)track;
+
MidiOutPortList* opl = song->midiOutPorts();
- int k = 0;
- for (iMidiOutPort i = opl->begin(); i != opl->end(); ++i, ++k) {
- port->addItem((*i)->name(), k);
- if (midic && midic->port() == *i)
- portIndex = k + 1;
+
+ MidiOut* mo = midiTrack->midiOut();
+ for (iMidiOutPort i = opl->begin(); i != opl->end(); ++i, ++portIndex) {
+ port->addItem((*i)->name());
+ if (mo == (*i))
+ port->setCurrentIndex(portIndex);
}
- if (midic) {
- MidiOut* op = midic->port();
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- MidiChannel* c = op->channel(i);
- if (midic == c)
- channelIndex = i + 1;
- channel->addItem(c->name(), i);
- }
- connect(midic, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
-//TODO connect(op, SIGNAL(instrumentChanged()), SLOT(instrumentChanged()));
- channel->setCurrentIndex(channelIndex);
- port->setCurrentIndex(portIndex);
- MidiInstrument* mi = op->instrument();
- int idx = 0;
- int curIdx = 0;
- for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
- mp.instrument->addItem((*i)->iname());
- if ((*i)->iname() == mi->iname())
- curIdx = idx;
- }
- mp.instrument->setCurrentIndex(curIdx);
-//TODO mp.deviceId->setValue(op->deviceId());
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
+ channel->addItem(QString("Channel %1").arg(ch+1), ch);
+ int n = midiTrack->channelNo();
+ channel->setCurrentIndex(n < 0 ? 0 : n + 1);
+
+// connect(midic, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
+//TODO connect(op, SIGNAL(instrumentChanged()), SLOT(instrumentChanged()));
+
+ MidiInstrument* mi = midiTrack->instrument();
+ int idx = 0;
+ int curIdx = 0;
+ for (iMidiInstrument i = midiInstruments.begin(); i != midiInstruments.end(); ++i, ++idx) {
+ mp.instrument->addItem((*i)->iname());
+ if (mi && ((*i)->iname() == mi->iname()))
+ curIdx = idx;
+ }
+ mp.instrument->setCurrentIndex(curIdx);
+ mp.deviceId->setValue(midiTrack->deviceId());
+#if 0
autoChanged(midic, false); // update enable
int val = midic->ctrlVal(CTRL_PROGRAM).i;
int channelno = midic->channelNo();
- mc.patch->setText(mi->getPatchName(channelno, val));
+ mt.patch->setText(mi->getPatchName(channelno, val));
}
else {
channel->setCurrentIndex(0);
port->setCurrentIndex(0);
mp.instrument->addItem("--");
mp.instrument->setCurrentIndex(0);
- mc.patch->setText("--");
+ mt.patch->setText("--");
}
+#endif
}
//---------------------------------------------------------
@@ -248,7 +245,7 @@ void MidiTrackInfo::portSelected(int portno)
if (portno == 0)
return;
--portno;
-
+#if 0 //TODOA
Route srcRoute(track);
MidiChannel* midic = ((MidiTrack*)track)->channel();
if (midic) {
@@ -264,6 +261,7 @@ void MidiTrackInfo::portSelected(int portno)
audio->msgAddRoute(srcRoute, dstRoute);
song->update(SC_ROUTE);
+#endif
}
//---------------------------------------------------------
@@ -275,12 +273,13 @@ void MidiTrackInfo::channelSelected(int ch)
if (ch == 0)
return;
--ch;
+#if 0 //TODOA
Route srcRoute(track);
- MidiChannel* midic = ((MidiTrack*)track)->channel();
- MidiOut* midip = midic->port();
- if (midic) {
- Route odstRoute(midic);
- audio->msgRemoveRoute(srcRoute, odstRoute);
+ MidiOut* midip = ((MidiTrack*)track)->midiOut();
+ MidiOutPort* midi =
+ if (midi) {
+ Route dstRoute(midic);
+ audio->msgRemoveRoute(srcRoute, dstRoute);
}
midic = midip->channel(ch);
@@ -288,6 +287,7 @@ void MidiTrackInfo::channelSelected(int ch)
audio->msgAddRoute(srcRoute, dstRoute);
song->update(SC_ROUTE);
+#endif
}
//---------------------------------------------------------
@@ -297,13 +297,14 @@ void MidiTrackInfo::channelSelected(int ch)
void MidiTrackInfo::controllerChanged(int id)
{
if (id == CTRL_PROGRAM) {
- MidiChannel* midic = ((MidiTrack*)track)->channel();
- if (midic) {
- MidiOut* op = midic->port();
+#if 0 //TODOA
+ MidiOut* op = ((MidiTrack*)track)->midiOut();
+ if (op) {
MidiInstrument* mi = op->instrument();
int val = midic->ctrlVal(id).i;
- mc.patch->setText(mi->getPatchName(midic->channelNo(), val));
+ mt.patch->setText(mi->getPatchName(midic->channelNo(), val));
}
+#endif
}
}
@@ -313,6 +314,7 @@ void MidiTrackInfo::controllerChanged(int id)
void MidiTrackInfo::instrumentChanged()
{
+#if 0 //TODOA
MidiChannel* midic = ((MidiTrack*)track)->channel();
if (midic) {
MidiOut* op = midic->port();
@@ -329,6 +331,7 @@ void MidiTrackInfo::instrumentChanged()
mp.instrument->clear();
mp.instrument->setCurrentIndex(0);
}
+#endif
}
//---------------------------------------------------------
@@ -337,13 +340,13 @@ void MidiTrackInfo::instrumentChanged()
void MidiTrackInfo::autoChanged(Track* t, bool)
{
- MidiChannel* midic = ((MidiTrack*)track)->channel();
- if (midic != t)
- return;
+// MidiChannel* midic = ((MidiTrack*)track)->channel();
+// if (midic != t)
+// return;
bool ar = t->autoRead();
bool aw = t->autoWrite();
bool en = !ar || (ar && aw);
- mc.patch->setEnabled(en);
+ mt.patch->setEnabled(en);
}
//---------------------------------------------------------
@@ -352,7 +355,7 @@ void MidiTrackInfo::autoChanged(Track* t, bool)
void MidiTrackInfo::transpositionChanged(int val)
{
- ((MidiTrack*)track)->transposition = val;
+ ((MidiTrack*)track)->setTransposition(val);
}
//---------------------------------------------------------
@@ -361,6 +364,7 @@ void MidiTrackInfo::transpositionChanged(int val)
void MidiTrackInfo::patchClicked()
{
+#if 0 //TODOA
MidiChannel* midic = ((MidiTrack*)track)->channel();
if (!midic)
return;
@@ -369,13 +373,13 @@ void MidiTrackInfo::patchClicked()
MidiInstrument* mi = op->instrument();
mi->populatePatchPopup(pop, 0);
- QAction* rv = pop->exec(mc.patch->mapToGlobal(QPoint(10,5)));
+ QAction* rv = pop->exec(mt.patch->mapToGlobal(QPoint(10,5)));
if (rv != 0) {
CVal cval;
cval.i = rv->data().toInt();
-printf("set program %06x\n", cval.i);
song->setControllerVal(midic, CTRL_PROGRAM, cval);
}
+#endif
}
//---------------------------------------------------------
@@ -384,11 +388,13 @@ printf("set program %06x\n", cval.i);
void MidiTrackInfo::instrumentSelected(int n)
{
+#if 0 //TODOA
MidiChannel* midic = ((MidiTrack*)track)->channel();
if (midic == 0)
return;
MidiOut* op = midic->port();
op->setInstrument(midiInstruments[n]);
+#endif
}
//---------------------------------------------------------
@@ -397,7 +403,7 @@ void MidiTrackInfo::instrumentSelected(int n)
void MidiTrackInfo::velocityChanged(int val)
{
- ((MidiTrack*)track)->velocity = val;
+ ((MidiTrack*)track)->setVelocity(val);
}
//---------------------------------------------------------
@@ -406,7 +412,7 @@ void MidiTrackInfo::velocityChanged(int val)
void MidiTrackInfo::delayChanged(int val)
{
- ((MidiTrack*)track)->delay = val;
+ ((MidiTrack*)track)->setDelay(val);
}
//---------------------------------------------------------
@@ -415,7 +421,7 @@ void MidiTrackInfo::delayChanged(int val)
void MidiTrackInfo::lenChanged(int val)
{
- ((MidiTrack*)track)->len = val;
+ ((MidiTrack*)track)->setLen(val);
}
//---------------------------------------------------------
@@ -424,7 +430,7 @@ void MidiTrackInfo::lenChanged(int val)
void MidiTrackInfo::iKomprChanged(int val)
{
- ((MidiTrack*)track)->compression = val;
+ ((MidiTrack*)track)->setCompression(val);
}
//---------------------------------------------------------
@@ -433,11 +439,13 @@ void MidiTrackInfo::iKomprChanged(int val)
void MidiTrackInfo::deviceIdChanged(int /*val*/)
{
+#if 0 //TODOA
MidiChannel* midic = ((MidiTrack*)track)->channel();
if (midic == 0)
return;
// MidiOut* op = midic->port();
//TODO op->setDeviceId(val);
+#endif
}
//---------------------------------------------------------
@@ -602,6 +610,7 @@ MidiInPortInfo::MidiInPortInfo()
grid->setRowStretch(grid->rowCount(), 100);
}
+#if 0
//---------------------------------------------------------
// MidiChannelInfo
//---------------------------------------------------------
@@ -728,3 +737,4 @@ void MidiChannelInfo::controllerChanged(int id)
patch->setText(mi->getPatchName(midic->channelNo(), val));
}
}
+#endif
diff --git a/muse/muse/arranger/trackinfo.h b/muse/muse/arranger/trackinfo.h
index 8ef253a8..2b72e584 100644
--- a/muse/muse/arranger/trackinfo.h
+++ b/muse/muse/arranger/trackinfo.h
@@ -69,7 +69,6 @@ class MidiTrackInfo : public TrackInfo {
Q_OBJECT
Ui::MidiTrackInfoBase mt;
- Ui::MidiChannelInfoBase mc;
Ui::MidiPortInfoBase mp;
QComboBox* port;
QComboBox* channel;
@@ -94,6 +93,31 @@ class MidiTrackInfo : public TrackInfo {
MidiTrackInfo();
virtual void init(Track*);
};
+#if 0
+//---------------------------------------------------------
+// MidiChannelInfo
+//---------------------------------------------------------
+
+class MidiChannelInfo : public TrackInfo {
+ Q_OBJECT
+
+ TLLineEdit* portName;
+ QComboBox* instrument;
+ QPushButton* patch;
+ QMenu* pop;
+
+ private slots:
+ void instrumentSelected(int);
+ void instrumentChanged();
+ void controllerChanged(int);
+ void patchClicked();
+
+ public:
+ MidiChannelInfo();
+ virtual void init(Track*);
+ };
+#endif
+
//---------------------------------------------------------
// AudioOutputInfo
@@ -202,28 +226,5 @@ class MidiInPortInfo : public TrackInfo {
MidiInPortInfo();
};
-//---------------------------------------------------------
-// MidiChannelInfo
-//---------------------------------------------------------
-
-class MidiChannelInfo : public TrackInfo {
- Q_OBJECT
-
- TLLineEdit* portName;
- QComboBox* instrument;
- QPushButton* patch;
- QMenu* pop;
-
- private slots:
- void instrumentSelected(int);
- void instrumentChanged();
- void controllerChanged(int);
- void patchClicked();
-
- public:
- MidiChannelInfo();
- virtual void init(Track*);
- };
-
#endif
diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp
index 8674d287..ee98f85f 100644
--- a/muse/muse/audio.cpp
+++ b/muse/muse/audio.cpp
@@ -38,7 +38,6 @@
#include "synth.h"
#include "midioutport.h"
#include "midiinport.h"
-#include "midichannel.h"
#include "midictrl.h"
#include "sync.h"
@@ -538,10 +537,10 @@ void Audio::processMsg()
// printf("---msg %d\n", msg->id);
switch(msg->id) {
case AUDIO_ROUTEADD:
- addRoute(msg->sroute, msg->droute);
+ addRoute(msg->route);
break;
case AUDIO_ROUTEREMOVE:
- removeRoute(msg->sroute, msg->droute);
+ removeRoute(msg->route);
break;
case AUDIO_SET_CHANNELS:
msg->track->setChannels(msg->ival);
diff --git a/muse/muse/audio.h b/muse/muse/audio.h
index 836c9321..11f30d5e 100644
--- a/muse/muse/audio.h
+++ b/muse/muse/audio.h
@@ -119,7 +119,7 @@ extern const char* seqMsgList[]; // for debug
struct AudioMsg : public ThreadMsg { // this should be an union
int serialNo;
SndFile* downmix;
- Route sroute, droute;
+ Route route;
int ival;
int iival;
CVal cval1, cval2;
@@ -230,11 +230,11 @@ class Audio {
void msgPanic();
void sendMsg(AudioMsg*);
bool sendMessage(AudioMsg* m, bool doUndo);
- void msgRoute(bool add, Route, Route);
- void msgRemoveRoute(Route, Route);
- void msgRemoveRoute1(Route, Route);
- void msgAddRoute(Route, Route);
- void msgAddRoute1(Route, Route);
+ void msgRoute(bool add, Route);
+ void msgRemoveRoute(Route);
+ void msgRemoveRoute1(Route);
+ void msgAddRoute(Route);
+ void msgAddRoute1(Route);
void msgAddPlugin(AudioTrack*, int idx, PluginI* plugin, bool prefader);
void msgAddMidiPlugin(MidiTrackBase*, int idx, MidiPluginI* plugin);
void msgSetMute(AudioTrack*, bool val);
diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp
index b1a72db3..36efd4b3 100644
--- a/muse/muse/audiotrack.cpp
+++ b/muse/muse/audiotrack.cpp
@@ -569,21 +569,20 @@ bool AudioTrack::copy(int srcChannels, float** srcBuffer)
void AudioTrack::collectInputData()
{
bufferEmpty = false;
- RouteList* rl = inRoutes();
bool copyFlag = true;
- for (iRoute ir = rl->begin(); ir != rl->end(); ++ir) {
+ foreach (const Route& r, _inRoutes) {
float** ptr;
int ch;
- if (ir->type == Route::TRACK) {
- AudioTrack* track = (AudioTrack*)ir->track;
+ if (r.src.type == RouteNode::TRACK) {
+ AudioTrack* track = (AudioTrack*)r.src.track;
if (track->off() || song->bounceTrack == track)
continue;
ptr = track->buffer;
ch = track->channels();
}
- else if (ir->type == Route::AUXPLUGIN) {
- ch = ir->plugin->channel();
- ptr = ir->plugin->buffer();
+ else if (r.src.type == RouteNode::AUXPLUGIN) {
+ ch = r.src.plugin->channel();
+ ptr = r.src.plugin->buffer();
}
else
printf("AudioTrack::collectInputRoutes(): bad route type\n");
diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp
index 315f163f..a6bf9a84 100644
--- a/muse/muse/conf.cpp
+++ b/muse/muse/conf.cpp
@@ -126,8 +126,8 @@ void readConfiguration(QDomNode node)
config.trackBg[Track::MIDI_OUT] = readColor(node);
else if (tag == "midiInputBg")
config.trackBg[Track::MIDI_IN] = readColor(node);
- else if (tag == "midiChannelBg")
- config.trackBg[Track::MIDI_CHANNEL] = readColor(node);
+// else if (tag == "midiChannelBg")
+// config.trackBg[Track::MIDI_CHANNEL] = readColor(node);
else if (tag == "midiSyntiBg")
config.trackBg[Track::MIDI_SYNTI] = readColor(node);
else if (tag == "extendedMidi")
@@ -425,7 +425,6 @@ void MusE::writeGlobalConfiguration(Xml& xml) const
"midiTrackBg",
"midiOutputBg",
"midiInputBg",
- "midiChannelBg",
"midiSyntiBg"
};
for (int i = 0; i < Track::TRACK_TYPES; ++i)
diff --git a/muse/muse/ctrl/configmidictrl.cpp b/muse/muse/ctrl/configmidictrl.cpp
index 9e01e029..c2436e12 100644
--- a/muse/muse/ctrl/configmidictrl.cpp
+++ b/muse/muse/ctrl/configmidictrl.cpp
@@ -21,7 +21,6 @@
#include "configmidictrl.h"
#include "miditrack.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "midictrl.h"
#include "midiout.h"
#include "instruments/minstrument.h"
@@ -47,14 +46,10 @@ ConfigMidiCtrl::ConfigMidiCtrl(MidiTrack* t)
// populate list of available controllers
//---------------------------------------------------
- MidiChannel* mc = 0;
- if (track->type() == Track::MIDI)
- mc = track->channel();
- else if (track->type() == Track::MIDI_CHANNEL)
- mc = (MidiChannel*)track;
- if (mc) {
- MidiOut* mp = mc->port();
- portName->setText(mp->track->name());
+ if (track->type() == Track::MIDI) {
+#if 0
+ MidiTrack* mc = (MidiTrack*)track;
+ portName->setText(track->name());
//
// populate popup with all controllers available for
// current instrument
@@ -69,7 +64,9 @@ ConfigMidiCtrl::ConfigMidiCtrl(MidiTrack* t)
if (i == cn->end())
availableController->addItem((*ci)->name());
}
+#endif
}
+
delete cn;
buttonAdd->setEnabled(false);
buttonRemove->setEnabled(false);
@@ -141,14 +138,10 @@ void ConfigMidiCtrl::done(int code)
QDialog::done(code);
return;
}
-
- MidiChannel* mc = 0;
+#if 0 //TODOA
if (track->type() == Track::MIDI)
- mc = track->channel();
- else if (track->type() == Track::MIDI_CHANNEL)
- mc = (MidiChannel*)track;
+ MidiTrack* mc = (MidiTrack*)track;
- if (mc) {
MidiOut* port = mc->port();
ControllerNameList* cn = track->controllerNames();
MidiInstrument* instr = port->instrument();
@@ -192,6 +185,7 @@ void ConfigMidiCtrl::done(int code)
}
delete cn;
}
+#endif
QDialog::done(code);
}
diff --git a/muse/muse/ctrl/ctrldialog.cpp b/muse/muse/ctrl/ctrldialog.cpp
index c9b4e7a7..a9715c83 100644
--- a/muse/muse/ctrl/ctrldialog.cpp
+++ b/muse/muse/ctrl/ctrldialog.cpp
@@ -22,7 +22,6 @@
#include "midictrl.h"
#include "track.h"
#include "miditrack.h"
-#include "midichannel.h"
#include "audiotrack.h"
#include "plugin.h"
#include "pipeline.h"
@@ -151,6 +150,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent)
//
// add midi channel controller
//
+#if 0 //TODOA
MidiChannel* mc = ((MidiTrack*)track)->channel();
if (mc) {
ci = new QTreeWidgetItem(tw, CTRL_NO_CTRL);
@@ -170,6 +170,7 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent)
}
}
}
+#endif
}
ci = new QTreeWidgetItem(tw, CTRL_OTHER);
ci->setText(0, tr("other"));
diff --git a/muse/muse/ctrl/ctrleditor.cpp b/muse/muse/ctrl/ctrleditor.cpp
index 6698e96e..32f3280b 100644
--- a/muse/muse/ctrl/ctrleditor.cpp
+++ b/muse/muse/ctrl/ctrleditor.cpp
@@ -87,7 +87,7 @@ void CtrlEditor::paint(QPainter& p, const QRect& r)
p.save();
p.setRenderHint(QPainter::Antialiasing, true);
- bool aR = ctrlTrack()->autoRead();
+ bool aR = track()->autoRead();
p.setPen(QPen(aR ? Qt::white : Qt::gray, 2));
TType tt = track()->timeType();
@@ -230,8 +230,9 @@ void CtrlEditor::mousePress(const QPoint& pos, int button, Qt::KeyboardModifiers
a = pop.exec(tc()->mapToGlobal(pos));
if (a) {
int n = a->data().toInt();
- if (n == (1 << (TOOLS+1))) {
- printf("TODO: start list editor\n");
+ if (n == (1 << (TOOLS+1))) {
+ Pos t(tc()->pix2pos(pos.x()));
+ muse->showListEditor(t, track(), ctrl());
}
else
muse->setTool(n);
@@ -256,7 +257,7 @@ void CtrlEditor::mousePress(const QPoint& pos, int button, Qt::KeyboardModifiers
else {
// add controller:
CVal val = ctrl()->pixel2val(dragy, wh);
- song->addControllerVal(ctrlTrack(), ctrl(), selected, val);
+ song->addControllerVal(track(), ctrl(), selected, val);
tc()->widget()->update();
}
}
@@ -284,7 +285,7 @@ void CtrlEditor::mousePress(const QPoint& pos, int button, Qt::KeyboardModifiers
lselected = tc()->pos2pix(selected);
if (tool == RubberTool || button == Qt::RightButton
|| modifiers & Qt::ControlModifier) {
- song->removeControllerVal(ctrlTrack(), ctrl()->id(), i.key());
+ song->removeControllerVal(track(), ctrl()->id(), i.key());
dragy = -1;
}
else {
@@ -373,7 +374,7 @@ void CtrlEditor::mouseRelease()
int wh = cheight();
CVal val = ctrl()->pixel2val(dragy, wh);
// modify controller:
- song->addControllerVal(ctrlTrack(), ctrl(), selected, val);
+ song->addControllerVal(track(), ctrl(), selected, val);
}
dragy = -1;
}
@@ -460,7 +461,7 @@ void CtrlEditor::mouseMove(const QPoint& pos)
else
selected.setFrame(i.key());
lselected = tc()->pos2pix(selected);
- song->removeControllerVal(ctrlTrack(), ctrl()->id(), i.key());
+ song->removeControllerVal(track(), ctrl()->id(), i.key());
dragy = -1;
break;
}
diff --git a/muse/muse/ctrl/ctrleditor.h b/muse/muse/ctrl/ctrleditor.h
index c1406436..1779631d 100644
--- a/muse/muse/ctrl/ctrleditor.h
+++ b/muse/muse/ctrl/ctrleditor.h
@@ -49,7 +49,6 @@ class CtrlEditor {
virtual TimeCanvas* tc() const = 0;
virtual int cheight() const = 0;
virtual Track* track() const = 0;
- virtual Track* ctrlTrack() const = 0;
bool searchHandle(unsigned* time) const;
diff --git a/muse/muse/driver/alsamidi.cpp b/muse/muse/driver/alsamidi.cpp
index dc030d87..ae2ef5ea 100644
--- a/muse/muse/driver/alsamidi.cpp
+++ b/muse/muse/driver/alsamidi.cpp
@@ -334,6 +334,7 @@ void AlsaMidi::getOutputPollFd(struct pollfd** p, int* n)
void AlsaMidi::addConnection(snd_seq_connect_t* ev)
{
+#if 0 //TODOA
Port rs(ev->sender.client, ev->sender.port);
Port rd(ev->dest.client, ev->dest.port);
@@ -343,7 +344,7 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)
Port src = oport->alsaPort(0);
if (src == rs) {
- Route r(rd, Route::MIDIPORT);
+ RouteNode r(rd, Route::MIDIPORT);
if (oport->outRoutes()->indexOf(r) == -1) {
Port port(ev->dest.client, ev->dest.port);
oport->outRoutes()->push_back(Route(port, -1, Route::MIDIPORT));
@@ -366,6 +367,7 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)
break;
}
}
+#endif
}
//---------------------------------------------------------
@@ -375,6 +377,7 @@ void AlsaMidi::addConnection(snd_seq_connect_t* ev)
void AlsaMidi::removeConnection(snd_seq_connect_t* ev)
{
+#if 0 //TODOA
Port rs(ev->sender.client, ev->sender.port);
Port rd(ev->dest.client, ev->dest.port);
@@ -411,6 +414,7 @@ void AlsaMidi::removeConnection(snd_seq_connect_t* ev)
break;
}
}
+#endif
}
//---------------------------------------------------------
diff --git a/muse/muse/driver/jack.cpp b/muse/muse/driver/jack.cpp
index 4fb29676..24525d1c 100644
--- a/muse/muse/driver/jack.cpp
+++ b/muse/muse/driver/jack.cpp
@@ -311,6 +311,7 @@ struct RouteRoute {
void JackAudio::graphChanged()
{
+#if 0 //TODOA
QList<RouteRoute> rr;
QList<RouteRoute> ra;
@@ -461,6 +462,7 @@ void JackAudio::graphChanged()
audio->msgRemoveRoute1(a.src, a.dst);
foreach(RouteRoute a, ra)
audio->msgAddRoute1(a.src, a.dst);
+#endif
}
//static int xrun_callback(void*)
diff --git a/muse/muse/exportmidi.cpp b/muse/muse/exportmidi.cpp
index b6bd2a62..6f071b9d 100644
--- a/muse/muse/exportmidi.cpp
+++ b/muse/muse/exportmidi.cpp
@@ -34,7 +34,6 @@
#include "al/marker.h"
#include "part.h"
#include "exportmidi.h"
-#include "midichannel.h"
//---------------------------------------------------------
// addController
@@ -149,8 +148,7 @@ void MusE::exportMidi()
MidiEventList* l = &(mft->events);
int port = 0; // track->channel()->port();
int channel = 0;
- if (track->channel())
- channel = track->channel()->channelNo();
+ channel = track->channelNo();
//-----------------------------------
// managed controller
@@ -213,23 +211,23 @@ void MusE::exportMidi()
// apply trackinfo values
//---------------------------------------
- if (track->transposition
- || track->velocity
- || track->compression != 100
- || track->len != 100) {
- pitch += track->transposition;
+ if (track->transposition()
+ || track->velocity()
+ || track->compression() != 100
+ || track->len() != 100) {
+ pitch += track->transposition();
if (pitch > 127)
pitch = 127;
if (pitch < 0)
pitch = 0;
- velo += track->velocity;
- velo = (velo * track->compression) / 100;
+ velo += track->velocity();
+ velo = (velo * track->compression()) / 100;
if (velo > 127)
velo = 127;
if (velo < 1) // no off event
velo = 1;
- len = (len * track->len) / 100;
+ len = (len * track->len()) / 100;
}
if (len <= 0)
len = 1;
diff --git a/muse/muse/gconfig.cpp b/muse/muse/gconfig.cpp
index 3fb98749..c926d919 100644
--- a/muse/muse/gconfig.cpp
+++ b/muse/muse/gconfig.cpp
@@ -62,7 +62,7 @@ GlobalConfigValues config = {
QColor(Qt::gray), // midi;
QColor(Qt::gray), // midiOut;
QColor(Qt::gray), // midiIn;
- QColor(Qt::gray), // midiChannel;
+// QColor(Qt::gray), // midiChannel;
QColor(Qt::gray), // midiSynti;
},
diff --git a/muse/muse/importmidi.cpp b/muse/muse/importmidi.cpp
index 38a27f25..83cae602 100644
--- a/muse/muse/importmidi.cpp
+++ b/muse/muse/importmidi.cpp
@@ -39,7 +39,6 @@
#include "mixer/mixer.h"
#include "arranger/arranger.h"
#include "midictrl.h"
-#include "midichannel.h"
#include "midiinport.h"
#include "midioutport.h"
@@ -243,14 +242,16 @@ void MusE::importMidi(const QString &file)
//
// add connected channels
//
- MidiChannelList* mcl = song->midiChannel();
TrackList* tl = song->tracks();
+#if 0
+ MidiChannelList* mcl = song->midiChannel();
for (iMidiChannel i = mcl->begin(); i != mcl->end(); ++i) {
MidiChannel* mc = (MidiChannel*)*i;
if (mc->noInRoute() || song->trackExists(mc))
continue;
tl->push_back(mc);
}
+#endif
selectionChanged(); // enable/disable "Copy" & "Paste"
arranger->endLoadSong();
@@ -427,16 +428,15 @@ void MusE::addMidiFile(const QString name)
continue;
MidiTrack* track = new MidiTrack();
- MidiChannel* mc = outPort->channel(channel);
if ((*t)->isDrumTrack)
- mc->setUseDrumMap(true);
- track->outRoutes()->push_back(Route(outPort->channel(channel), -1, Route::TRACK));
- if (inPort && config.connectToAllMidiTracks) {
- for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
- Route src(inPort, ch, Route::TRACK);
- track->inRoutes()->push_back(src);
- }
- }
+ track->setUseDrumMap(true);
+//TODOB track->outRoutes()->push_back(Route(outPort->channel(channel), -1, Route::TRACK));
+// if (inPort && config.connectToAllMidiTracks) {
+// for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+// Route src(inPort, ch, Route::TRACK);
+// track->inRoutes()->push_back(src);
+// }
+// }
EventList* mel = track->events();
buildMidiEventList(mel, el, track, division, first);
@@ -447,14 +447,14 @@ void MusE::addMidiFile(const QString name)
if (event.type() == Controller) {
int ctrl = event.dataA();
MidiInstrument* instr = outPort->instrument();
- mc->addMidiController(instr, ctrl);
+ track->addMidiController(instr, ctrl);
CVal val;
val.i = event.dataB();
- mc->addControllerVal(ctrl, event.tick(), val);
+ track->addControllerVal(ctrl, event.tick(), val);
}
}
if (channel == 9) {
- mc->setUseDrumMap(true);
+ track->setUseDrumMap(true);
//
// remap drum pitch with drumInmap
//
@@ -480,7 +480,7 @@ void MusE::addMidiFile(const QString name)
// (SYSEX or META)
//
MidiTrack* track = new MidiTrack();
- addRoute(Route(track, -1, Route::TRACK), Route(outPort->channel(0), -1, Route::TRACK));
+// addRoute(Route(track, -1, Route::TRACK), Route(track));
EventList* mel = track->events();
buildMidiEventList(mel, el, track, division, true);
processTrack(track);
diff --git a/muse/muse/liste/CMakeLists.txt b/muse/muse/liste/CMakeLists.txt
index ad2be64c..dc5e769e 100644
--- a/muse/muse/liste/CMakeLists.txt
+++ b/muse/muse/liste/CMakeLists.txt
@@ -19,19 +19,16 @@
#=============================================================================
QT4_WRAP_CPP ( liste_mocs
- listedit.h editevent.h
-# editnotedialog.h
+ listedit.h
+ ctrllistedit.h
)
QT4_WRAP_UI ( liste_ui_headers
- editnotedialog.ui
)
add_library ( liste STATIC
- listedit.h editevent.h
-# editnotedialog.h
-# editnotedialog.cpp
- listedit.cpp editevent.cpp
+ listedit.cpp listedit.h
+ ctrllistedit.cpp ctrllistedit.h
${liste_mocs}
${liste_ui_headers}
)
@@ -39,3 +36,4 @@ set_target_properties( liste
PROPERTIES COMPILE_FLAGS "-include ${PROJECT_SOURCE_DIR}/all.h"
)
+
diff --git a/muse/muse/liste/ctrllistedit.cpp b/muse/muse/liste/ctrllistedit.cpp
new file mode 100644
index 00000000..05563bcf
--- /dev/null
+++ b/muse/muse/liste/ctrllistedit.cpp
@@ -0,0 +1,31 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#include "ctrllistedit.h"
+
+//---------------------------------------------------------
+// CtrlListEditor
+//---------------------------------------------------------
+
+CtrlListEditor::CtrlListEditor(QWidget* parent)
+ : QWidget(parent)
+ {
+ }
+
diff --git a/muse/muse/liste/ctrllistedit.h b/muse/muse/liste/ctrllistedit.h
new file mode 100644
index 00000000..0966735d
--- /dev/null
+++ b/muse/muse/liste/ctrllistedit.h
@@ -0,0 +1,38 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#ifndef __CTRLLISTEDIT_H__
+#define __CTRLLISTEDIT_H__
+
+
+//---------------------------------------------------------
+// CtrlListEditor
+//---------------------------------------------------------
+
+class CtrlListEditor : public QWidget {
+ Q_OBJECT
+
+ public:
+ CtrlListEditor(QWidget* parent = 0);
+ };
+
+
+#endif
+
diff --git a/muse/muse/liste/editctrlbase.ui b/muse/muse/liste/editctrlbase.ui
deleted file mode 100644
index fa2f5b6f..00000000
--- a/muse/muse/liste/editctrlbase.ui
+++ /dev/null
@@ -1,288 +0,0 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>Dialog</class>
- <widget class="QDialog" name="Dialog" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>436</width>
- <height>361</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>8</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="0" column="1" >
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="3" column="0" colspan="2" >
- <widget class="QStackedWidget" name="stackedWidget" >
- <property name="currentIndex" >
- <number>0</number>
- </property>
- <widget class="QWidget" name="page" >
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>8</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_7" >
- <property name="text" >
- <string>Program</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" >
- <widget class="QSpinBox" name="program" />
- </item>
- <item row="3" column="1" >
- <widget class="QSpinBox" name="lbank" />
- </item>
- <item row="2" column="1" >
- <widget class="QSpinBox" name="hbank" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_6" >
- <property name="text" >
- <string>L-Bank</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>H-Bank</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="QPushButton" name="patchName" >
- <property name="text" >
- <string>Patch Name</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="page" >
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>8</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="label_9" >
- <property name="text" >
- <string>Value</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_8" >
- <property name="text" >
- <string>Controller</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2" colspan="2" >
- <widget class="QLabel" name="controllerName" >
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="4" >
- <widget class="QSlider" name="valSlider" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="3" >
- <widget class="QSpinBox" name="valSpinBox" />
- </item>
- <item row="0" column="1" colspan="2" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QSpinBox" name="midiPort" />
- </item>
- <item row="0" column="1" >
- <widget class="QSpinBox" name="spinBox" />
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Time Position:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Midi Port:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QSpinBox" name="midiChannel" />
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Midi Channel:</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0" >
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Available Controller:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QListWidget" name="ctrlList" />
- </item>
- <item>
- <widget class="QPushButton" name="buttonNewController" >
- <property name="text" >
- <string>Create New Controller</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>131</width>
- <height>31</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="okButton" >
- <property name="text" >
- <string>OK</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelButton" >
- <property name="text" >
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <pixmapfunction></pixmapfunction>
- <resources/>
- <connections>
- <connection>
- <sender>okButton</sender>
- <signal>clicked()</signal>
- <receiver>Dialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>278</x>
- <y>253</y>
- </hint>
- <hint type="destinationlabel" >
- <x>96</x>
- <y>254</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>cancelButton</sender>
- <signal>clicked()</signal>
- <receiver>Dialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>369</x>
- <y>253</y>
- </hint>
- <hint type="destinationlabel" >
- <x>179</x>
- <y>282</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/muse/muse/liste/editevent.cpp b/muse/muse/liste/editevent.cpp
deleted file mode 100644
index d203bc1c..00000000
--- a/muse/muse/liste/editevent.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-//=========================================================
-// MusE
-// Linux Music Editor
-// $Id: editevent.cpp,v 1.26 2005/11/04 12:03:47 wschweer Exp $
-// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
-//=========================================================
-
-#include "song.h"
-#include "event.h"
-#include "midictrl.h"
-#include "editevent.h"
-#include "awl/pitchlabel.h"
-#include "awl/pitchedit.h"
-#include "globals.h"
-#include "awl/posedit.h"
-#include "gconfig.h"
-#include "midiedit/drummap.h"
-#include "instruments/minstrument.h"
-
-//---------------------------------------------------------
-// string2qhex
-//---------------------------------------------------------
-
-QString string2hex(const unsigned char* data, int len)
- {
- QString d;
- QString s;
- for (int i = 0; i < len; ++i) {
- if ((i > 0) && ((i % 8)==0)) {
- d += "\n";
- }
- else if (i)
- d += " ";
- d += s.sprintf("0x%02x", data[i]);
- }
- return d;
- }
-
-//---------------------------------------------------------
-// hex2string
-//---------------------------------------------------------
-
-char* hex2string(QWidget* parent, const char* src, int& len)
- {
- char buffer[2048];
- char* dst = buffer;
-
- while (*src) {
- while (*src == ' ' || *src == '\n')
- ++src;
- char* ep;
- long val = strtol(src, &ep, 0);
- if (ep == src) {
- QMessageBox::information(parent,
- QString("MusE"),
- QWidget::tr("Cannot convert sysex string"));
- return 0;
- }
- src = ep;
- *dst++ = val;
- if (dst - buffer >= 2048) {
- QMessageBox::information(parent,
- QString("MusE"),
- QWidget::tr("Hex String too long (2048 bytes limit)"));
- return 0;
- }
- }
- len = dst - buffer;
- char* b = new char[len+1];
- memcpy(b, buffer, len);
- b[len] = 0;
- return b;
- }
-
-//---------------------------------------------------------
-// getEvent
-//---------------------------------------------------------
-
-Event EditNoteDialog::getEvent(int tick, const Event& event, QWidget* parent)
- {
- EditNoteDialog* dlg = new EditNoteDialog(tick, event, parent);
- Event nevent;
- if (dlg->exec() == QDialog::Accepted) {
- nevent = dlg->event();
- }
- delete dlg;
- return nevent;
- }
-
-Event EditSysexDialog::getEvent(int tick, MidiInstrument* mi, const Event& event, QWidget* parent)
- {
- EditSysexDialog* dlg = new EditSysexDialog(tick, mi, event, parent);
- Event nevent;
- if (dlg->exec() == QDialog::Accepted) {
- nevent = dlg->event();
- }
- delete dlg;
- return nevent;
- }
-
-Event EditMetaDialog::getEvent(int tick, const Event& event, QWidget* parent)
- {
- EditEventDialog* dlg = new EditMetaDialog(tick, event, parent);
- Event nevent;
- if (dlg->exec() == QDialog::Accepted) {
- nevent = dlg->event();
- }
- delete dlg;
- return nevent;
- }
-
-Event EditCAfterDialog::getEvent(int tick, const Event& event, QWidget* parent)
- {
- EditEventDialog* dlg = new EditCAfterDialog(tick, event, parent);
- Event nevent;
- if (dlg->exec() == QDialog::Accepted) {
- nevent = dlg->event();
- }
- delete dlg;
- return nevent;
- }
-
-Event EditPAfterDialog::getEvent(int tick, const Event& event, QWidget* parent)
- {
- EditEventDialog* dlg = new EditPAfterDialog(tick, event, parent);
- Event nevent;
- if (dlg->exec() == QDialog::Accepted) {
- nevent = dlg->event();
- }
- delete dlg;
- return nevent;
- }
-
-//---------------------------------------------------------
-// EditEventDialog
-//---------------------------------------------------------
-
-EditEventDialog::EditEventDialog(QWidget* parent)
-// : QDialog(parent, "edit event", true)
- : QDialog(parent)
- {
- QVBoxLayout* xlayout = new QVBoxLayout(this);
- layout1 = new QGridLayout;
- xlayout->addLayout(layout1);
-
- //---------------------------------------------------
- // Ok, Cancel
- //---------------------------------------------------
-
- QBoxLayout* w5 = new QHBoxLayout;
- xlayout->addLayout(w5);
- QPushButton* okB = new QPushButton(tr("Ok"), this);
- okB->setDefault(true);
- QPushButton* cancelB = new QPushButton(tr("Cancel"), this);
- okB->setFixedWidth(80);
- cancelB->setFixedWidth(80);
- w5->addWidget(okB);
- w5->addSpacing(12);
- w5->addWidget(cancelB);
- w5->addStretch(1);
- connect(cancelB, SIGNAL(clicked()), SLOT(reject()));
- connect(okB, SIGNAL(clicked()), SLOT(accept()));
- }
-
-//---------------------------------------------------------
-// EditNoteDialog
-//---------------------------------------------------------
-
-EditNoteDialog::EditNoteDialog(int tick, const Event& /*event*/, QWidget* parent)
-// : EditNoteDialogBase(parent)
- : QDialog(parent)
- {
-// if (!event.empty()) {
-//TD pos->setValue(tick);
-// il1->setValue(event.lenTick());
-// pl->setValue(event.pitch());
-// il2->setValue(event.velo());
-// il3->setValue(event.veloOff());
-// }
-// else {
-//TD pos->setValue(0);
-// il1->setValue(96);
-// pl->setValue(64);
-// il2->setValue(100);
-// il3->setValue(0);
-// }
- }
-
-//---------------------------------------------------------
-// EditNoteDialog::event
-//---------------------------------------------------------
-
-Event EditNoteDialog::event()
- {
- Event event(Note);
-//TD event.setTick(pos->pos().tick());
-// event.setA(pl->value());
-// event.setB(il2->value());
-// event.setC(il3->value());
-// event.setLenTick(il1->value());
- return event;
- }
-
-//---------------------------------------------------------
-// EditSysExDialog
-//---------------------------------------------------------
-
-EditSysexDialog::EditSysexDialog(int tick, MidiInstrument* m, const Event& /*event*/, QWidget* parent)
-// : EditSysexDialogBase(parent)
- : QDialog(parent)
- {
-#if 0 //TD
- sysex = 0;
- mi = m;
- if (mi) {
- std::vector<SysEx>* sl = mi->sysexList();
- for (std::vector<SysEx>::iterator i = sl->begin(); i != sl->end(); ++i) {
- SysEx se = *i;
- sysexList->insertItem(se.name);
- }
- }
- if (!event.empty()) {
- pos->setValue(tick);
- edit->setText(string2hex(event.data(), event.dataLen()));
- }
- else {
- pos->setValue(0);
- }
- listSelectionChanged(); // initialize Add button
- connect(sysexList, SIGNAL(selectionChanged()), SLOT(listSelectionChanged()));
- connect(buttonAdd, SIGNAL(clicked()), SLOT(addPressed()));
-#endif
- }
-
-//---------------------------------------------------------
-// addPressed
-//---------------------------------------------------------
-
-void EditSysexDialog::addPressed()
- {
-#if 0 //TD
- Q3ListBoxItem* item = sysexList->selectedItem();
- if (!item)
- return;
- std::vector<SysEx>* sl = mi->sysexList();
- for (std::vector<SysEx>::iterator i = sl->begin(); i != sl->end(); ++i) {
- SysEx se = *i;
- if (se.name == item->text()) {
- QString s = edit->text();
- if (!s.isEmpty())
- s += " ";
- s += se.data;
- edit->setText(s);
- comment->setText(se.comment);
- break;
- }
- }
-#endif
- }
-
-//---------------------------------------------------------
-// listSelectionChanged
-//---------------------------------------------------------
-
-void EditSysexDialog::listSelectionChanged()
- {
-//TD Q3ListBoxItem* item = sysexList->selectedItem();
-// buttonAdd->setEnabled(item);
- }
-
-//---------------------------------------------------------
-// ~EditSysexDialog
-//---------------------------------------------------------
-
-EditSysexDialog::~EditSysexDialog()
- {
-//TD if (sysex)
-// delete sysex;
- }
-
-//---------------------------------------------------------
-// EditSysExDialog::event
-//---------------------------------------------------------
-
-Event EditSysexDialog::event()
- {
- Event event(Sysex);
-//TD event.setTick(pos->pos().tick());
- event.setData(sysex, len);
- return event;
- }
-
-//---------------------------------------------------------
-// accept
-//---------------------------------------------------------
-
-void EditSysexDialog::accept()
- {
-//TD QString qsrc = edit->text();
-// const char* src = qsrc.toLatin1().data();
-
-// sysex = (unsigned char*)hex2string(this, src, len);
-// if (sysex)
-// QDialog::accept();
- }
-
-//---------------------------------------------------------
-// EditMetaDialog
-//---------------------------------------------------------
-
-EditMetaDialog::EditMetaDialog(int tick, const Event& ev, QWidget* parent)
- : EditEventDialog(parent)
- {
-#if 0
- meta = 0;
- setWindowTitle(tr("MusE: Enter Meta Event"));
-
- QLabel* l1 = new QLabel(tr("Time Position"), this);
- pos = new PosEdit;
-
- QLabel* l2 = new QLabel(tr("Meta Type"), this);
- il2 = new IntLabel(-1, 0, 127, this, -1);
- il2->setFrame(true);
- il2->setDark();
-
- hexButton = new QRadioButton(tr("Enter Hex"), this, "hextoggle");
- hexButton->setChecked(true);
- connect(hexButton, SIGNAL(toggled(bool)), SLOT(toggled(bool)));
-
- edit = new Q3MultiLineEdit(this);
- edit->setFont(*config.fonts[5]);
-
- if (!ev.empty()) {
- pos->setValue(tick);
- il2->setValue(ev.dataA());
- toggled(true);
- edit->setText(string2hex(ev.data(), ev.dataLen()));
- }
- else {
- pos->setValue(0);
- il2->setValue(0);
- }
-
- layout1->addWidget(l1, 0, 0);
- layout1->addWidget(pos, 0, 1, Qt::AlignLeft);
- layout1->addWidget(l2, 1, 0);
- layout1->addWidget(il2, 1, 1, Qt::AlignLeft);
- layout1->addMultiCellWidget(hexButton, 2, 2, 0, 1);
- layout1->addMultiCellWidget(edit, 3, 3, 0, 1);
-#endif
- }
-
-//---------------------------------------------------------
-// toggled
-//---------------------------------------------------------
-
-void EditMetaDialog::toggled(bool flag)
- {
-#if 0
- QString qsrc = edit->text();
- const char* src = qsrc.toLatin1().data();
- edit->clear();
-
- QString dst;
- if (flag) { // convert to hex
- dst = string2hex((unsigned char*)src, strlen(src));
- }
- else { // convert to string
- int len;
- dst = hex2string(this, src, len);
- }
- edit->setText(dst);
-#endif
- }
-
-//---------------------------------------------------------
-// ~EditMetaDialog
-//---------------------------------------------------------
-
-EditMetaDialog::~EditMetaDialog()
- {
- if (meta)
- delete meta;
- }
-
-//---------------------------------------------------------
-// EditMetaDialog::event
-//---------------------------------------------------------
-
-Event EditMetaDialog::event()
- {
- Event event(Meta);
-#if 0
- event.setTick(pos->pos().tick());
- event.setA(il2->value());
- event.setData(meta, len); // TODO ??
-#endif
- return event;
- }
-
-//---------------------------------------------------------
-// accept
-//---------------------------------------------------------
-
-void EditMetaDialog::accept()
- {
-#if 0
- QString qsrc = edit->text();
- const char* src = qsrc.toLatin1().data();
- if (!hexButton->isChecked()) {
- meta = (unsigned char*)strdup(src);
- len = strlen(src);
- QDialog::accept();
- return;
- }
-
- meta = (unsigned char*)hex2string(this, src, len);
- if (meta)
- QDialog::accept();
-#endif
- }
-
-//---------------------------------------------------------
-// EditCAfterDialog
-//---------------------------------------------------------
-
-EditCAfterDialog::EditCAfterDialog(int tick, const Event& event,
- QWidget* parent)
- : EditEventDialog(parent)
- {
-#if 0
- setCaption(tr("MusE: Enter Channel Aftertouch"));
-
- QLabel* l1 = new QLabel(tr("Time Position"), this);
- pos = new PosEdit;
-
- QLabel* l2 = new QLabel(tr("Pressure"), this);
- il2 = new IntLabel(-1, 0, 127, this, -1);
- il2->setFrame(true);
- il2->setDark();
-
- QSlider* slider = new QSlider(0, 127, 1, 0, Qt::Horizontal, this);
- connect(slider, SIGNAL(valueChanged(int)), il2, SLOT(setValue(int)));
- connect(il2, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
-
- if (!event.empty()) {
- pos->setValue(tick);
- il2->setValue(event.dataA());
- slider->setValue(event.dataA());
- }
- else {
- pos->setValue(0);
- il2->setValue(64);
- slider->setValue(64);
- }
-
- layout1->addWidget(l1, 0, 0);
- layout1->addWidget(pos, 0, 1, Qt::AlignLeft);
- layout1->addWidget(l2, 1, 0);
- layout1->addWidget(il2, 1, 1, Qt::AlignLeft);
- layout1->addMultiCellWidget(slider, 2, 2, 0, 1);
-#endif
- }
-
-//---------------------------------------------------------
-// EditCAfterDialog::event
-//---------------------------------------------------------
-
-Event EditCAfterDialog::event()
- {
- Event event(CAfter);
-#if 0
- event.setTick(pos->pos().tick());
- event.setA(il2->value());
-#endif
- return event;
- }
-
-//---------------------------------------------------------
-// EditPAfterDialog
-//---------------------------------------------------------
-
-EditPAfterDialog::EditPAfterDialog(int tick, const Event& event,
- QWidget* parent)
- : EditEventDialog(parent)
- {
-#if 0
- setCaption(tr("MusE: Enter Poly Aftertouch"));
-
- QLabel* l1 = new QLabel(tr("Time Position"), this);
- pos = new PosEdit;
-
- QLabel* l2 = new QLabel(tr("Pitch"), this);
- pl = new PitchLabel;
-
- QLabel* l3 = new QLabel(tr("Pressure"), this);
- il2 = new IntLabel(-1, 0, 127, this, -1);
- il2->setFrame(true);
- il2->setDark();
-
- QSlider* slider = new QSlider(0, 127, 1, 0, Qt::Horizontal, this);
- connect(slider, SIGNAL(valueChanged(int)), il2, SLOT(setValue(int)));
- connect(il2, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
-
- if (!event.empty()) {
- pos->setValue(tick);
- pl->setValue(event.pitch());
- il2->setValue(event.dataB());
- slider->setValue(event.dataB());
- }
- else {
- pos->setValue(0);
- pl->setValue(64);
- il2->setValue(64);
- slider->setValue(64);
- }
-
- layout1->addWidget(l1, 0, 0);
- layout1->addWidget(pos, 0, 1, Qt::AlignLeft);
- layout1->addWidget(l2, 1, 0);
- layout1->addWidget(pl, 1, 1, Qt::AlignLeft);
- layout1->addWidget(l3, 2, 0);
- layout1->addWidget(il2, 2, 1, Qt::AlignLeft);
- layout1->addMultiCellWidget(slider, 3, 3, 0, 1);
-#endif
- }
-
-//---------------------------------------------------------
-// EditPAfterDialog::event
-//---------------------------------------------------------
-
-Event EditPAfterDialog::event()
- {
- Event event(CAfter);
-#if 0 //TD
- event.setTick(pos->pos().tick());
- event.setA(pl->value());
- event.setB(il2->value());
-#endif
- return event;
- }
-
diff --git a/muse/muse/liste/editevent.h b/muse/muse/liste/editevent.h
deleted file mode 100644
index 12909383..00000000
--- a/muse/muse/liste/editevent.h
+++ /dev/null
@@ -1,152 +0,0 @@
-//=========================================================
-// MusE
-// Linux Music Editor
-// $Id: editevent.h,v 1.16 2005/11/04 12:03:47 wschweer Exp $
-// (C) Copyright 1999 Werner Schweer (ws@seh.de)
-//=========================================================
-
-#ifndef __EDIT_EVENT_H__
-#define __EDIT_EVENT_H__
-
-#include "ui_editnotedialog.h"
-// #include "widgets/editsysexdialogbase.h"
-#include "event.h"
-
-namespace Awl {
- class PosEdit;
- class PitchLabel;
- };
-using Awl::PosEdit;
-using Awl::PitchLabel;
-
-// class IntLabel;
-class MidiPart;
-class MidiInstrument;
-
-//---------------------------------------------------------
-// EditEventDialog
-//---------------------------------------------------------
-
-class EditEventDialog : public QDialog {
- Q_OBJECT
-
- protected:
- QGridLayout* layout1;
-
- public:
- EditEventDialog(QWidget* parent=0);
- virtual Event event() = 0;
- };
-
-//---------------------------------------------------------
-// EditNoteDialog
-//---------------------------------------------------------
-
-// class EditNoteDialog : public EditNoteDialogBase {
-class EditNoteDialog : public QDialog {
- Q_OBJECT
-
- public:
- EditNoteDialog(int tick, const Event&, QWidget* parent=0);
- static Event getEvent(int tick, const Event&,
- QWidget* parent = 0);
- virtual Event event();
- };
-
-//---------------------------------------------------------
-// EditSysExDialog
-//---------------------------------------------------------
-
-// class EditSysexDialog : public EditSysexDialogBase {
-class EditSysexDialog : public QDialog {
- Q_OBJECT
-
- unsigned char* sysex;
- MidiInstrument* mi;
-
- int len;
-
- protected:
- QGridLayout* layout;
-
- private slots:
- virtual void accept();
- void addPressed();
- void listSelectionChanged();
-
- public:
- EditSysexDialog(int tick, MidiInstrument*, const Event&, QWidget* parent=0);
- ~EditSysexDialog();
- static Event getEvent(int tick, MidiInstrument*, const Event&, QWidget* parent = 0);
- virtual Event event();
- };
-
-//---------------------------------------------------------
-// EditMetaDialog
-//---------------------------------------------------------
-
-class EditMetaDialog : public EditEventDialog {
- Q_OBJECT
-
- unsigned char* meta;
- int len;
- PosEdit* pos;
- QTextEdit* edit;
-// IntLabel* il2;
- QRadioButton* hexButton;
-
- protected:
- QGridLayout* layout;
-
- private slots:
- virtual void accept();
- void toggled(bool);
-
- public:
- EditMetaDialog(int tick, const Event&, QWidget* parent=0);
- ~EditMetaDialog();
- static Event getEvent(int tick, const Event&, QWidget* parent = 0);
- virtual Event event();
- };
-
-//---------------------------------------------------------
-// EditCAfterDialog
-//---------------------------------------------------------
-
-class EditCAfterDialog : public EditEventDialog {
- Q_OBJECT
-
- PosEdit* pos;
-// IntLabel* il2;
-
- protected:
- QGridLayout* layout;
-
- public:
- EditCAfterDialog(int tick, const Event&, QWidget* parent=0);
- static Event getEvent(int tick, const Event&, QWidget* parent = 0);
- virtual Event event();
- };
-
-//---------------------------------------------------------
-// EditPAfterDialog
-//---------------------------------------------------------
-
-class EditPAfterDialog : public EditEventDialog {
- Q_OBJECT
-
- PosEdit* pos;
- PitchLabel* pl;
-// IntLabel* il2;
-
- protected:
- QGridLayout* layout;
-
- public:
- EditPAfterDialog(int tick, const Event&, QWidget* parent=0);
- static Event getEvent(int tick, const Event&, QWidget* parent = 0);
- virtual Event event();
- };
-
-#endif
-
diff --git a/muse/muse/liste/editnotedialog.ui b/muse/muse/liste/editnotedialog.ui
deleted file mode 100644
index d59d1c10..00000000
--- a/muse/muse/liste/editnotedialog.ui
+++ /dev/null
@@ -1,150 +0,0 @@
-<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
- <class>EditNoteDialogBase</class>
- <widget class="QDialog" name="EditNoteDialogBase" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>8</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="0" column="1" >
- <widget class="QSpinBox" name="spinBox_5" />
- </item>
- <item row="1" column="1" >
- <widget class="QSpinBox" name="spinBox_4" />
- </item>
- <item row="2" column="1" >
- <widget class="QSpinBox" name="spinBox_3" />
- </item>
- <item row="3" column="1" >
- <widget class="QSpinBox" name="spinBox_2" />
- </item>
- <item row="4" column="1" >
- <widget class="QSpinBox" name="spinBox" />
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Velocity Off:&lt;/p>&lt;/body>&lt;/html></string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Velocity On:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Arial; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Pitch:&lt;/p>&lt;/body>&lt;/html></string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Length:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Time Position:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" colspan="2" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>131</width>
- <height>31</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="okButton" >
- <property name="text" >
- <string>OK</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="cancelButton" >
- <property name="text" >
- <string>Cancel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <pixmapfunction></pixmapfunction>
- <resources/>
- <connections>
- <connection>
- <sender>okButton</sender>
- <signal>clicked()</signal>
- <receiver>EditNoteDialogBase</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>278</x>
- <y>253</y>
- </hint>
- <hint type="destinationlabel" >
- <x>96</x>
- <y>254</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>cancelButton</sender>
- <signal>clicked()</signal>
- <receiver>EditNoteDialogBase</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>369</x>
- <y>253</y>
- </hint>
- <hint type="destinationlabel" >
- <x>179</x>
- <y>282</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/muse/muse/liste/listedit.cpp b/muse/muse/liste/listedit.cpp
index a7895968..9c06d375 100644
--- a/muse/muse/liste/listedit.cpp
+++ b/muse/muse/liste/listedit.cpp
@@ -1,1314 +1,174 @@
-//=========================================================
+//=============================================================================
// MusE
// Linux Music Editor
-// $Id: listedit.cpp,v 1.43 2005/11/05 23:15:23 wschweer Exp $
-// (C) Copyright 1999-2005 Werner Schweer (ws@seh.de)
-//=========================================================
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
-#if 0 //TD
#include "listedit.h"
-#include "globals.h"
-#include "icons.h"
+#include "al/pos.h"
+#include "ctrllistedit.h"
#include "song.h"
-#include "audio.h"
-#include "shortcuts.h"
-#include "midi.h"
-#include "event.h"
-#include "midictrl.h"
-#include "esettings.h"
-
-#include "al/xml.h"
-#include "al/tempo.h"
-#include "al/sig.h"
-#include "awl/utils.h"
-#include "awl/sigedit.h"
-#include "awl/posedit.h"
-#include "awl/pitchedit.h"
-
-#include "instruments/minstrument.h"
-
-enum { L_TIMESIG=1001, L_TEMPOSIG, L_NOTES, L_SYSEX, L_PAFTER,
- L_CAFTER, L_META, L_CTRL, L_WAVE, L_PART, L_TRACK
- };
-
-//---------------------------------------------------------
-// ListCtrl
-//---------------------------------------------------------
-
-struct ListCtrl {
- int tick;
- Track* track;
- int id;
- CVal val;
- ListCtrl(int t, Track* tr, int d, CVal v) {
- tick = t;
- track = tr;
- id = d;
- val = v;
- }
- ListCtrl() {
- tick = 0;
- track = 0;
- id = 0;
- val.i = 0;
- }
- };
-
-//---------------------------------------------------------
-// midi_meta_name
-//---------------------------------------------------------
-
-static QString midiMetaComment(const Event& ev)
- {
- int meta = ev.dataA();
- QString s = midiMetaName(meta);
-
- switch (meta) {
- case 0:
- case 0x2f:
- case 0x51:
- case 0x54:
- case 0x58:
- case 0x59:
- case 0x74:
- case 0x7f: return s;
-
- case 1 ... 15:
- {
- s += QString(": ");
- const char* txt = (char*)(ev.data());
- int len = ev.dataLen();
- char buffer[len+1];
- memcpy(buffer, txt, len);
- buffer[len] = 0;
-
- for (int i = 0; i < len; ++i) {
- if (buffer[i] == '\n' || buffer[i] == '\r')
- buffer[i] = ' ';
- }
- return s + QString(buffer);
- }
-
- case 0x20:
- case 0x21:
- default:
- {
- s += QString(": ");
- int i;
- int len = ev.lenTick();
- int n = len > 10 ? 10 : len;
- for (i = 0; i < n; ++i) {
- if (i >= ev.dataLen())
- break;
- s += QString(" 0x");
- QString k;
- k.setNum(ev.data()[i] & 0xff, 16);
- s += k;
- }
- if (i == 10)
- s += QString("...");
- return s;
- }
- }
- }
-
-//---------------------------------------------------------
-// paintCell
-//---------------------------------------------------------
-
-void LItem::paintCell(QPainter* p, const QColorGroup& cg,
- int column, int width, int align)
- {
- if (!p)
- return;
- Q3ListView *lv = listView();
- if (!lv )
- return;
-
- if (isSelected() && (column == 0 || lv->allColumnsShowFocus())) {
- p->fillRect(0, 0, width, height(), cg.brush(QColorGroup::Highlight));
- p->setPen(cg.highlightedText());
- }
- else
- p->fillRect(0, 0, width, height(), QColor(200, 200, zebra ? 200 : 230));
-
- QString t = text(column);
- if (!t.isEmpty()) {
- if (!(align & Qt::AlignVCenter || align & Qt::AlignBottom))
- align |= Qt::AlignTop;
- int marg = lv->itemMargin();
- p->drawText(marg, marg, width-marg-marg, height(), align, t);
- }
- }
-
-//---------------------------------------------------------
-// text
-//---------------------------------------------------------
-
-QString LItem::text(int col) const
- {
- QString s;
- bool isMidi = lli()->track()->isMidiTrack();
-
- if (col == 0) {
- s.sprintf("%04d", _pos.tick());
- return s;
- }
- if (col == 1) {
- int bar, beat;
- unsigned tick;
- AL::sigmap.tickValues(_pos.tick(), &bar, &beat, &tick);
- s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
- return s;
- }
- switch(_rtti) {
- case L_TIMESIG:
- if (col == 2)
- s = QString("Time");
- else if (col == 3) {
- s.sprintf("%d/%d", _sig->z, _sig->n);
- }
- break;
- case L_TEMPOSIG:
- if (col == 2)
- s = QString("Tempo");
- else if (col == 3) {
- double t = (1000000.0 * 60.0)/_tempo->tempo;
- s.setNum(t, 'f', 3);
- }
- break;
- case L_NOTES:
- if (col == 2)
- s = "Note";
- else if (col == 3)
- s = Awl::pitch2string(_event.dataA());
- else if (col == 4)
- s.setNum(_event.dataB(), *showHex ? 16 : 10);
- else if (col == 5)
- s.setNum(_event.lenTick());
- break;
-
- case L_WAVE:
- if (col == 2)
- s = "Wave";
- else if (col == 5)
- s.setNum(_event.lenTick());
- break;
-
- case L_SYSEX:
- if (col == 2)
- s = "SysEx";
- else if (col == 6) {
- s = QString("len ");
- QString k;
- k.setNum(_event.dataLen());
- s += k;
- s += QString(" ");
-
- s += nameSysex(_event.dataLen(), _event.data());
- int i;
- for (i = 0; i < 10; ++i) {
- if (i >= _event.dataLen())
- break;
- s += QString(" 0x");
- QString k;
- k.setNum(_event.data()[i] & 0xff, 16);
- s += k;
- }
- if (i == 10)
- s += QString("...");
- }
- break;
- case L_PAFTER:
- if (col == 2)
- s = "PAfter";
- else if (col == 3)
- s.setNum(_event.dataA(), *showHex ? 16 : 10);
- else if (col == 4)
- s.setNum(_event.dataB(), *showHex ? 16 : 10);
- break;
- case L_CAFTER:
- if (col == 2)
- s = "CAfter";
- else if (col == 3)
- s.setNum(_event.dataA(), *showHex ? 16 : 10);
- break;
- case L_META:
- if (col == 2)
- s = "Meta";
- else if (col == 3)
- s.setNum(_event.dataA(), *showHex ? 16 : 10);
- else if (col == 6)
- s = midiMetaComment(_event);
- break;
-
- case L_CTRL:
- if (col == 2)
- s = QString("Ctrl");
- else if (col == 3) {
- if (isMidi && lli()->ctrl() == CTRL_PROGRAM) {
- s = "Prog";
- }
- else
- s.setNum(lli()->ctrl());
- }
- else if (col == 4) {
- if (isMidi) {
- if (lli()->ctrl() == CTRL_PROGRAM) {
- int val = _val.i;
- int hb = (val >> 16) & 0xff;
- int lb = (val >> 8) & 0xff;
- int pr = (val) & 0xff;
- char buffer[16];
- if (*showHex) {
- if (hb == 0xff)
- s += "--:";
- else {
- sprintf(buffer, "%02x:", hb);
- s += buffer;
- }
- if (lb == 0xff)
- s += "--:";
- else {
- sprintf(buffer, "%02x:", lb);
- s += buffer;
- }
- if (pr == 0xff)
- s += "--";
- else {
- sprintf(buffer, "%02x", pr);
- s += buffer;
- }
- }
- else {
- if (hb == 0xff)
- s += "---:";
- else {
- sprintf(buffer, "%03d:", hb);
- s += buffer;
- }
- if (lb == 0xff)
- s += "---:";
- else {
- sprintf(buffer, "%03d:", lb);
- s += buffer;
- }
- if (pr == 0xff)
- s += "---";
- else {
- sprintf(buffer, "%03d", pr);
- s += buffer;
- }
- }
- }
- else
- s.setNum(_val.i, *showHex ? 16 : 10);
- }
- else
- s.setNum(_val.f, 'f', 2);
- }
- else if (col == 6)
- s = lli()->track()->getController(lli()->ctrl())->name();
- break;
- }
- return s;
- }
-
-//---------------------------------------------------------
-// updateList
-//---------------------------------------------------------
-
-void ListEdit::updateList()
- {
- list->clear();
- menuEdit->setItemEnabled(CMD_DELETE, false);
- menuEdit->setItemEnabled(CMD_INSERT_SIG, false);
- menuEdit->setItemEnabled(CMD_INSERT_TEMPO, false);
-
- Q3ListViewItemIterator i(lists);
- for (; i.current(); ++i) {
- int id = i.current()->rtti();
- if (id < 1000)
- continue;
- LLItem* item = (LLItem*)(i.current());
- if (!item->isOn())
- continue;
- switch (id) {
- case L_TIMESIG:
- menuEdit->setItemEnabled(CMD_INSERT_SIG, true);
- for (AL::iSigEvent i = AL::sigmap.begin(); i != AL::sigmap.end(); ++i) {
- LItem* item = new LItem(list, id, &showHex);
- item->setPos(Pos(i->second->tick));
- item->setSigEvent(i->second);
- }
- break;
- case L_TEMPOSIG:
- menuEdit->setItemEnabled(CMD_INSERT_TEMPO, true);
- for (AL::iTEvent i = AL::tempomap.begin(); i != AL::tempomap.end(); ++i) {
- LItem* item = new LItem(list, id, &showHex);
- item->setPos(Pos(i->second->tick));
- item->setTempo(i->second);
- }
- break;
- case L_NOTES:
- case L_SYSEX:
- case L_PAFTER:
- case L_CAFTER:
- case L_META:
- {
- menuEdit->setItemEnabled(CMD_INSERT_NOTE, true);
- menuEdit->setItemEnabled(CMD_INSERT_SYSEX, true);
- menuEdit->setItemEnabled(CMD_INSERT_PAFTER, true);
- menuEdit->setItemEnabled(CMD_INSERT_CAFTER, true);
- menuEdit->setItemEnabled(CMD_INSERT_META, true);
- MidiTrack* track = (MidiTrack*)(item->track());
- PartList* pl = track->parts();
- for (iPart ip = pl->begin(); ip !=pl->end(); ++ip) {
- Part* part = ip->second;
- EventList* el = part->events();
- for (iEvent i = el->begin(); i != el->end(); ++i) {
- EventType t = i->second.type();
- if ((id == L_NOTES && t == Note)
- || (id == L_SYSEX && t == Sysex)
- || (id == L_PAFTER && t == PAfter)
- || (id == L_CAFTER && t == CAfter)
- || (id == L_META && t == Meta)) {
- LItem* litem = new LItem(list, id, &showHex);
- litem->setEvent(i->second);
- litem->setPos(Pos(i->first + ip->first));
- litem->setPart(part);
- litem->setLLi(item);
- }
- }
- }
- }
- break;
-
- case L_WAVE:
- {
- WaveTrack* track = (WaveTrack*)(item->track());
- PartList* pl = track->parts();
- for (iPart ip = pl->begin(); ip !=pl->end(); ++ip) {
- Part* part = ip->second;
- EventList* el = part->events();
- for (iEvent i = el->begin(); i != el->end(); ++i) {
- EventType t = i->second.type();
- if (t != Wave) {
- printf("ListEdit::updateList(): wrong part type in wave track\n");
- continue;
- }
- LItem* litem = new LItem(list, id, &showHex);
- litem->setEvent(i->second);
- litem->setPos(Pos(i->first + ip->first));
- litem->setLLi(item);
- }
- }
- }
- break;
-
- case L_CTRL:
- {
- menuEdit->setItemEnabled(CMD_INSERT_CTRL, true);
- Track* track = item->track();
- CtrlList* cl = track->controller();
- for (iCtrl ic = cl->begin(); ic != cl->end(); ++ic) {
- Ctrl* c = ic->second;
- if (c->id() != item->ctrl())
- continue;
- for (iCtrlVal iv = c->begin(); iv != c->end(); ++iv) {
- LItem* litem = new LItem(list, id, &showHex);
- litem->setVal(iv->second);
- litem->setPos(Pos(iv->first));
- litem->setLLi(item);
- }
- }
- }
- break;
- }
- }
- Q3ListViewItemIterator ii(list);
- bool f = false;
- for (; ii.current(); ++ii) {
- ((LItem*)(ii.current()))->setZebra(f);
- f = !f;
- }
- }
-
-//---------------------------------------------------------
-// updateLists
-//---------------------------------------------------------
-
-void ListEdit::updateLists()
- {
- lists->clear();
-
- Q3ListViewItem* item = new Q3ListViewItem(lists, tr("Master"));
- LLItem* lit = new LLItem(item, "Tempo Signature", L_TEMPOSIG);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- lit = new LLItem(item, "Time Signature", L_TIMESIG);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
-
- TrackList* tracks = song->tracks();
- for (irTrack it = tracks->rbegin(); it != tracks->rend(); ++it) {
- Track* track = *it;
- Q3ListViewItem* item = new Q3CheckListItem(lists, track->name(), Q3CheckListItem::CheckBoxController);
- genListsTrack(track, item);
- }
- updateList();
- }
+#include "part.h"
+#include "ctrl.h"
//---------------------------------------------------------
// ListEdit
//---------------------------------------------------------
-ListEdit::ListEdit(QWidget*, PartList*)
- {
- showHex = false;
- curEditor = 0;
- editItem = 0;
- editCol = -1;
- curPart = 0;
-
- setWindowTitle("MusE: List Editor");
-
- //---------Pulldown Menu----------------------------
- menuEdit = new Q3PopupMenu(this);
- menuBar()->insertItem(tr("&Edit"), menuEdit);
-//TD undoRedo->addTo(menuEdit);
- menuEdit->addSeparator();
- menuEdit->addAction(tr("Insert Tempo"), CMD_INSERT_TEMPO);
- menuEdit->addAction(tr("Insert Signature"), CMD_INSERT_SIG);
- menuEdit->addAction(tr("Insert Note"), CMD_INSERT_NOTE);
- menuEdit->addAction(tr("Insert SysEx"), CMD_INSERT_SYSEX);
- menuEdit->addAction(tr("Insert PolyAfterTouch"), CMD_INSERT_PAFTER);
- menuEdit->addAction(tr("Insert After Touch"), CMD_INSERT_CAFTER);
- menuEdit->addAction(tr("Insert Meta"), CMD_INSERT_META);
- menuEdit->addAction(tr("Insert Controller"), CMD_INSERT_CTRL);
-
- menuEdit->insertSeparator();
- menuEdit->insertItem(tr("Delete Event"), CMD_DELETE);
- menuEdit->setAccel(Qt::Key_Delete, CMD_DELETE);
- connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
-
- menuView = new Q3PopupMenu(this);
- menuView->setCheckable(true);
- menuBar()->insertItem(tr("&View"), menuView);
- menuView->insertItem(tr("Hex Midi Values"), CMD_SET_HEX);
- menuView->insertItem(tr("Decimal Midi Values"), CMD_SET_DEC);
- menuView->setItemChecked(CMD_SET_HEX, showHex);
- menuView->setItemChecked(CMD_SET_DEC, !showHex);
- connect(menuView, SIGNAL(activated(int)), SLOT(cmd(int)));
-
- listTools = new QToolBar(this, "list-tools");
- listTools->setLabel(tr("List Tools"));
-//TD undoRedo->addTo(listTools);
- QToolBar* tb = new QToolBar(this, "CurPart");
- tb->addWidget(new QLabel(tr("CurTrack:")));
- tb_t = new QLabel("----");
- tb->addWidget(tb_t);
- tb_t->setFrameShape(Q3Frame::LineEditPanel);
- tb_t->setLineWidth(2);
- tb->addWidget(new QLabel(tr("CurPart:")));
- tb_p = new QLabel(tr("----"));
- tb->addWidget(tb_p);
- tb_p->setFrameShape(Q3Frame::LineEditPanel);
- tb_p->setLineWidth(2);
-
- setCentralWidget(new QWidget(this, "qt_central_widget"));
- QGridLayout* grid = new QGridLayout(centralWidget(), 1, 1, 11, 6, "Form2Layout");
-
- splitter = new QSplitter(Qt::Horizontal, centralWidget());
- splitter->setOpaqueResize(true);
- splitter->setChildrenCollapsible(true);
-
- lists = new Q3ListView(splitter);
- lists->viewport()->setPaletteBackgroundColor(QColor(200, 200, 230));
- lists->setRootIsDecorated(true);
- lists->addColumn(tr("Filter"));
- lists->setResizeMode(Q3ListView::LastColumn);
- lists->setColumnWidthMode(0, Q3ListView::Maximum);
- lists->setSorting(-1);
- splitter->setResizeMode(lists, QSplitter::Auto);
-
- list = new Q3ListView(splitter);
- list->viewport()->setPaletteBackgroundColor(QColor(200, 200, 230));
-
- list->setAllColumnsShowFocus(true);
- list->setSelectionMode(Q3ListView::Single);
- list->addColumn(tr("Tick"));
- list->addColumn(tr("Bar"));
- list->addColumn(tr("Type"));
- list->addColumn(tr("Val 1"));
- list->addColumn(tr("Val 2"));
- list->addColumn(tr("Len"));
- list->addColumn(tr("Comment"));
- list->setResizeMode(Q3ListView::LastColumn);
-
- list->setSorting(0);
- list->setColumnAlignment(0, Qt::AlignRight);
-
- grid->addWidget(splitter, 0, 0);
-
- sigEditor = new Awl::SigEdit(list->viewport());
- textEditor = new QLineEdit(list->viewport());
- pitchEditor = new Awl::PitchEdit(list->viewport());
- posEditor = new Awl::PosEdit;
- sigEditor->hide();
- textEditor->hide();
- pitchEditor->hide();
- posEditor->hide();
-
- updateLists();
- connect(list, SIGNAL(doubleClicked(Q3ListViewItem*,const QPoint&,int)), SLOT(editColumn(Q3ListViewItem*,const QPoint&,int)));
- connect(list->header(), SIGNAL(sizeChange(int,int,int)), SLOT(colResized()));
- connect(list, SIGNAL(selectionChanged()), SLOT(listSelectionChanged()));
-
- connect(sigEditor, SIGNAL(returnPressed()), SLOT(returnPressed()));
- connect(textEditor, SIGNAL(returnPressed()), SLOT(returnPressed()));
- connect(pitchEditor, SIGNAL(returnPressed()), SLOT(returnPressed()));
- connect(posEditor, SIGNAL(returnPressed()), SLOT(returnPressed()));
-
- connect(sigEditor, SIGNAL(escapePressed()), SLOT(escapePressed()));
- connect(pitchEditor, SIGNAL(escapePressed()), SLOT(escapePressed()));
- connect(posEditor, SIGNAL(escapePressed()), SLOT(escapePressed()));
- connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
- connect(song, SIGNAL(trackAdded(Track*,int)), SLOT(trackAdded(Track*,int)));
- connect(song, SIGNAL(trackRemoved(Track*)), SLOT(trackRemoved(Track*)));
- }
-
-//---------------------------------------------------------
-// ~ListEdit
-//---------------------------------------------------------
-
-ListEdit::~ListEdit()
- {
- }
-
-//---------------------------------------------------------
-// editColumn
-//---------------------------------------------------------
-
-void ListEdit::editColumn(Q3ListViewItem* i, const QPoint&, int col)
+ListEdit::ListEdit(QWidget*)
+ : QWidget(0)
{
- if (i == 0 || col == 2 || col == -1)
- return;
- returnPressed(); // close all old editors
+ setWindowTitle(tr("MusE: List Edit"));
- editItem = (LItem*)i;
- editCol = col;
+ QHBoxLayout* hbox = new QHBoxLayout;
+ setLayout(hbox);
- int id = editItem->rtti();
+ QSplitter* split = new QSplitter;
+ split->setOpaqueResize(true);
+ hbox->addWidget(split);
- if (col == 1) {
- posEditor->setValue(editItem->tick());
- curEditor = posEditor;
- }
- else if (id == L_TIMESIG && col == 3) {
- sigEditor->setValue(i->text(col));
- curEditor = sigEditor;
- }
- else if (id == L_NOTES && col == 3) {
- pitchEditor->setValue(editItem->event().pitch());
- curEditor = pitchEditor;
- }
- else if (id == L_SYSEX) {
-#if 0 //TODO3
- MidiTrack* track = (MidiTrack*)(editItem->part()->track());
- MidiPort* mp = &midiPorts[track->outPort()];
- MidiInstrument* instr = mp->instrument();
- Event oEvent = editItem->event();
- EditSysexDialog dl(editItem->tick(), instr, oEvent, list->viewport());
- int rv = dl.exec();
- if (rv == QDialog::Accepted) {
- Event event = dl.event();
- audio->msgChangeEvent(oEvent, event, editItem->part(), true);
- }
-#endif
- editItem = 0;
- editCol = -1;
- return;
- }
- else if (id == L_META) {
- Event oEvent = editItem->event();
-//TD EditMetaDialog dl(editItem->tick(), oEvent, list->viewport());
-// int rv = dl.exec();
-// if (rv == QDialog::Accepted) {
-// Event event = dl.event();
-// audio->msgChangeEvent(oEvent, event, editItem->part(), true);
-// }
- editItem = 0;
- editCol = -1;
- return;
- }
- else if (id == L_CTRL) {
- ListCtrl ctrl(editItem->tick(), editItem->lli()->track(),
- editItem->lli()->ctrl(), editItem->val());
+ list = new QTreeWidget;
+ list->setColumnCount(1);
+ list->setSelectionMode(QAbstractItemView::SingleSelection);
+ list->setRootIsDecorated(true);
+ list->setColumnCount(1);
+ list->setHeaderLabels(QStringList("Element"));
+ list->setSortingEnabled(false);
+ list->setUniformRowHeights(true);
+ split->addWidget(list);
- EditCtrlDialog dl(&ctrl, list->viewport());
+ stack = new QStackedWidget;
+ split->addWidget(stack);
+
+ ctrlPanel = new CtrlListEditor;
+ stack->addWidget(ctrlPanel);
- int rv = dl.exec();
- if (rv == QDialog::Accepted) {
- song->addControllerVal(ctrl.track, ctrl.id, ctrl.tick, ctrl.val);
- }
- editItem = 0;
- editCol = -1;
- return;
- }
- else {
- textEditor->setText(i->text(col));
- textEditor->selectAll();
- curEditor = textEditor;
- }
- setEditorGeometry();
- curEditor->show();
- curEditor->setFocus();
+ connect(list, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+ SLOT(itemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
+ connect(list, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*)));
+ connect(list, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*)));
+ list->resizeColumnToContents(0);
+ resize(900, 300);
}
//---------------------------------------------------------
-// setEditorGeometry
+// itemExpanded
//---------------------------------------------------------
-void ListEdit::setEditorGeometry()
+void ListEdit::itemExpanded(QTreeWidgetItem*)
{
- int x1 = 0;
- for (int i = 0; i < editCol; ++i)
- x1 += list->columnWidth(i);
- QRect r(list->itemRect(editItem));
- r.setX(x1);
- int w = list->columnWidth(editCol);
- int wHint = curEditor->sizeHint().width();
- if (wHint > w)
- w = curEditor->sizeHint().width();
- r.setWidth(w);
- curEditor->setGeometry(r);
+ list->resizeColumnToContents(0);
}
//---------------------------------------------------------
-// returnPressed
+// itemChanged
//---------------------------------------------------------
-void ListEdit::returnPressed()
+void ListEdit::itemChanged(QTreeWidgetItem* i, QTreeWidgetItem*)
{
- if (editItem == 0)
+ if (i == 0)
return;
- switch(editItem->rtti()) {
- case L_TIMESIG:
- if (editCol == 3) {
- Awl::Sig newSig = sigEditor->sig();
- int tick = editItem->tick();
- song->startUndo();
- audio->msgAddSig(tick, newSig.z, newSig.n, false);
- song->endUndo(SC_SIG);
- }
- break;
- case L_TEMPOSIG:
- if (editCol == 3) {
- QString input = textEditor->text();
- const AL::TEvent* t = editItem->tempo();
- unsigned tick = t->tick;
- bool conversionOK;
- double dbl_input = input.toDouble(&conversionOK);
- if (conversionOK && dbl_input < 250.0) {
- int tempo = lrint((1000000.0 * 60.0)/dbl_input);
- song->startUndo();
- audio->msgAddTempo(tick, tempo, false);
- song->endUndo(SC_TEMPO);
- }
- else {
- QMessageBox::warning(this, tr("MusE: List Editor"),
- tr("Input error, conversion not OK or value out of range"),
- QMessageBox::Ok, QMessageBox::NoButton
- );
- }
- }
- break;
- case L_NOTES:
- {
- }
- break;
- case L_CTRL:
+ QWidget* ew = ctrlPanel;
+#if 0
+ Element* el = ((ElementItem*)i)->element();
+ setWindowTitle(QString("MuseScore: List Edit: ") + el->name());
+ ShowElementBase* ew = 0;
+ switch (el->type()) {
+ case PAGE: ew = pagePanel; break;
+ case SYSTEM: ew = systemPanel; break;
+ case MEASURE: ew = measurePanel; break;
+ case CHORD: ew = chordPanel; break;
+ case NOTE: ew = notePanel; break;
+ case REST: ew = restPanel; break;
+ case CLEF: ew = clefPanel; break;
+ case TIMESIG: ew = timesigPanel; break;
+ case KEYSIG: ew = keysigPanel; break;
+ case SEGMENT: ew = segmentView; break;
+ case HAIRPIN: ew = hairpinView; break;
+ case BAR_LINE: ew = barLineView; break;
+ case FINGERING:
+ case TEXT:
+ ew = textView;
+ break;
+ case ACCIDENTAL:
+ default:
+ ew = elementView;
break;
}
- escapePressed();
- }
-
-//---------------------------------------------------------
-// escapePressed
-//---------------------------------------------------------
-
-void ListEdit::escapePressed()
- {
- if (editItem == 0)
- return;
- curEditor->hide();
- curEditor = 0;
- list->setFocus();
- editItem = 0;
- editCol = -1;
- }
-
-//---------------------------------------------------------
-// colResized
-//---------------------------------------------------------
-
-void ListEdit::colResized()
- {
- if (curEditor)
- setEditorGeometry();
- }
-
-//---------------------------------------------------------
-// readStatus
-//---------------------------------------------------------
-
-void ListEdit::readStatus(QDomNode node)
- {
- Q3ListViewItemIterator i(lists);
-
- while (!node.isNull()) {
- QDomElement e = node.toElement();
- QString tag(e.tagName());
- QString s(e.text());
- if (tag == "geometry") {
- QRect r = AL::readGeometry(node);
- setGeometry(r);
- }
- else if (tag == "midiNumberBase") {
- int base = s.toInt();
- if (base == 16)
- showHex = true;
- menuView->setItemChecked(CMD_SET_HEX, showHex);
- menuView->setItemChecked(CMD_SET_DEC, !showHex);
- }
- else if (tag == "splitter")
- ; // TD splitter->readStatus(node.firstChild());
- else if (tag == "list") {
- QString name(e.attribute("name"));
-
- if (i.current()) {
- if (i.current()->text(0) == name) {
- int open = e.attribute("open","-1").toInt();
- int checked = e.attribute("checked","-1").toInt();
- if (open == 1)
- i.current()->setOpen(true);
- else if (checked == 1)
- ((Q3CheckListItem*)(i.current()))->setOn(true);
- }
- else
- printf("ListEdit::readStatus(): name mismatch <%s><%s>\n",
- i.current()->text(0).latin1(), s.latin1());
- ++i;
- }
- else {
- printf("ListEdit::readStatus(): list too long\n");
- }
- }
- else
- printf("MusE:List::Edit::readStatus(): unknown tag %s\n", e.tagName().latin1());
- node = node.nextSibling();
- }
- }
-
-//---------------------------------------------------------
-// writeStatus
-//---------------------------------------------------------
-
-void ListEdit::writeStatus(Xml& xml) const
- {
- xml.tag("listeditor");
- xml.geometryTag("geometry", this);
- xml.intTag("midiNumberBase", showHex ? 16 : 10);
-//TD splitter->writeStatus(xml);
-
- Q3ListViewItemIterator i(lists);
- for (; i.current(); ++i) {
- Q3ListViewItem* item = i.current();
- int id = item->rtti();
- if (id < 1000)
- xml.tagE("list name=\"%s\" open=\"%d\"",
- item->text(0).latin1(), item->isOpen());
- else {
- LLItem* ci = (LLItem*)item;
- xml.tagE("list name=\"%s\" checked=\"%d\"",
- item->text(0).latin1(), ci->isOn());
- }
- }
- xml.etag("listeditor");
- }
-
-//---------------------------------------------------------
-// cmd
-//---------------------------------------------------------
-
-void ListEdit::cmd(int cmd)
- {
- switch (cmd) {
- case CMD_SET_HEX:
- showHex = true;
- menuView->setItemChecked(CMD_SET_HEX, true);
- menuView->setItemChecked(CMD_SET_DEC, false);
- updateList();
- break;
-
- case CMD_SET_DEC:
- showHex = false;
- menuView->setItemChecked(CMD_SET_HEX, false);
- menuView->setItemChecked(CMD_SET_DEC, true);
- updateList();
- break;
-
- case CMD_DELETE:
- {
- Q3ListViewItem* l = list->selectedItem();
- if (!l)
- return;
- LItem* li = (LItem*)l;
- switch(li->rtti()) {
- case L_TIMESIG:
- break;
- case L_TEMPOSIG:
- break;
- case L_NOTES:
- case L_SYSEX:
- case L_PAFTER:
- case L_CAFTER:
- case L_META:
- audio->msgDeleteEvent(li->event(), li->part(), true);
- break;
- case L_CTRL:
- song->removeControllerVal(li->lli()->track(),
- li->lli()->ctrl(), li->tick());
- break;
- }
- break;
- }
- case CMD_INSERT_TEMPO:
- break;
- case CMD_INSERT_SIG:
- break;
- case CMD_INSERT_NOTE:
- {
- if (curPart == 0) {
- printf("first select part\n");
- break;
- }
-//TD Event event = EditNoteDialog::getEvent(0, Event(), this);
-// if (!event.empty())
-// audio->msgAddEvent(event, curPart);
- }
- break;
- case CMD_INSERT_SYSEX:
- {
- if (curPart == 0) {
- printf("first select part\n");
- break;
- }
-#if 0 // TODO3
- MidiTrack* track = (MidiTrack*)(curPart->track());
- MidiPort* mp = &midiPorts[track->outPort()];
- MidiInstrument* mi = mp->instrument();
- Event event = EditSysexDialog::getEvent(0, mi, Event(), this);
- if (!event.empty())
- audio->msgAddEvent(event, curPart);
+ ew->setElement(el);
#endif
- }
- break;
- case CMD_INSERT_PAFTER:
- case CMD_INSERT_CAFTER:
- case CMD_INSERT_META:
- case CMD_INSERT_CTRL:
- {
-// ListCtrl ctrl(0, 0, 0, 0, 0);
-// if (EditCtrlDialog::editCtrl(&ctrl, this)) {
-// printf("ADD CONTROLLER\n");
-// }
- }
- break;
- }
- }
-
-//---------------------------------------------------------
-// listSelectionChanged
-//---------------------------------------------------------
-
-void ListEdit::listSelectionChanged()
- {
- Q3ListViewItem* item = list->selectedItem();
- if (item == 0 || item->rtti() < 1000) {
- curPartChanged(0);
- return;
- }
- menuEdit->setItemEnabled(CMD_DELETE, true);
- LItem* i = (LItem*)item;
- switch(item->rtti()) {
- case L_NOTES:
- case L_SYSEX:
- case L_PAFTER:
- case L_CAFTER:
- case L_META:
- curPartChanged((MidiPart*)(i->part()));
- break;
- case L_TIMESIG:
- case L_TEMPOSIG:
- case L_CTRL:
- curPartChanged(0);
- break;
- }
+ stack->setCurrentWidget(ew);
}
//---------------------------------------------------------
-// songChanged
+// buildList
//---------------------------------------------------------
-void ListEdit::songChanged(int flags)
+void ListEdit::buildList()
{
- if (flags & (SC_EVENT_INSERTED | SC_EVENT_REMOVED | SC_EVENT_MODIFIED | SC_SIG | SC_TEMPO)) {
- updateList();
- }
- }
-
-//---------------------------------------------------------
-// EditCtrlDialog
-// PosEdit* timePos;
-// QSlider* valSlider;
-// QSpinBox* valSpinBox;
-// QLabel* controllerName;
-// QListBox* ctrlList;
-// QPushButton* buttonNewController;
-//---------------------------------------------------------
-
-EditCtrlDialog::EditCtrlDialog(ListCtrl* c, QWidget* parent)
-// : EditCtrlBase(parent)
- : QDialog(parent)
- {
-#if 0
- ctrl = c;
-
- pop = new Q3PopupMenu(this);
- pop->setCheckable(false);
-
- bool isDrum = false;
- if (c->track->type() == Track::MIDI_CHANNEL)
- isDrum = ((MidiChannel*)c->track)->useDrumMap();
-
- if (c->track->isMidiTrack()) {
-//TODO3 midiPort->setValue(((MidiTrack*)ctrl->track)->outPort() + 1);
-//TODO3 midiChannel->setValue(((MidiTrack*)ctrl->track)->outChannel() + 1);
- }
- else {
- midiPort->setEnabled(false);
- midiChannel->setEnabled(false);
- }
-
- ctrlList->clear();
- ctrlList->setSelectionMode(Q3ListBox::Single);
-
- //
- // populate list of available controller
- //
-
- ControllerNameList* cnl = ctrl->track->controllerNames();
-
+ list->clear();
+ TrackList* tl = song->tracks();
int idx = 0;
- for (iControllerName i = cnl->begin(); i != cnl->end(); ++i, ++idx) {
- int num = i->id;
- // dont show drum specific controller if not a drum track
- if ((num & 0xff) == 0xff) {
- if (!isDrum)
- continue;
- }
- ctrlList->insertItem(i->name);
- if (num == ctrl->id)
- ctrlList->setSelected(idx, true);
- }
-
- Ctrl* ct = ctrl->track->getController(ctrl->id);
- valSlider->setRange(ct->minVal().i, ct->maxVal().i);
- valSpinBox->setRange(ct->minVal().i, ct->maxVal().i);
- controllerName->setText(ct->name());
-
- connect(ctrlList, SIGNAL(clicked(Q3ListBoxItem*)), SLOT(ctrlListClicked(Q3ListBoxItem*)));
-//TD connect(buttonNewController, SIGNAL(pressed()), SLOT(newController()));
-// connect(hbank, SIGNAL(valueChanged(int)), SLOT(programChanged()));
-// connect(lbank, SIGNAL(valueChanged(int)), SLOT(programChanged()));
-// connect(program, SIGNAL(valueChanged(int)), SLOT(programChanged()));
-// connect(patchName, SIGNAL(released()), SLOT(instrPopup()));
-
- ctrlListClicked(ctrlList->selectedItem());
-
- timePos->setValue(ctrl->tick);
- if (ctrl->id != CTRL_PROGRAM)
- valSlider->setValue(ctrl->val.i);
-#endif
- }
-
-//---------------------------------------------------------
-// newController
-//---------------------------------------------------------
-
-void EditCtrlDialog::newController()
- {
- if (!ctrl->track->isMidiTrack())
- return;
- Q3PopupMenu* pop = new Q3PopupMenu(this);
- pop->setCheckable(this);
- //
- // populate popup with all controllers available for
- // current instrument
- //
-#if 0 //TODO3
- int portn = ((MidiTrack*)ctrl->track)->outPort();
- MidiPort* port = &midiPorts[portn];
- MidiInstrument* instr = port->instrument();
- MidiControllerList* mcl = instr->controller();
- for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci)
- pop->insertItem((*ci)->name());
- int rv = pop->exec(buttonNewController->mapToGlobal(QPoint(0,0)));
- if (rv != -1) {
- QString s = pop->text(rv);
- for (iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) {
- if ((*ci)->name() == s) {
- for (int idx = 0; ;++idx) {
- QString str = ctrlList->text(idx);
- if (s == str)
- break;
- if (str.isNull()) {
- ctrlList->insertItem(s);
- break;
- }
- }
+ for (iTrack i = tl->begin(); i != tl->end(); ++i,++idx) {
+ Track* t = *i;
+ QTreeWidgetItem* item = new QTreeWidgetItem;
+ item->setText(0, t->name());
+ list->insertTopLevelItem(idx, item);
+ PartList* pl = t->parts();
+ if (!pl->empty()) {
+ QTreeWidgetItem* pitem = new QTreeWidgetItem(item);
+ pitem->setText(0, tr("Parts"));
+ for (iPart i = pl->begin(); i != pl->end(); ++i) {
+ QTreeWidgetItem* ppitem = new QTreeWidgetItem(pitem);
+ ppitem->setText(0, i->second->name());
}
}
- }
-#endif
- delete pop;
- }
-
-//---------------------------------------------------------
-// ctrlListClicked
-//---------------------------------------------------------
-
-void EditCtrlDialog::ctrlListClicked(Q3ListBoxItem* item)
- {
-#if 0 //TD
- if (item == 0)
- return;
- QString s(item->text());
-
- ControllerNameList* cnl = ctrl->track->controllerNames();
- for (iControllerName i = cnl->begin(); i != cnl->end(); ++i) {
- if (s != i->name)
- continue;
- int num = i->id;
- Ctrl* c = ctrl->track->getController(num);
-
- if (num == CTRL_PROGRAM) {
- widgetStack->raiseWidget(1);
- updatePatch();
- }
- else {
- widgetStack->raiseWidget(0);
- valSlider->setRange(c->minVal().i, c->maxVal().i);
- valSpinBox->setRange(c->minVal().i, c->maxVal().i);
- controllerName->setText(s);
- ctrl->val = c->getDefault();
- valSlider->setValue(ctrl->val.i);
- }
- break;
- }
-#endif
- }
-
-//---------------------------------------------------------
-// setPatch
-//---------------------------------------------------------
-
-void EditCtrlDialog::updatePatch()
- {
-#if 0 //TODO3
- int port = ((MidiTrack*)ctrl->track)->outPort();
- int channel = ((MidiTrack*)ctrl->track)->outChannel();
- MidiInstrument* instr = midiPorts[port].instrument();
- int val = ctrl->val.i;
- const char* name = instr->getPatchName(channel, val);
- patchName->setText(QString(name));
-
- int hb = ((val >> 16) & 0xff) + 1;
- if (hb == 0x100)
- hb = 0;
- int lb = ((val >> 8) & 0xff) + 1;
- if (lb == 0x100)
- lb = 0;
- int pr = (val & 0xff) + 1;
- if (pr == 0x100)
- pr = 0;
-
- hbank->blockSignals(true);
- lbank->blockSignals(true);
- program->blockSignals(true);
-
- hbank->setValue(hb);
- lbank->setValue(lb);
- program->setValue(pr);
-
- hbank->blockSignals(false);
- lbank->blockSignals(false);
- program->blockSignals(false);
-#endif
- }
-
-//---------------------------------------------------------
-// instrPopup
-//---------------------------------------------------------
-
-void EditCtrlDialog::instrPopup()
- {
-#if 0 //TODO3
- int channel = ((MidiTrack*)ctrl->track)->outChannel();
- int port = ((MidiTrack*)ctrl->track)->outPort();
- MidiInstrument* instr = midiPorts[port].instrument();
- instr->populatePatchPopup(pop, channel);
-
- int rv = pop->exec(patchName->mapToGlobal(QPoint(10,5)));
- if (rv != -1) {
- ctrl->val.i = rv;
- updatePatch();
- }
-#endif
- }
-
-//---------------------------------------------------------
-// programChanged
-//---------------------------------------------------------
-
-void EditCtrlDialog::programChanged()
- {
-#if 0 //TD
- int hb = hbank->value();
- int lb = lbank->value();
- int prog = program->value();
-
- if (hb > 0 && hb < 129)
- hb -= 1;
- else
- hb = 0xff;
- if (lb > 0 && lb < 129)
- lb -= 1;
- else
- lb = 0xff;
- if (prog > 0 && prog < 129)
- prog -= 1;
- else
- prog = 0xff;
-
- ctrl->val.i = (hb << 16) + (lb << 8) + prog;
- updatePatch();
-#endif
- }
-
-//---------------------------------------------------------
-// trackAdded
-//---------------------------------------------------------
-
-void ListEdit::trackAdded(Track* track, int idx)
- {
- Q3ListViewItem* item;
- if (idx != 0) {
- Q3ListViewItem* item = lists->firstChild();
- int i = 1;
- while (item) {
- if (i == idx) {
- item = new Q3ListViewItem(lists, item);
- item->setText(0, track->name());
- break;
+ CtrlList* cl = t->controller();
+ if (!cl->empty()) {
+ QTreeWidgetItem* citem = new QTreeWidgetItem(item);
+ citem->setText(0, tr("Controller"));
+ for (iCtrl i = cl->begin(); i != cl->end(); ++i) {
+ QTreeWidgetItem* ccitem = new QTreeWidgetItem(citem);
+ ccitem->setText(0, i->second->name());
}
- item = item->nextSibling();
- ++i;
}
}
- else
- item = new Q3ListViewItem(lists, track->name());
- genListsTrack(track, item);
}
//---------------------------------------------------------
-// trackRemoved
+// selectItem
//---------------------------------------------------------
-void ListEdit::trackRemoved(Track* t)
+void ListEdit::selectItem(const AL::Pos&, Track* track, Ctrl*)
{
- Q3ListViewItemIterator i(lists);
- for (; i.current(); ++i) {
- int id = i.current()->rtti();
- if (id == 0 && t->name() == i.current()->text(0)) {
- delete i.current();
+ stack->setCurrentWidget(ctrlPanel);
+ buildList();
+ for (int i = 0;; ++i) {
+ QTreeWidgetItem* item = list->topLevelItem(i);
+ if (item == 0) {
+ printf("MusE::ListEdit: Element not found\n");
break;
}
- }
- updateList();
- }
-
-//---------------------------------------------------------
-// genListsTrack
-//---------------------------------------------------------
-
-void ListEdit::genListsTrack(Track* track, Q3ListViewItem* it)
- {
- LLItem* lit;
- ControllerNameList* cn = track->controllerNames();
- for (iControllerName i = cn->begin(); i != cn->end(); ++i) {
- lit = new LLItem(it, i->name, L_CTRL);
- lit->setTrack(track);
- lit->setCtrl(i->id);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- connect(track, SIGNAL(controllerChanged(int)), SLOT(updateList()));
- }
- PartList* pl = track->parts();
- for (iPart ip = pl->begin(); ip != pl->end(); ++ip) {
- Part* part = ip->second;
- LLItem* item = new LLItem(it, tr("Part") + part->name(), L_PART);
- item->setPart(part);
- if (track->isMidiTrack()) {
- lit = new LLItem(item, tr("Note On/Off"), L_NOTES);
- lit->setTrack(track);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- lit = new LLItem(item, tr("Aftertouch"), L_CAFTER);
- lit->setTrack(track);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- lit = new LLItem(item, tr("PolyAftertouch"), L_PAFTER);
- lit->setTrack(track);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- lit = new LLItem(item, tr("Sysex"), L_SYSEX);
- lit->setTrack(track);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- lit = new LLItem(item, tr("Meta"), L_META);
- lit->setTrack(track);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
- }
- else if (track->type() == Track::WAVE) {
- lit = new LLItem(item, tr("Waves"), L_WAVE);
- lit->setTrack(track);
- connect(lit, SIGNAL(clicked(LLItem*)), SLOT(updateList()));
+ if (item->text(0) == track->name()) {
+ list->setItemExpanded(item, true);
+ list->setCurrentItem(item);
+ list->scrollToItem(item);
+ break;
}
}
}
-//---------------------------------------------------------
-// curPartChanged
-//---------------------------------------------------------
-
-void ListEdit::curPartChanged(MidiPart* part)
- {
- curPart = part;
-
- if (curPart) {
- tb_p->setText(curPart->name());
- tb_t->setText(curPart->track()->name());
- }
- else {
- tb_p->setText("----");
- tb_t->setText("----");
- }
- }
-#endif
-
diff --git a/muse/muse/liste/listedit.h b/muse/muse/liste/listedit.h
index 912d2650..e44b3019 100644
--- a/muse/muse/liste/listedit.h
+++ b/muse/muse/liste/listedit.h
@@ -1,214 +1,55 @@
-//=========================================================
+//=============================================================================
// MusE
// Linux Music Editor
-// $Id: listedit.h,v 1.20 2005/11/04 12:03:47 wschweer Exp $
-// (C) Copyright 1999-2005 Werner Schweer (ws@seh.de)
-//=========================================================
-
-#ifndef __LIST_EDIT_H__
-#define __LIST_EDIT_H__
-
-#include "widgets/noteinfo.h"
-#include "al/pos.h"
-#include "event.h"
-#include "cobject.h"
-#include "ctrl.h"
-
-namespace Awl {
- class SigEdit;
- };
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#ifndef __LISTEDIT_H__
+#define __LISTEDIT_H__
namespace AL {
- class SigEvent;
- class TEvent;
+ class Pos;
};
-class Event;
-class MidiTrack;
-class PartList;
-class MidiPart;
-class MidiPart;
class Track;
-class EditorSettings;
class Ctrl;
-class Part;
-
-#if 0
-//---------------------------------------------------------
-// LLItem
-//---------------------------------------------------------
-
-class LLItem : public QObject, public Q3CheckListItem {
- Q_OBJECT
-
- int _rtti;
- Track* _track;
- Part* _part;
- int _ctrl;
-
- virtual void stateChange(bool) {
- emit clicked(this);
- }
- int width(const QFontMetrics&, const QListWidget*, int) const {
- return 155;
- }
-
- signals:
- void clicked(LLItem*);
-
- public:
- LLItem(QListWidgetItem* parent, const QString& text, int id)
- : QCheckListItem(parent, text, Q3CheckListItem::CheckBoxController)
- {
- _rtti = id;
- }
-
- LLItem(Q3ListView* parent, const QString& text, int id)
- : Q3CheckListItem(parent, text, Q3CheckListItem::CheckBoxController)
- {
- _rtti = id;
- }
- virtual int rtti() const { return _rtti; }
- void setTrack(Track* t) { _track = t; }
- Track* track() const { return _track; }
- void setPart(Part* p) { _part = p; }
- Part* part() const { return _part; }
- void setCtrl(int id) { _ctrl = id; }
- int ctrl() const { return _ctrl; }
- };
-
-//---------------------------------------------------------
-// LItem
-//---------------------------------------------------------
-
-class LItem : public Q3ListViewItem {
- bool zebra;
- int _rtti;
- Pos _pos;
- bool* showHex;
-
- AL::TEvent* _tempo;
- Event _event;
- Part* _part;
- AL::SigEvent* _sig;
- CVal _val;
- LLItem* _lli;
-
- virtual void paintCell(QPainter*, const QColorGroup&, int, int, int);
-
- public:
- LItem(Q3ListView* parent, int id, bool* shp)
- : Q3ListViewItem(parent) {
- showHex = shp;
- _rtti = id;
- zebra = false;
- }
- virtual int rtti() const { return _rtti; }
- virtual QString text(int col) const;
- void setPos(Pos p) { _pos = p; }
- unsigned tick() const { return _pos.tick(); }
- void setTempo(AL::TEvent* t) { _tempo = t; }
- AL::TEvent* tempo() const { return _tempo; }
- virtual int compare(Q3ListViewItem* i, int, bool) const {
- return _pos.tick() - ((LItem*)i)->_pos.tick();
- }
- void setEvent(Event ev) { _event = ev; }
- Event event() const { return _event; }
- void setVal(CVal v) { _val = v; }
- CVal val() const { return _val; }
- void setZebra(bool v) { zebra = v; }
- void setSigEvent(AL::SigEvent* e) { _sig = e; }
- AL::SigEvent* sigEvent() const { return _sig; }
- void setPart(Part* p) { _part = p; }
- Part* part() const { return _part; }
- void setLLi(LLItem* i) { _lli = i; }
- LLItem* lli() const { return _lli; }
- };
+class CtrlListEditor;
//---------------------------------------------------------
// ListEdit
//---------------------------------------------------------
-class ListEdit : public TopWin {
- Q_OBJECT
- Q3ListView* lists;
- Q3ListView* list;
- LItem* editItem;
- int editCol;
- QLineEdit* textEditor;
- Awl::SigEdit* sigEditor;
- Awl::PitchEdit* pitchEditor;
- Awl::PosEdit* posEditor;
- Q3PopupMenu* menuEdit;
- Q3PopupMenu* menuView;
- QLabel* tb_p; // current part
- QLabel* tb_t; // current track
-
- MidiPart* curPart;
- QSplitter* splitter;
-
- QToolBar* listTools;
- QWidget* curEditor;
- bool showHex; // show midi values in hex
-
- enum { CMD_DELETE, CMD_INSERT_SIG, CMD_INSERT_TEMPO, CMD_INSERT_NOTE, CMD_INSERT_SYSEX,
- CMD_INSERT_PAFTER, CMD_INSERT_CAFTER, CMD_INSERT_META,
- CMD_INSERT_CTRL, CMD_SET_DEC, CMD_SET_HEX
- };
-
- void setEditorGeometry();
- void genListsTrack(Track*, Q3ListViewItem*);
- void curPartChanged(MidiPart* part);
-
- private slots:
- void updateLists();
- void editColumn(Q3ListViewItem*, const QPoint&, int col);
- void returnPressed();
- void escapePressed();
- virtual void colResized();
- void cmd(int cmd);
- void listSelectionChanged();
- void updateList();
- void songChanged(int);
- void trackAdded(Track*, int idx);
- void trackRemoved(Track*);
-
- public:
- ListEdit(QWidget* parent, PartList*);
- ~ListEdit();
- virtual void readStatus(QDomNode);
- virtual void writeStatus(Xml&) const;
- };
-
-class ListCtrl;
-
-//---------------------------------------------------------
-// EditCtrlDialog
-//---------------------------------------------------------
-
-// class EditCtrlDialog : public EditCtrlBase {
-class EditCtrlDialog : public QDialog {
- Q_OBJECT
+class ListEdit : public QWidget {
+ Q_OBJECT;
- ListCtrl* ctrl;
- Q3PopupMenu* pop;
+ QStackedWidget* stack;
+ QTreeWidget* list;
+ CtrlListEditor* ctrlPanel;
- void updatePatch();
+ void buildList();
private slots:
- void ctrlListClicked(Q3ListBoxItem*);
- void newController();
- void programChanged();
- void instrPopup();
-
- protected:
- QGridLayout* layout;
-
+ void itemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
+ void itemExpanded(QTreeWidgetItem*);
public:
- EditCtrlDialog(ListCtrl*, QWidget* parent=0);
+ ListEdit(QWidget* parent = 0);
+ void selectItem(const AL::Pos&, Track*, Ctrl*);
};
#endif
-#endif
diff --git a/muse/muse/midi.cpp b/muse/muse/midi.cpp
index d1d391fc..79eff684 100644
--- a/muse/muse/midi.cpp
+++ b/muse/muse/midi.cpp
@@ -40,7 +40,6 @@
#include "midiplugin.h"
#include "midiinport.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "instruments/minstrument.h"
extern void dump(const unsigned char* p, int n);
@@ -210,10 +209,6 @@ void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* trac
int dataType = 0; // 0 : disabled, 0x20000 : rpn, 0x30000 : nrpn
int channel = 0;
- MidiChannel* mc = track->channel();
- if (mc)
- channel = mc->channelNo();
-
EventList mel;
int metaChannel = -1;
for (iMidiEvent i = el->begin(); i != el->end(); ++i) {
@@ -238,8 +233,8 @@ void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* trac
case ME_NOTEON:
e.setType(Note);
- if (mc && mc->useDrumMap()) {
- int instr = mc->drumMap()->inmap(ev.dataA());
+ if (track->useDrumMap()) {
+ int instr = track->drumMap()->inmap(ev.dataA());
e.setPitch(instr);
}
else
@@ -250,8 +245,8 @@ void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* trac
break;
case ME_NOTEOFF:
e.setType(Note);
- if (mc && mc->useDrumMap()) {
- int instr = mc->drumMap()->inmap(ev.dataA());
+ if (track->useDrumMap()) {
+ int instr = track->drumMap()->inmap(ev.dataA());
e.setPitch(instr);
}
else
@@ -574,18 +569,12 @@ void buildMidiEventList(EventList* del, const MidiEventList* el, MidiTrack* trac
val.i = ev.dataB();
bool found = false;
- for (iRoute i = track->outRoutes()->begin(); i != track->outRoutes()->end(); ++i) {
- MidiChannel* ch = (MidiChannel*)(i->track);
- Ctrl* c = ch->getController(id);
- if (c) {
- found = true;
- c->add(tick, val);
- }
- }
- if (!found) {
+ Ctrl* c = track->getController(id);
+ if (c)
+ c->add(tick, val);
+ else
// if no managed controller, store as event
del->add(ev);
- }
}
else
del->add(ev);
@@ -617,9 +606,9 @@ void Audio::initDevices()
mp->playMidiEvent(&ev);
}
}
- MidiChannelList* mcl = song->midiChannel();
- for (iMidiChannel i = mcl->begin(); i != mcl->end(); ++i) {
- MidiChannel* mc = *i;
+ MidiTrackList* mcl = song->midis();
+ for (iMidiTrack i = mcl->begin(); i != mcl->end(); ++i) {
+ MidiTrack* mc = *i;
if (mc->noInRoute())
continue;
if (mc->autoRead()) {
diff --git a/muse/muse/midichannel.cpp b/muse/muse/midichannel.cpp
deleted file mode 100644
index 044c8a0a..00000000
--- a/muse/muse/midichannel.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-//=============================================================================
-// MusE
-// Linux Music Editor
-// $Id:$
-//
-// Copyright (C) 2002-2006 by Werner Schweer and others
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//=============================================================================
-
-#include "song.h"
-#include "midictrl.h"
-#include "al/xml.h"
-#include "midiedit/drummap.h"
-#include "midichannel.h"
-#include "midioutport.h"
-#include "miditrack.h"
-#include "instruments/minstrument.h"
-
-//---------------------------------------------------------
-// MidiChannel
-//---------------------------------------------------------
-
-MidiChannel::MidiChannel(MidiOut* p, int ch)
- : MidiTrackBase()
- {
- _port = p;
- _channelNo = ch;
- _drumMap = 0;
- _useDrumMap = false;
- initMidiController();
-
- //
- // create minimum set of managed controllers
- // to make midi mixer operational
- //
- MidiInstrument* mi = port()->instrument();
- addMidiController(mi, CTRL_PROGRAM);
- addMidiController(mi, CTRL_VOLUME);
- addMidiController(mi, CTRL_PANPOT);
- addMidiController(mi, CTRL_REVERB_SEND);
- addMidiController(mi, CTRL_CHORUS_SEND);
- addMidiController(mi, CTRL_VARIATION_SEND);
-
- // TODO: setDefault Values
- }
-
-//---------------------------------------------------------
-// MidiChannel
-//---------------------------------------------------------
-
-MidiChannel::~MidiChannel()
- {
- }
-
-//---------------------------------------------------------
-// MidiChannel::write
-//---------------------------------------------------------
-
-void MidiChannel::write(Xml& xml) const
- {
- xml.tag("MidiChannel idx=\"%d\"", _channelNo);
- MidiTrackBase::writeProperties(xml);
- xml.intTag("useDrumMap", _useDrumMap);
- xml.etag("MidiChannel");
- }
-
-//---------------------------------------------------------
-// MidiChannel::read
-//---------------------------------------------------------
-
-void MidiChannel::read(QDomNode node)
- {
- QString drumMapName;
- while (!node.isNull()) {
- QDomElement e = node.toElement();
- QString tag(e.tagName());
- if (tag == "useDrumMap")
- _useDrumMap = e.text().toInt();
- else if (MidiTrackBase::readProperties(node))
- printf("MusE:MidiChannel: unknown tag %s\n", tag.toLatin1().data());
- node = node.nextSibling();
- }
- MidiOut* op = port();
- if (op) {
- MidiInstrument* mi = op->instrument();
- int val = ctrlVal(CTRL_PROGRAM).i;
- _drumMap = mi->getDrumMap(val);
- }
- }
-
-//---------------------------------------------------------
-// playMidiEvent
-//---------------------------------------------------------
-
-void MidiChannel::playMidiEvent(MidiEvent* ev)
- {
- if (ev->type() == ME_NOTEON) {
- _meter[0] += ev->dataB()/2;
- if (_meter[0] > 127.0f)
- _meter[0] = 127.0f;
- }
- ev->setChannel(_channelNo);
- _port->playMidiEvent(ev);
- }
-
-//---------------------------------------------------------
-// setUseDrumMap
-//---------------------------------------------------------
-
-void MidiChannel::setUseDrumMap(bool val)
- {
- if (_useDrumMap != val) {
- _useDrumMap = val;
- if (_useDrumMap) {
- int val = ctrlVal(CTRL_PROGRAM).i;
- MidiOut* op = port();
- MidiInstrument* mi = op->instrument();
- DrumMap* dm = mi->getDrumMap(val);
- if (dm == 0)
- dm = &gmDrumMap;
- _drumMap = dm;
- }
- else
- _drumMap = &noDrumMap;
- for (iRoute i = _inRoutes.begin(); i != _inRoutes.end(); ++i) {
- MidiTrack* mt = (MidiTrack*)(i->track);
- mt->changeDrumMap();
- }
- emit useDrumMapChanged(_useDrumMap);
- }
- }
-
-//---------------------------------------------------------
-// emitControllerChanged
-//---------------------------------------------------------
-
-void MidiChannel::emitControllerChanged(int id)
- {
- if (id == CTRL_PROGRAM && _useDrumMap) {
- int val = ctrlVal(id).i;
- MidiOut* op = port();
- MidiInstrument* mi = op->instrument();
- DrumMap* dm = mi->getDrumMap(val);
- if (dm == 0)
- dm = &gmDrumMap;
- if (dm != _drumMap) {
- _drumMap = dm;
- for (iRoute i = _inRoutes.begin(); i != _inRoutes.end(); ++i) {
- MidiTrack* mt = (MidiTrack*)(i->track);
- mt->changeDrumMap();
- }
- }
- }
- emit controllerChanged(id);
- }
-
-//---------------------------------------------------------
-// isMute
-//---------------------------------------------------------
-
-bool MidiChannel::isMute() const
- {
- if (_solo)
- return false;
- if (song->solo())
- return true;
- return _mute;
- }
-
-
diff --git a/muse/muse/midichannel.h b/muse/muse/midichannel.h
deleted file mode 100644
index 1ec0872f..00000000
--- a/muse/muse/midichannel.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//=============================================================================
-// MusE
-// Linux Music Editor
-// $Id:$
-//
-// Copyright (C) 2002-2006 by Werner Schweer and others
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//=============================================================================
-
-#ifndef __MIDICHANNEL_H__
-#define __MIDICHANNEL_H__
-
-#include "track.h"
-
-class MidiOut;
-
-//---------------------------------------------------------
-// MidiChannel
-//---------------------------------------------------------
-
-class MidiOutPort;
-
-class MidiChannel : public MidiTrackBase {
- Q_OBJECT
-
- DrumMap* _drumMap;
- bool _useDrumMap;
- MidiOut* _port;
- int _channelNo;
-
- void clearDevice();
-
- signals:
- void useDrumMapChanged(bool);
-
- public:
- MidiChannel(MidiOut*, int);
- ~MidiChannel();
- virtual TrackType type() const { return MIDI_CHANNEL; }
-
- MidiOut* port() const { return _port; }
- int channelNo() const { return _channelNo; }
-
- virtual void write(Xml&) const;
- virtual void read(QDomNode);
- virtual bool isMute() const;
- virtual Part* newPart(Part*, bool) { return 0; }
-
- bool guiVisible() const;
- bool hasGui() const;
-
- // void putEvent(const MidiEvent&);
- void playMidiEvent(MidiEvent* ev);
-
- bool useDrumMap() const { return _useDrumMap; }
- void setUseDrumMap(bool val);
- DrumMap* drumMap() const { return _drumMap; }
-
- virtual void emitControllerChanged(int id);
- };
-
-typedef QList<MidiChannel*> MidiChannelList;
-typedef MidiChannelList::iterator iMidiChannel;
-typedef MidiChannelList::const_iterator ciMidiChannel;
-
-#endif
-
diff --git a/muse/muse/midiedit/ctrledit.cpp b/muse/muse/midiedit/ctrledit.cpp
index 1c537162..d98c488a 100644
--- a/muse/muse/midiedit/ctrledit.cpp
+++ b/muse/muse/midiedit/ctrledit.cpp
@@ -27,7 +27,6 @@
#include "widgets/tools.h"
#include "miditrack.h"
#include "midioutport.h"
-#include "midichannel.h"
//---------------------------------------------------------
// CtrlEdit
@@ -36,7 +35,6 @@
CtrlEdit::CtrlEdit(QWidget* parent, TimeCanvas* timeCanvas, Track* t)
: QObject(parent), _track(t)
{
- _ctrlTrack = t;
y = 0;
_height = 0;
setDrawCtrlName(true);
@@ -76,30 +74,20 @@ void CtrlEdit::setCtrl(int id)
{
_ctrl = 0;
- if (_ctrlTrack->type() == Track::MIDI) {
- MidiTrack* mt = (MidiTrack*)_ctrlTrack;
+ if (_track->type() == Track::MIDI) {
if (id == CTRL_VELOCITY)
_ctrl = &veloList;
else if (id == CTRL_SVELOCITY)
_ctrl = &sveloList;
else
- _ctrl = _ctrlTrack->getController(id);
- if (!_ctrl) {
- MidiChannel* mc = mt->channel();
- if (mc) {
- _ctrl = mc->getController(id);
- if (!_ctrl) {
- _ctrl = mc->port()->track->getController(id);
- }
- }
- }
+ _ctrl = _track->getController(id);
}
else
- _ctrl = _ctrlTrack->getController(id);
+ _ctrl = _track->getController(id);
if (!_ctrl)
printf("CtrlEdit::setCtrl(%d): not found for track <%s>\n", id,
- _ctrlTrack->name().toLocal8Bit().data());
+ _track->name().toLocal8Bit().data());
}
//---------------------------------------------------------
@@ -115,7 +103,7 @@ void CtrlEdit::showControllerList()
else
id = CTRL_NO_CTRL;
for (;;) {
- CtrlDialog cd(_ctrlTrack, id);
+ CtrlDialog cd(_track, id);
int rv = cd.exec();
if (rv != 1)
return;
@@ -140,12 +128,10 @@ void CtrlEdit::changeController(int id)
if (id == CTRL_VELOCITY) {
ctrlId = id;
_ctrl = &veloList;
- _ctrlTrack = _track;
}
else if (id == CTRL_SVELOCITY) {
ctrlId = id;
_ctrl = &sveloList;
- _ctrlTrack = _track;
}
else if (id == CTRL_OTHER) { // "other"
if (track()->type() == Track::MIDI) {
@@ -159,13 +145,6 @@ void CtrlEdit::changeController(int id)
else {
ctrlId = id;
_ctrl = track()->getController(ctrlId);
- if (_ctrl == 0 && _track->type() == Track::MIDI) {
- MidiChannel* mc = ((MidiTrack*)_track)->channel();
- _ctrl = mc->getController(ctrlId);
- _ctrlTrack = mc;
- }
- else
- _ctrlTrack = _track;
}
_tc->updateCanvasB();
}
diff --git a/muse/muse/midiedit/ctrledit.h b/muse/muse/midiedit/ctrledit.h
index 9139a0c8..b05de053 100644
--- a/muse/muse/midiedit/ctrledit.h
+++ b/muse/muse/midiedit/ctrledit.h
@@ -35,7 +35,6 @@ class CtrlEdit : public QObject, public CtrlEditor {
Q_OBJECT
Track* const _track;
- Track* _ctrlTrack;
Ctrl* _ctrl;
TimeCanvas* _tc;
int _height;
@@ -43,7 +42,6 @@ class CtrlEdit : public QObject, public CtrlEditor {
virtual Ctrl* ctrl() const { return _ctrl; }
virtual TimeCanvas* tc() const { return _tc; }
virtual Track* track() const { return _track; }
- virtual Track* ctrlTrack() const { return _ctrlTrack; }
public:
int ctrlId;
diff --git a/muse/muse/midiedit/ecanvas.cpp b/muse/muse/midiedit/ecanvas.cpp
index a2917c8b..4c60a792 100644
--- a/muse/muse/midiedit/ecanvas.cpp
+++ b/muse/muse/midiedit/ecanvas.cpp
@@ -1103,7 +1103,7 @@ void EventCanvas::noteOn(int pitch, int velocity, bool shift)
{
DrumMap* dm = track()->drumMap();
if (!dm)
- pitch += track()->transposition;
+ pitch += track()->transposition();
// play note:
if (editor->playEvents()) {
@@ -1142,7 +1142,7 @@ void EventCanvas::noteOff(int pitch)
return;
DrumMap* dm = track()->drumMap();
if (!dm)
- pitch += track()->transposition;
+ pitch += track()->transposition();
// release key:
MidiEvent e(0, 0, ME_NOTEON, pitch, 0);
diff --git a/muse/muse/midiedit/prcanvas.cpp b/muse/muse/midiedit/prcanvas.cpp
index 9356abad..23d7545b 100644
--- a/muse/muse/midiedit/prcanvas.cpp
+++ b/muse/muse/midiedit/prcanvas.cpp
@@ -206,9 +206,9 @@ void PianoCanvas::moveItem(CItem* item, DragType dtype)
int npitch = y2pitch(item->my - wpos.y() + item->bbox.height()/2);
if (event.pitch() != npitch && editor->playEvents()) {
// release note:
- MidiEvent ev1(0, 0, 0x90, event.pitch() + track()->transposition, 0);
+ MidiEvent ev1(0, 0, 0x90, event.pitch() + track()->transposition(), 0);
track()->playMidiEvent(&ev1);
- MidiEvent ev2(0, 0, 0x90, npitch + track()->transposition, event.velo());
+ MidiEvent ev2(0, 0, 0x90, npitch + track()->transposition(), event.velo());
track()->playMidiEvent(&ev2);
}
@@ -613,7 +613,7 @@ void PianoCanvas::itemPressed(const CItem* item)
if (!editor->playEvents())
return;
Event event = item->event;
- playedPitch = event.pitch() + track()->transposition;
+ playedPitch = event.pitch() + track()->transposition();
int velo = event.velo();
// play note:
@@ -649,9 +649,9 @@ void PianoCanvas::itemMoved(const CItem* item)
MidiEvent ev1(0, 0, 0x90, playedPitch, 0);
track()->playMidiEvent(&ev1);
// play note:
- MidiEvent e2(0, 0, 0x90, npitch + track()->transposition, event.velo());
+ MidiEvent e2(0, 0, 0x90, npitch + track()->transposition(), event.velo());
track()->playMidiEvent(&e2);
- playedPitch = npitch + track()->transposition;
+ playedPitch = npitch + track()->transposition();
}
}
diff --git a/muse/muse/midiinport.cpp b/muse/muse/midiinport.cpp
index a63aaaa0..f340cb94 100644
--- a/muse/muse/midiinport.cpp
+++ b/muse/muse/midiinport.cpp
@@ -220,11 +220,12 @@ void MidiInPort::beforeProcess()
// called from jack process context
//---------------------------------------------------------
-void MidiInPort::getEvents(unsigned, unsigned, int /*ch*/, MidiEventList* dst)
+void MidiInPort::getEvents(unsigned, unsigned, int ch, MidiEventList* dst)
{
int tmpRecordRead = recordRead;
for (int i = 0; i < tmpRecordCount; ++i) {
- dst->insert(recordFifo[tmpRecordRead]);
+ if (ch == -1 || recordFifo[tmpRecordRead].channel() == ch)
+ dst->insert(recordFifo[tmpRecordRead]);
++tmpRecordRead;
if (tmpRecordRead >= RECORD_FIFO_SIZE)
tmpRecordRead = 0;
diff --git a/muse/muse/midiout.cpp b/muse/muse/midiout.cpp
index c07b2822..79928cb7 100644
--- a/muse/muse/midiout.cpp
+++ b/muse/muse/midiout.cpp
@@ -23,7 +23,6 @@
#include "track.h"
#include "al/tempo.h"
#include "event.h"
-#include "midichannel.h"
#include "sync.h"
#include "audio.h"
#include "gconfig.h"
@@ -199,6 +198,7 @@ void MidiOut::seek(unsigned tickPos, unsigned framePos)
// set all controller
//---------------------------------------------------
+#if 0
for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
MidiChannel* mc = channel(ch);
if (mc->mute() || mc->noInRoute() || !mc->autoRead())
@@ -212,6 +212,7 @@ void MidiOut::seek(unsigned tickPos, unsigned framePos)
}
}
}
+#endif
}
//---------------------------------------------------------
@@ -239,6 +240,7 @@ void MidiOut::stop()
// reset sustain
//---------------------------------------------------
+#if 0
for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
MidiChannel* mc = channel(ch);
if (mc->noInRoute())
@@ -249,6 +251,7 @@ void MidiOut::stop()
track->routeEvent(ev);
}
}
+#endif
if (track->sendSync()) {
if (genMMC) {
unsigned char mmcPos[] = {
@@ -315,14 +318,15 @@ void MidiOut::reset()
// process
// Collect all midi events for the current process cycle and put
// into _schedEvents queue. For note on events create the proper
-// note off events. The note off events maybe played after the
+// note off events. The note off events maybe played later after the
// current process cycle.
// From _schedEvents queue copy all events for the current cycle
// to all output routes. Events routed to ALSA go into the
// _playEvents queue which is processed by the MidiSeq thread.
//-------------------------------------------------------------------
-void MidiOut::processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick, unsigned /*fromFrame*/, unsigned /*toFrame*/)
+void MidiOut::processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
+ unsigned, unsigned)
{
while (!eventFifo.isEmpty())
el.insert(eventFifo.get());
@@ -343,46 +347,22 @@ void MidiOut::processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
}
}
}
- for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
- MidiChannel* mc = channel(ch);
-
- if (mc->mute() || mc->noInRoute())
+ foreach (const Route& r, *track->inRoutes()) {
+ MidiTrackBase* t = (MidiTrackBase*)r.src.track;
+ int dstChannel = r.dst.channel;
+ if (t->isMute())
continue;
- // collect channel controller
- if (fromTick != toTick) {
- CtrlList* cl = mc->controller();
- for (iCtrl ic = cl->begin(); ic != cl->end(); ++ic) {
- Ctrl* c = ic->second;
- iCtrlVal is = c->lowerBound(fromTick);
- iCtrlVal ie = c->lowerBound(toTick);
- for (; is != ie; ++is) {
- unsigned frame = AL::tempomap.tick2frame(is.key());
- Event ev(Controller);
- ev.setA(c->id());
- ev.setB(is.value().i);
- el.insert(MidiEvent(frame, ch, ev));
- }
- }
- }
-
- // Collect midievents from all input tracks for outport
- RouteList* rl = mc->inRoutes();
- for (iRoute i = rl->begin(); i != rl->end(); ++i) {
- MidiTrackBase* track = (MidiTrackBase*)i->track;
- if (track->isMute())
- continue;
- MidiEventList ell;
- track->getEvents(fromTick, toTick, 0, &ell);
- int velo = 0;
- for (iMidiEvent i = ell.begin(); i != ell.end(); ++i) {
- MidiEvent ev(*i);
- ev.setChannel(ch);
- el.insert(ev);
- if (ev.type() == ME_NOTEON)
- velo += ev.dataB();
- }
- mc->addMidiMeter(velo);
+ MidiEventList ell;
+ t->getEvents(fromTick, toTick, r.src.channel, &ell);
+ int velo = 0;
+ for (iMidiEvent i = ell.begin(); i != ell.end(); ++i) {
+ MidiEvent ev(*i);
+ ev.setChannel(dstChannel);
+ el.insert(ev);
+ if (ev.type() == ME_NOTEON)
+ velo += ev.dataB();
}
+ t->addMidiMeter(velo);
}
}
diff --git a/muse/muse/midiout.h b/muse/muse/midiout.h
index a76f3fe6..76835052 100644
--- a/muse/muse/midiout.h
+++ b/muse/muse/midiout.h
@@ -39,7 +39,6 @@ class MidiOut
public:
Track* track;
MidiInstrument* _instrument;
- MidiChannel* _channel[MIDI_CHANNELS];
MidiEventList _schedEvents; // scheduled events by process()
// fifo for midi events send from gui
@@ -49,7 +48,6 @@ class MidiOut
void processMidi(MidiEventList& el, unsigned fromTick, unsigned toTick,
unsigned fromFrame, unsigned toFrame);
- MidiChannel* channel(int n) { return _channel[n]; }
MidiInstrument* instrument() { return _instrument; }
void setInstrument(MidiInstrument* i) { _instrument = i; }
diff --git a/muse/muse/midioutport.cpp b/muse/muse/midioutport.cpp
index c3fc16fc..899dc70c 100644
--- a/muse/muse/midioutport.cpp
+++ b/muse/muse/midioutport.cpp
@@ -28,7 +28,6 @@
#include "driver/audiodev.h"
#include "audio.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "midiseq.h"
#include "sync.h"
#include "gconfig.h"
@@ -43,8 +42,8 @@ MidiOutPort::MidiOutPort()
{
track = this;
_instrument = genericMidiInstrument;
- for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
- _channel[ch] = new MidiChannel(this, ch);
+// for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
+// _channel[ch] = new MidiChannel(this, ch);
setDeviceId(127); // all
addMidiController(_instrument, CTRL_MASTER_VOLUME);
_channels = 1;
@@ -56,8 +55,8 @@ MidiOutPort::MidiOutPort()
MidiOutPort::~MidiOutPort()
{
- for (int ch = 0; ch < MIDI_CHANNEL; ++ch)
- delete _channel[ch];
+// for (int ch = 0; ch < MIDI_CHANNEL; ++ch)
+// delete _channel[ch];
}
//---------------------------------------------------------
@@ -71,8 +70,8 @@ void MidiOutPort::setName(const QString& s)
midiDriver->setPortName(alsaPort(), s);
if (!jackPort().isZero())
audioDriver->setPortName(jackPort(), s);
- for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
- _channel[ch]->setDefaultName();
+// for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
+// _channel[ch]->setDefaultName();
}
//---------------------------------------------------------
@@ -85,10 +84,10 @@ void MidiOutPort::write(Xml& xml) const
MidiTrackBase::writeProperties(xml);
if (_instrument)
xml.strTag("instrument", _instrument->iname());
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- if (!_channel[i]->noInRoute())
- _channel[i]->write(xml);
- }
+// for (int i = 0; i < MIDI_CHANNELS; ++i) {
+// if (!_channel[i]->noInRoute())
+// _channel[i]->write(xml);
+// }
xml.intTag("sendSync", sendSync());
xml.intTag("deviceId", deviceId());
xml.etag("MidiOutPort");
@@ -103,11 +102,11 @@ void MidiOutPort::read(QDomNode node)
for (; !node.isNull(); node = node.nextSibling()) {
QDomElement e = node.toElement();
QString tag(e.tagName());
- if (tag == "MidiChannel") {
- int idx = e.attribute("idx", "0").toInt();
- _channel[idx]->read(node.firstChild());
- }
- else if (tag == "instrument") {
+// if (tag == "MidiChannel") {
+// int idx = e.attribute("idx", "0").toInt();
+// _channel[idx]->read(node.firstChild());
+// }
+ if (tag == "instrument") {
QString iname = e.text();
_instrument = registerMidiInstrument(iname);
}
@@ -138,6 +137,7 @@ void MidiOutPort::routeEvent(const MidiEvent& event)
}
setHwCtrlState(a, b);
}
+#if 0
else {
MidiChannel* mc = channel(chn);
//
@@ -149,14 +149,15 @@ void MidiOutPort::routeEvent(const MidiEvent& event)
}
mc->setHwCtrlState(a, b);
}
+#endif
}
for (iRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r) {
- switch (r->type) {
- case Route::MIDIPORT:
+ switch (r->dst.type) {
+ case RouteNode::MIDIPORT:
queueAlsaEvent(event);
break;
- case Route::JACKMIDIPORT:
+ case RouteNode::JACKMIDIPORT:
queueJackEvent(event);
break;
default:
diff --git a/muse/muse/midisynti.cpp b/muse/muse/midisynti.cpp
index c74a2694..c542ebac 100644
--- a/muse/muse/midisynti.cpp
+++ b/muse/muse/midisynti.cpp
@@ -203,12 +203,11 @@ void MidiSynti::read(QDomNode node)
void MidiSynti::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
{
MidiEventList il;
- RouteList* rl = inRoutes();
- for (iRoute i = rl->begin(); i != rl->end(); ++i) {
- MidiTrackBase* track = (MidiTrackBase*)i->track;
+ foreach(const Route& r, *inRoutes()) {
+ MidiTrackBase* track = (MidiTrackBase*)r.src.track;
if (track->isMute())
continue;
- track->getEvents(from, to, i->channel, &il);
+ track->getEvents(from, to, r.src.channel, &il);
}
MidiEventList ol;
_synti->apply(from, to, &il, &ol);
diff --git a/muse/muse/miditrack.cpp b/muse/muse/miditrack.cpp
index 546173d0..43c627e1 100644
--- a/muse/muse/miditrack.cpp
+++ b/muse/muse/miditrack.cpp
@@ -27,7 +27,6 @@
#include "part.h"
#include "al/tempo.h"
#include "midiedit/drummap.h"
-#include "midichannel.h"
//---------------------------------------------------------
// MidiTrack
@@ -52,11 +51,11 @@ MidiTrack::~MidiTrack()
void MidiTrack::init()
{
- transposition = 0;
- velocity = 0;
- delay = 0;
- len = 100; // percent
- compression = 100; // percent
+ _transposition = 0;
+ _velocity = 0;
+ _delay = 0;
+ _len = 100; // percent
+ _compression = 100; // percent
}
//---------------------------------------------------------
@@ -85,11 +84,12 @@ void MidiTrack::write(Xml& xml) const
xml.tag("miditrack");
MidiTrackBase::writeProperties(xml);
- xml.intTag("transposition", transposition);
- xml.intTag("velocity", velocity);
- xml.intTag("delay", delay);
- xml.intTag("len", len);
- xml.intTag("compression", compression);
+ xml.intTag("transposition", _transposition);
+ xml.intTag("velocity", _velocity);
+ xml.intTag("delay", _delay);
+ xml.intTag("len", _len);
+ xml.intTag("compression", _compression);
+ xml.intTag("useDrumMap", _useDrumMap);
const PartList* pl = cparts();
for (ciPart p = pl->begin(); p != pl->end(); ++p)
@@ -109,15 +109,15 @@ void MidiTrack::read(QDomNode node)
QString s(e.text());
int i = s.toInt();
if (tag == "transposition")
- transposition = i;
+ _transposition = i;
else if (tag == "velocity")
- velocity = i;
+ _velocity = i;
else if (tag == "delay")
- delay = i;
+ _delay = i;
else if (tag == "len")
- len = i;
+ _len = i;
else if (tag == "compression")
- compression = i;
+ _compression = i;
else if (tag == "part") {
Part* p = newPart();
p->read(node);
@@ -125,31 +125,21 @@ void MidiTrack::read(QDomNode node)
}
else if (tag == "locked")
_locked = i;
+ else if (tag == "useDrumMap")
+ _useDrumMap = e.text().toInt();
else if (MidiTrackBase::readProperties(node))
printf("MusE:MidiTrack: unknown tag %s\n", e.tagName().toLatin1().data());
}
}
//---------------------------------------------------------
-// channel
-//---------------------------------------------------------
-
-MidiChannel* MidiTrack::channel() const
- {
- if (_outRoutes.empty())
- return 0;
- return (MidiChannel*)(_outRoutes.front().track);
- }
-
-//---------------------------------------------------------
// playMidiEvent
//---------------------------------------------------------
void MidiTrack::playMidiEvent(MidiEvent* ev)
{
- const RouteList* rl = &_outRoutes;
- for (ciRoute r = rl->begin(); r != rl->end(); ++r) {
- ((MidiChannel*)r->track)->playMidiEvent(ev);
+ foreach (const Route& r, _outRoutes) {
+ ((MidiOutPort*)r.dst.track)->playMidiEvent(ev);
}
}
@@ -432,23 +422,23 @@ void MidiTrack::clone(MidiTrack* t)
break;
}
setName(name);
- transposition = t->transposition;
- velocity = t->velocity;
- delay = t->delay;
- len = t->len;
- compression = t->compression;
- _recordFlag = t->_recordFlag;
- _mute = t->_mute;
- _solo = t->_solo;
- _off = t->_off;
- _monitor = t->_monitor;
- _channels = t->_channels;
- _locked = t->_locked;
- _inRoutes = t->_inRoutes;
- _outRoutes = t->_outRoutes;
- _controller = t->_controller;
- _autoRead = t->_autoRead;
- _autoWrite = t->_autoWrite;
+ _transposition = t->_transposition;
+ _velocity = t->_velocity;
+ _delay = t->_delay;
+ _len = t->_len;
+ _compression = t->_compression;
+ _recordFlag = t->_recordFlag;
+ _mute = t->_mute;
+ _solo = t->_solo;
+ _off = t->_off;
+ _monitor = t->_monitor;
+ _channels = t->_channels;
+ _locked = t->_locked;
+ _inRoutes = t->_inRoutes;
+ _outRoutes = t->_outRoutes;
+ _controller = t->_controller;
+ _autoRead = t->_autoRead;
+ _autoWrite = t->_autoWrite;
}
//---------------------------------------------------------
@@ -464,20 +454,7 @@ bool MidiTrack::isMute() const
return _mute;
}
-//---------------------------------------------------------
-// drumMap
-// return drum map for this track
-// return zero if no drum map is used
-//---------------------------------------------------------
-
-DrumMap* MidiTrack::drumMap() const
- {
- MidiChannel* mc = channel();
- if (mc && mc->useDrumMap())
- return mc->drumMap();
- return 0;
- }
-
+#if 0
//---------------------------------------------------------
// changeDrumMap
//---------------------------------------------------------
@@ -486,6 +463,7 @@ void MidiTrack::changeDrumMap() const
{
emit drumMapChanged();
}
+#endif
//---------------------------------------------------------
// getEvents
@@ -494,10 +472,6 @@ void MidiTrack::changeDrumMap() const
void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
{
- if (from > to) {
- printf("getEvents(): FATAL: cur > next %d > %d\n", from, to);
- return;
- }
//
// collect events only when transport is rolling
//
@@ -507,7 +481,7 @@ void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
if (part->mute())
continue;
DrumMap* dm = ((MidiTrack*)part->track())->drumMap();
- unsigned offset = delay + part->tick();
+ unsigned offset = _delay + part->tick();
if (offset > to)
break;
@@ -532,19 +506,19 @@ void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
// maybe we should skip next lines if using a
// drummap
- int pitch = ev.pitch() + transposition + song->globalPitchShift();
+ int pitch = ev.pitch() + _transposition + song->globalPitchShift();
if (pitch > 127)
pitch = 127;
if (pitch < 0)
pitch = 0;
int velo = ev.velo();
- velo += velocity;
- velo = (velo * compression) / 100;
+ velo += _velocity;
+ velo = (velo * _compression) / 100;
if (velo > 127)
velo = 127;
if (velo < 1) // no off event
velo = 1;
- int elen = (ev.lenTick() * len)/100;
+ int elen = (ev.lenTick() * _len)/100;
if (elen <= 0) // dont allow zero length
elen = 1;
int veloOff = ev.veloOff();
@@ -567,13 +541,12 @@ void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
// process input routing
//
- RouteList* rl = inRoutes();
- for (iRoute i = rl->begin(); i != rl->end(); ++i) {
- MidiTrackBase* track = (MidiTrackBase*)i->track;
+ foreach(const Route& r, *inRoutes()) {
+ MidiTrackBase* track = (MidiTrackBase*)r.src.track;
if (track->isMute())
continue;
MidiEventList el;
- track->getEvents(from, to, i->channel, &el);
+ track->getEvents(from, to, r.src.channel, &el);
for (iMidiEvent ie = el.begin(); ie != el.end(); ++ie) {
MidiEvent event(*ie);
@@ -587,15 +560,15 @@ void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
addMidiMeter(event.dataB());
if (monitor()) {
if (event.type() == ME_NOTEON) {
- int pitch = event.dataA() + transposition + song->globalPitchShift();
+ int pitch = event.dataA() + _transposition + song->globalPitchShift();
if (pitch > 127)
pitch = 127;
if (pitch < 0)
pitch = 0;
event.setA(pitch);
if (!event.isNoteOff()) {
- int velo = event.dataB() + velocity;
- velo = (velo * compression) / 100;
+ int velo = event.dataB() + _velocity;
+ velo = (velo * _compression) / 100;
if (velo > 127)
velo = 127;
if (velo < 1)
@@ -609,5 +582,99 @@ void MidiTrack::getEvents(unsigned from, unsigned to, int, MidiEventList* dst)
}
}
}
+ //
+ // collect controller
+ //
+ for (iCtrl ic = controller()->begin(); ic != controller()->end(); ++ic) {
+ Ctrl* c = ic->second;
+ iCtrlVal is = c->lowerBound(from);
+ iCtrlVal ie = c->lowerBound(to);
+ for (iCtrlVal ic = is; ic != ie; ++ic) {
+ unsigned frame = AL::tempomap.tick2frame(ic.key());
+ Event ev(Controller);
+ ev.setA(c->id());
+ ev.setB(ic.value().i);
+ dst->insert(MidiEvent(frame, -1, ev));
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// emitControllerChanged
+//---------------------------------------------------------
+
+void MidiTrack::emitControllerChanged(int id)
+ {
+ if (id == CTRL_PROGRAM && _useDrumMap) {
+ int val = ctrlVal(id).i;
+ MidiInstrument* mi = instrument();
+ DrumMap* dm = mi->getDrumMap(val);
+ if (dm == 0)
+ dm = &gmDrumMap;
+ if (dm != _drumMap)
+ _drumMap = dm;
+ emit drumMapChanged();
+ }
+ emit controllerChanged(id);
+ }
+
+//---------------------------------------------------------
+// setUseDrumMap
+//---------------------------------------------------------
+
+void MidiTrack::setUseDrumMap(bool val)
+ {
+ if (_useDrumMap != val) {
+ _useDrumMap = val;
+ if (_useDrumMap) {
+ MidiInstrument* mi = instrument();
+ DrumMap* dm;
+ if (mi) {
+ int val = ctrlVal(CTRL_PROGRAM).i;
+ dm = mi->getDrumMap(val);
+ if (dm == 0)
+ dm = &gmDrumMap;
+ }
+ _drumMap = dm;
+ }
+ else
+ _drumMap = &noDrumMap;
+ emit drumMapChanged();
+ emit useDrumMapChanged(_useDrumMap);
+ }
+ }
+
+
+//---------------------------------------------------------
+// instrument
+//---------------------------------------------------------
+
+MidiInstrument* MidiTrack::instrument() const
+ {
+ if (_outRoutes.isEmpty())
+ return genericMidiInstrument;
+ return ((MidiOutPort*)_outRoutes[0].dst.track)->instrument();
+ }
+
+//---------------------------------------------------------
+// channelNo
+//---------------------------------------------------------
+
+int MidiTrack::channelNo() const
+ {
+ if (_outRoutes.isEmpty())
+ return -1;
+ return _outRoutes[0].dst.channel;
+ }
+
+//---------------------------------------------------------
+// midiOut
+//---------------------------------------------------------
+
+MidiOut* MidiTrack::midiOut() const
+ {
+ if (_outRoutes.isEmpty())
+ return 0;
+ return (MidiOut*)_outRoutes[0].dst.track;
}
diff --git a/muse/muse/miditrack.h b/muse/muse/miditrack.h
index c7ecbc8b..3ee2a9bc 100644
--- a/muse/muse/miditrack.h
+++ b/muse/muse/miditrack.h
@@ -26,6 +26,7 @@
class Part;
class EventList;
+class MidiOut;
//---------------------------------------------------------
// MidiTrack
@@ -34,12 +35,12 @@ class EventList;
class MidiTrack : public MidiTrackBase {
Q_OBJECT
- EventList* _events; // tmp Events during midi import
+ EventList* _events; // tmp Events during midi import
// recording:
MidiFifo recordFifo; // for event transfer from RT-thread to gui thread
std::list<Event> keyDown; // keep track of "note on" events
- Part* recordPart; // part we are recording into
+ Part* recordPart; // part we are recording into
int recordedEvents;
bool partCreated;
int hbank, lbank;
@@ -47,27 +48,38 @@ class MidiTrack : public MidiTrackBase {
int rpnh, rpnl;
int dataType;
+ // channel data:
+ DrumMap* _drumMap;
+ bool _useDrumMap;
+
+ // play parameter
+ int _transposition;
+ int _velocity;
+ int _delay;
+ int _len;
+ int _compression;
+
signals:
void drumMapChanged() const;
+ void useDrumMapChanged(bool);
public:
MidiTrack();
virtual ~MidiTrack();
virtual TrackType type() const { return MIDI; }
-
void clone(MidiTrack*);
-
void init();
- MidiChannel* channel() const;
- void changeDrumMap() const;
-
- // play parameter
- int transposition;
- int velocity;
- int delay;
- int len;
- int compression;
+ int transposition() const { return _transposition; }
+ int velocity() const { return _velocity; }
+ int delay() const { return _delay; }
+ int len() const { return _len; }
+ int compression() const { return _compression; }
+ void setTransposition(int val) { _transposition = val; }
+ void setVelocity(int val) { _velocity = val; }
+ void setDelay(int val) { _delay = val; }
+ void setLen(int val) { _len = val; }
+ void setCompression(int val) { _compression = val; }
void startRecording();
void recordBeat();
@@ -85,8 +97,15 @@ class MidiTrack : public MidiTrackBase {
void playMidiEvent(MidiEvent*);
virtual void getEvents(unsigned from, unsigned to, int channel, MidiEventList* dst);
- bool useDrumMap() const;
- DrumMap* drumMap() const;
+
+ bool useDrumMap() const { return _useDrumMap; }
+ DrumMap* drumMap() const { return _drumMap; }
+ void setUseDrumMap(bool val);
+
+ int channelNo() const;
+ virtual void emitControllerChanged(int id);
+ MidiOut* midiOut() const;
+ MidiInstrument* instrument() const;
};
typedef QList<MidiTrack*> MidiTrackList;
diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp
index 5a29272d..a7ef5037 100644
--- a/muse/muse/mixer/astrip.cpp
+++ b/muse/muse/mixer/astrip.cpp
@@ -198,23 +198,15 @@ AudioStrip::AudioStrip(Mixer* m, AudioTrack* t, bool align)
rBox->addStretch(100);
}
else {
- iR = new QToolButton(this);
- iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
- iR->setText(tr("iR"));
- iR->setCheckable(false);
- iR->setToolTip(tr("input routing"));
+ iR = newInRouteButton();
rBox->addWidget(iR);
- connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
+ connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
+ connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
}
- oR = new QToolButton(this);
- oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
- oR->setText(tr("oR"));
- oR->setCheckable(false);
- oR->setToolTip(tr("output routing"));
+ oR = newOutRouteButton();
rBox->addWidget(oR);
- connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
+ connect(oR->menu(), SIGNAL(aboutToShow()), SLOT(oRouteShow()));
+ connect(oR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
layout->addLayout(rBox);
@@ -466,7 +458,7 @@ Awl::PanKnob* AudioStrip::addPanKnob(Awl::PanEntry** dlabel)
// addAuxPorts
//---------------------------------------------------------
-static void addAuxPorts(AudioTrack* track, QMenu* lb, RouteList* r)
+static void addAuxPorts(AudioTrack* track, QMenu* lb, const RouteList& rl)
{
QList<AuxPluginIF*> pre = track->preAux();
QList<AuxPluginIF*> post = track->postAux();
@@ -474,26 +466,18 @@ static void addAuxPorts(AudioTrack* track, QMenu* lb, RouteList* r)
QString s = p->pluginInstance()->name();
QAction* a = lb->addAction(p->pluginInstance()->name());
a->setCheckable(true);
- Route route(p);
+// Route route(RouteNode(p), RouteNode(track));
+ Route route = Route(RouteNode(p), RouteNode(track));
a->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- a->setChecked(true);
- break;
- }
- }
+ a->setChecked(rl.indexOf(route) != -1);
}
foreach(AuxPluginIF* p, post) {
QAction* a = lb->addAction(p->pluginInstance()->name());
a->setCheckable(true);
- Route route(p);
+// Route route(RouteNode(p), RouteNode(track)); // does not compile?!
+ Route route = Route(RouteNode(p), RouteNode(track));
a->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- a->setChecked(true);
- break;
- }
- }
+ a->setChecked(rl.indexOf(route) != -1);
}
}
@@ -501,8 +485,10 @@ static void addAuxPorts(AudioTrack* track, QMenu* lb, RouteList* r)
// addInPorts
//---------------------------------------------------------
-static void addInPorts(AudioTrack* t, QMenu* lb, RouteList* r, bool input)
+static void addInPorts(AudioTrack* t, QMenu* lb, const RouteList& rl, bool input)
{
+ RouteNode a(t);
+
InputList* al = song->inputs();
for (iAudioInput i = al->begin(); i != al->end(); ++i) {
AudioTrack* track = (AudioTrack*)*i;
@@ -510,17 +496,12 @@ static void addInPorts(AudioTrack* t, QMenu* lb, RouteList* r, bool input)
continue;
QAction* it = lb->addAction(track->name());
it->setCheckable(true);
- Route route(track);
+ RouteNode b(track);
+ Route route = input ? Route(b, a) : Route(a, b);
it->setData(QVariant::fromValue(route));
-
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
+ it->setChecked(rl.indexOf(route) != -1);
if (input)
- addAuxPorts(track, lb, r);
+ addAuxPorts(track, lb, rl);
}
}
@@ -528,7 +509,7 @@ static void addInPorts(AudioTrack* t, QMenu* lb, RouteList* r, bool input)
// addOutPorts
//---------------------------------------------------------
-static void addOutPorts(AudioTrack* t, QMenu* lb, RouteList* r)
+static void addOutPorts(AudioTrack* t, QMenu* lb, const RouteList& rl)
{
OutputList* al = song->outputs();
for (iAudioOutput i = al->begin(); i != al->end(); ++i) {
@@ -537,14 +518,9 @@ static void addOutPorts(AudioTrack* t, QMenu* lb, RouteList* r)
continue;
QAction* it = lb->addAction(track->name());
it->setCheckable(true);
- Route route(track);
+ Route route = Route(RouteNode(t), RouteNode(track));
it->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
+ it->setChecked(rl.indexOf(route) != -1);
}
}
@@ -552,7 +528,7 @@ static void addOutPorts(AudioTrack* t, QMenu* lb, RouteList* r)
// addGroupPorts
//---------------------------------------------------------
-static void addGroupPorts(AudioTrack* t, QMenu* lb, RouteList* r)
+static void addGroupPorts(AudioTrack* t, QMenu* lb, const RouteList& rl)
{
GroupList* al = song->groups();
for (iAudioGroup i = al->begin(); i != al->end(); ++i) {
@@ -561,14 +537,9 @@ static void addGroupPorts(AudioTrack* t, QMenu* lb, RouteList* r)
continue;
QAction* it = lb->addAction(track->name());
it->setCheckable(true);
- Route route(track);
+ Route route = Route(RouteNode(t), RouteNode(track));
it->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
+ it->setChecked(rl.indexOf(route) != -1);
}
}
@@ -576,8 +547,9 @@ static void addGroupPorts(AudioTrack* t, QMenu* lb, RouteList* r)
// addWavePorts
//---------------------------------------------------------
-static void addWavePorts(AudioTrack* t, QMenu* lb, RouteList* r, bool input)
+static void addWavePorts(AudioTrack* t, QMenu* lb, const RouteList& rl, bool input)
{
+ RouteNode a(t);
WaveTrackList* al = song->waves();
for (iWaveTrack i = al->begin(); i != al->end(); ++i) {
AudioTrack* track = (AudioTrack*)*i;
@@ -585,73 +557,20 @@ static void addWavePorts(AudioTrack* t, QMenu* lb, RouteList* r, bool input)
continue;
QAction* it = lb->addAction(track->name());
it->setCheckable(true);
- Route route(track);
+ RouteNode b(track);
+ Route route = input ? Route(b, a) : Route(a, b);
it->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
+ it->setChecked(rl.indexOf(route) != -1);
if (input)
- addAuxPorts(track, lb, r);
- }
- }
-
-//---------------------------------------------------------
-// addMidiOutPorts
-//---------------------------------------------------------
-#if 0
-static void addMidiOutPorts(Track* t, QMenu* lb, RouteList* r)
- {
- MidiOutPortList* al = song->midiOutPorts();
- for (iMidiOutPort i = al->begin(); i != al->end(); ++i) {
- Track* track = *i;
- if (t == track)
- continue;
- QAction* it = lb->addAction(track->name());
- it->setCheckable(true);
- Route route(track);
- it->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
+ addAuxPorts(track, lb, rl);
}
}
//---------------------------------------------------------
-// addMidiInPorts
-//---------------------------------------------------------
-
-static void addMidiInPorts(Track* t, QMenu* lb, RouteList* r)
- {
- MidiInPortList* al = song->midiInPorts();
- for (iMidiInPort i = al->begin(); i != al->end(); ++i) {
- Track* track = *i;
- if (t == track)
- continue;
- QAction* it = lb->addAction(track->name());
- it->setCheckable(true);
- Route route(track);
- it->setData(QVariant::fromValue(route));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
- }
- }
-#endif
-
-//---------------------------------------------------------
// addSyntiPorts
//---------------------------------------------------------
-static void addSyntiPorts(AudioTrack* t, QMenu* lb, RouteList* r)
+static void addSyntiPorts(AudioTrack* t, QMenu* lb, const RouteList& rl)
{
SynthIList* al = song->syntis();
for (iSynthI i = al->begin(); i != al->end(); ++i) {
@@ -660,27 +579,20 @@ static void addSyntiPorts(AudioTrack* t, QMenu* lb, RouteList* r)
continue;
QAction* it = lb->addAction(track->name());
it->setCheckable(true);
- Route route(track, -1, Route::TRACK);
+ Route route = Route(RouteNode(t), RouteNode(track));
it->setData(QVariant::fromValue(route));
-
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == route) {
- it->setChecked(true);
- break;
- }
- }
+ it->setChecked(rl.indexOf(route) != -1);
}
}
//---------------------------------------------------------
-// iRoutePressed
+// iRouteShow
//---------------------------------------------------------
-void AudioStrip::iRoutePressed()
+void AudioStrip::iRouteShow()
{
- QMenu pup(iR);
- pup.setSeparatorsCollapsible(false);
-
+ QMenu* pup = iR->menu();
+ pup->clear();
AudioTrack* t = (AudioTrack*)track;
RouteList* irl = t->inRoutes();
@@ -690,68 +602,46 @@ void AudioStrip::iRoutePressed()
case Track::AUDIO_INPUT:
{
for (int i = 0; i < channel; ++i) {
- char buffer[128];
- snprintf(buffer, 128, "%s %d", tr("Channel").toLatin1().data(), i+1);
- pup.addSeparator()->setText(QString(buffer));
+ pup->addSeparator()->setText(QString(tr("Channel %1")).arg(i+1));
QList<PortName> ol = audioDriver->outputPorts(false);
foreach (PortName ip, ol) {
- QAction* id = pup.addAction(ip.name);
+ QAction* id = pup->addAction(ip.name);
id->setCheckable(true);
- Route src(ip.port, i, Route::AUDIOPORT);
- id->setData(QVariant::fromValue(src));
- for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
- if (*ir == src) {
- id->setChecked(true);
- break;
- }
- }
+ RouteNode src(ip.port, i, RouteNode::AUDIOPORT);
+ RouteNode dst(t, i, RouteNode::TRACK);
+ Route route = Route(src, dst);
+ id->setData(QVariant::fromValue(route));
+ id->setChecked(irl->indexOf(route) != -1);
}
}
}
break;
case Track::AUDIO_OUTPUT:
- addWavePorts(t, &pup, irl, true);
- addInPorts(t, &pup, irl, true);
- addGroupPorts(t, &pup, irl);
- addSyntiPorts(t, &pup, irl);
+ addWavePorts(t, pup, *irl, true);
+ addInPorts(t, pup, *irl, true);
+ addGroupPorts(t, pup, *irl);
+ addSyntiPorts(t, pup, *irl);
break;
case Track::WAVE:
- addInPorts(t, &pup, irl, true);
+ addInPorts(t, pup, *irl, true);
break;
case Track::AUDIO_GROUP:
- addWavePorts(t, &pup, irl, true);
- addInPorts(t, &pup, irl, true);
- addGroupPorts(t, &pup, irl);
- addSyntiPorts(t, &pup, irl);
+ addWavePorts(t, pup, *irl, true);
+ addInPorts(t, pup, *irl, true);
+ addGroupPorts(t, pup, *irl);
+ addSyntiPorts(t, pup, *irl);
break;
}
- if (pup.isEmpty())
- return;
- QAction* n = pup.exec(QCursor::pos());
- if (n != 0) {
- Route srcRoute = n->data().value<Route>();
- Route dstRoute(t);
- dstRoute.channel = srcRoute.channel;
-
- if (track->type() == Track::AUDIO_INPUT)
- dstRoute.channel = srcRoute.channel;
- else if (track->type() == Track::AUDIO_SOFTSYNTH)
- dstRoute.type = Route::SYNTIPORT;
-
- audio->msgRoute(n->isChecked(), srcRoute, dstRoute);
- }
- iR->setDown(false); // pup.exec() catches mouse release event
}
//---------------------------------------------------------
-// oRoutePressed
+// oRouteShow
//---------------------------------------------------------
-void AudioStrip::oRoutePressed()
+void AudioStrip::oRouteShow()
{
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
-
+ QMenu* pup = oR->menu();
+ pup->clear();
AudioTrack* t = (AudioTrack*)track;
RouteList* orl = t->outRoutes();
@@ -763,42 +653,30 @@ void AudioStrip::oRoutePressed()
for (int i = 0; i < channel; ++i) {
char buffer[128];
snprintf(buffer, 128, "%s %d", tr("Channel").toLatin1().data(), i+1);
- pup.addSeparator()->setText(QString(buffer));
+ pup->addSeparator()->setText(QString(buffer));
QList<PortName> ol = audioDriver->inputPorts(false);
foreach (PortName ip, ol) {
- QAction* action = pup.addAction(ip.name);
+ QAction* action = pup->addAction(ip.name);
action->setCheckable(true);
- Route dst(ip.port, i, Route::AUDIOPORT);
- action->setData(QVariant::fromValue(dst));
- int idx = orl->indexOf(dst);
- action->setChecked(idx != -1);
+ RouteNode src(t);
+ RouteNode dst(ip.port, i, RouteNode::AUDIOPORT);
+ Route r = Route(src, dst);
+ action->setData(QVariant::fromValue(r));
+ action->setChecked(orl->indexOf(r) != -1);
}
}
}
break;
case Track::AUDIO_INPUT:
- addWavePorts(t, &pup, orl, false);
+ addWavePorts(t, pup, *orl, false);
case Track::WAVE:
case Track::AUDIO_GROUP:
case Track::AUDIO_SOFTSYNTH:
- addOutPorts(t, &pup, orl);
- addGroupPorts(t, &pup, orl);
+ addOutPorts(t, pup, *orl);
+ addGroupPorts(t, pup, *orl);
break;
}
- if (pup.isEmpty())
- return;
- QAction* n = pup.exec(QCursor::pos());
- if (n != 0) {
- QString s(n->text());
- Route srcRoute(t);
- Route dstRoute = n->data().value<Route>();
-
- if (track->type() == Track::AUDIO_OUTPUT)
- srcRoute.channel = dstRoute.channel;
- audio->msgRoute(n->isChecked(), srcRoute, dstRoute);
- }
- oR->setDown(false); // pup.exec() catches mouse release event
}
//---------------------------------------------------------
diff --git a/muse/muse/mixer/astrip.h b/muse/muse/mixer/astrip.h
index d69f8ac8..056e18ed 100644
--- a/muse/muse/mixer/astrip.h
+++ b/muse/muse/mixer/astrip.h
@@ -59,8 +59,8 @@ class AudioStrip : public Strip {
void stereoToggled(bool);
void preToggled(bool);
void offToggled(bool);
- void iRoutePressed();
- void oRoutePressed();
+ void iRouteShow();
+ void oRouteShow();
void volumeChanged(double);
void volumePressed();
void volumeReleased();
diff --git a/muse/muse/mixer/mixer.cpp b/muse/muse/mixer/mixer.cpp
index d22aa6da..70c9395f 100644
--- a/muse/muse/mixer/mixer.cpp
+++ b/muse/muse/mixer/mixer.cpp
@@ -15,7 +15,6 @@
#include "routedialog.h"
#include "synth.h"
#include "midiinport.h"
-#include "midichannel.h"
#include "midioutport.h"
extern void populateAddTrack(QMenu* addTrack);
@@ -45,7 +44,6 @@ Mixer::Mixer(QWidget* parent, MixerConfig* c)
showMidiTracksId = menuView->addAction(tr("Show Midi Tracks"));
showMidiOutPortId = menuView->addAction(tr("Show Midi Out Ports"));
showMidiInPortId = menuView->addAction(tr("Show Midi In Ports"));
- showMidiChannelId = menuView->addAction(tr("Show Midi Channels"));
menuView->addSeparator();
@@ -59,7 +57,6 @@ Mixer::Mixer(QWidget* parent, MixerConfig* c)
showMidiTracksId->setCheckable(true);
showMidiInPortId->setCheckable(true);
showMidiOutPortId->setCheckable(true);
- showMidiChannelId->setCheckable(true);
showWaveTracksId->setCheckable(true);
showOutputTracksId->setCheckable(true);
showGroupTracksId->setCheckable(true);
@@ -116,9 +113,6 @@ void Mixer::addStrip(Track* t, int idx)
case Track::MIDI_OUT:
strip = new MidiOutPortStrip(this, (MidiOutPort*)t, true);
break;
- case Track::MIDI_CHANNEL:
- strip = new MidiChannelStrip(this, (MidiChannel*)t, true);
- break;
case Track::MIDI:
strip = new MidiStrip(this, (MidiTrack*)t, true);
break;
@@ -159,7 +153,6 @@ void Mixer::updateMixer(int action)
showMidiTracksId->setChecked(cfg->showMidiTracks);
showMidiInPortId->setChecked(cfg->showMidiInPorts);
showMidiOutPortId->setChecked(cfg->showMidiOutPorts);
- showMidiChannelId->setChecked(cfg->showMidiChannels);
showWaveTracksId->setChecked(cfg->showWaveTracks);
showOutputTracksId->setChecked(cfg->showOutputTracks);
showGroupTracksId->setChecked(cfg->showGroupTracks);
@@ -179,10 +172,10 @@ void Mixer::updateMixer(int action)
stripList.erase(ssi);
}
int idx = stripList.size();
- setMaximumWidth(STRIP_WIDTH * idx);
+ setMaximumWidth(STRIP_WIDTH * idx + 4);
central->setFixedWidth(STRIP_WIDTH * idx);
if (idx < 4)
- setMinimumWidth(idx * STRIP_WIDTH);
+ setMinimumWidth(idx * STRIP_WIDTH + 4);
return;
}
@@ -241,17 +234,6 @@ void Mixer::updateMixer(int action)
addStrip(*i, idx++);
}
- if (cfg->showMidiChannels) {
- MidiChannelList* mpl = song->midiChannel();
- for (iMidiChannel i = mpl->begin(); i != mpl->end(); ++i) {
- MidiChannel* mc = *i;
- //
- // show only if used
- //
- if (!mc->noInRoute())
- addStrip(mc, idx++);
- }
- }
if (cfg->showMidiOutPorts) {
MidiOutPortList* mpl = song->midiOutPorts();
for (iMidiOutPort i = mpl->begin(); i != mpl->end(); ++i)
@@ -277,10 +259,10 @@ void Mixer::updateMixer(int action)
for (iAudioOutput i = otl->begin(); i != otl->end(); ++i)
addStrip(*i, idx++);
}
- setMaximumWidth(STRIP_WIDTH * idx);
+ setMaximumWidth(STRIP_WIDTH * idx + 4);
central->setFixedWidth(STRIP_WIDTH * idx);
if (idx < 4)
- setMinimumWidth(idx * STRIP_WIDTH);
+ setMinimumWidth(idx * STRIP_WIDTH + 4);
layout->update();
}
@@ -375,8 +357,6 @@ void Mixer::showTracksChanged(QAction* id)
cfg->showMidiInPorts = val;
else if (id == showMidiOutPortId)
cfg->showMidiOutPorts = val;
- else if (id == showMidiChannelId)
- cfg->showMidiChannels = val;
updateMixer(UPDATE_ALL);
}
@@ -396,7 +376,6 @@ void Mixer::write(Xml& xml, const char* name)
xml.intTag("showSyntiTracks", cfg->showSyntiTracks);
xml.intTag("showMidiInPorts", cfg->showMidiInPorts);
xml.intTag("showMidiOutPorts", cfg->showMidiOutPorts);
- xml.intTag("showMidiChannels", cfg->showMidiChannels);
xml.etag("%s", name);
}
diff --git a/muse/muse/mixer/mixer.h b/muse/muse/mixer/mixer.h
index df86dad5..f7bd17a7 100644
--- a/muse/muse/mixer/mixer.h
+++ b/muse/muse/mixer/mixer.h
@@ -41,7 +41,6 @@ class Mixer : public QMainWindow {
QAction* showMidiTracksId;
QAction* showMidiInPortId;
QAction* showMidiOutPortId;
- QAction* showMidiChannelId;
QAction* showOutputTracksId;
QAction* showWaveTracksId;
QAction* showGroupTracksId;
diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp
index 5fa413d4..5e728b75 100644
--- a/muse/muse/mixer/mstrip.cpp
+++ b/muse/muse/mixer/mstrip.cpp
@@ -20,7 +20,6 @@
#include "midiplugin.h"
#include "midiinport.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "awl/midimslider.h"
#include "awl/midimeter.h"
@@ -33,102 +32,110 @@ enum { KNOB_PAN, KNOB_CHOR_SEND, KNOB_VAR_SEND, KNOB_REV_SEND };
//---------------------------------------------------------
// addMidiTracks
+// input == true
+// add routes from all possible midi tracks to input
+// route list of track(channel)
+// input == false
+// add routes to all midi tracks to output route
+// list of track(channel)
+//
+// Note: midi tracks do not have channels
//---------------------------------------------------------
-static void addMidiTracks(QMenu* menu, RouteList* r)
+static void addMidiTracks(QMenu* menu, Track* track, int channel, bool input)
{
+ RouteList* rl = input ? track->inRoutes() : track->outRoutes();
+ RouteNode a(track, channel, RouteNode::TRACK);
+
MidiTrackList* tl = song->midis();
for (iMidiTrack i = tl->begin();i != tl->end(); ++i) {
MidiTrack* track = *i;
QAction* action = menu->addAction(track->name());
action->setCheckable(true);
- Route src(track);
- action->setData(QVariant::fromValue(src));
+ RouteNode b(track);
+ Route r = input ? Route(b, a) : Route(a, b);
+ action->setData(QVariant::fromValue(r));
+ action->setChecked(rl->indexOf(r) != -1);
+ }
+ }
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == src) {
- action->setChecked(true);
- break;
- }
+//---------------------------------------------------------
+// addMidiInPorts
+// can only be added to input route lists
+//---------------------------------------------------------
+
+static void addMidiInPorts(QMenu* menu, Track* dtrack, int channel)
+ {
+ RouteList* rl = dtrack->inRoutes();
+ RouteNode dst(dtrack, channel, RouteNode::TRACK);
+
+ MidiInPortList* tl = song->midiInPorts();
+ for (iMidiInPort i = tl->begin();i != tl->end(); ++i) {
+ MidiInPort* track = *i;
+ QMenu* m = menu->addMenu(track->name());
+ m->setSeparatorsCollapsible(false);
+ m->addSeparator()->setText(m->tr("Channels"));
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
+ a->setCheckable(true);
+ RouteNode src(track, ch, RouteNode::TRACK);
+ Route r = Route(src, dst);
+ a->setData(QVariant::fromValue(r));
+ a->setChecked(rl->indexOf(r) != -1);
}
}
}
//---------------------------------------------------------
// addMidiOutPorts
+// can only be added to output route lists
//---------------------------------------------------------
-static void addMidiOutPorts(QMenu* menu, RouteList* r)
+static void addMidiOutPorts(QMenu* menu, Track* strack, int channel)
{
+ RouteList* rl = strack->outRoutes();
+ RouteNode src(strack, channel, RouteNode::TRACK);
+
MidiOutPortList* tl = song->midiOutPorts();
for (iMidiOutPort i = tl->begin();i != tl->end(); ++i) {
MidiOutPort* op = *i;
QMenu* m = menu->addMenu(op->name());
m->setSeparatorsCollapsible(false);
m->addSeparator()->setText(m->tr("Channels"));
- for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
- MidiChannel* track = op->channel(channel);
- QAction* action = m->addAction(track->name());
- action->setCheckable(true);
- Route dst(track);
- action->setData(QVariant::fromValue(dst));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == dst) {
- action->setChecked(true);
- break;
- }
- }
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
+ a->setCheckable(true);
+ RouteNode dst(op, ch, RouteNode::TRACK);
+ Route r = Route(src, dst);
+ a->setData(QVariant::fromValue(r));
+ a->setChecked(rl->indexOf(r) != -1);
}
}
}
//---------------------------------------------------------
// addSyntiPorts
+// can only be added to output route lists
//---------------------------------------------------------
-static void addSyntiPorts(QMenu* menu, RouteList* r)
+static void addSyntiPorts(QMenu* menu, Track* strack, int channel)
{
+ RouteList* rl = strack->inRoutes();
+ RouteNode src(strack, channel, RouteNode::TRACK);
+
SynthIList* sl = song->syntis();
for (iSynthI i = sl->begin(); i != sl->end(); ++i) {
SynthI* sy = *i;
QMenu* m = menu->addMenu(sy->name());
m->setSeparatorsCollapsible(false);
m->addSeparator()->setText(m->tr("Channels"));
- for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
- MidiChannel* track = sy->channel(channel);
- QAction* action = m->addAction(track->name());
- action->setCheckable(true);
- Route dst(track);
- action->setData(QVariant::fromValue(dst));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == dst) {
- action->setChecked(true);
- break;
- }
- }
- }
- }
- }
-
-
-//---------------------------------------------------------
-// addMidiInPorts
-//---------------------------------------------------------
-
-static void addMidiInPorts(QMenu* menu, RouteList* r)
- {
- MidiInPortList* tl = song->midiInPorts();
- for (iMidiInPort i = tl->begin();i != tl->end(); ++i) {
- MidiInPort* track = *i;
- QAction* action = menu->addAction(track->name());
- action->setCheckable(true);
- Route src(track);
- action->setData(QVariant::fromValue(src));
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == src) {
- action->setChecked(true);
- break;
- }
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QAction* a = m->addAction(QString("Channel %1").arg(ch+1));
+ a->setCheckable(true);
+ RouteNode dst(sy, channel, RouteNode::TRACK);
+ Route r = Route(src, dst);
+ a->setData(QVariant::fromValue(r));
+ a->setChecked(rl->indexOf(r) != -1);
}
}
}
@@ -137,7 +144,7 @@ static void addMidiInPorts(QMenu* menu, RouteList* r)
// addKnob
//---------------------------------------------------------
-void MidiChannelStrip::addKnob(int ctrl, int idx, const QString& tt, const QString& label,
+void MidiStrip::addKnob(int ctrl, int idx, const QString& tt, const QString& label,
const char* slot, bool enabled)
{
Awl::FloatEntry* dl;
@@ -187,10 +194,10 @@ void MidiChannelStrip::addKnob(int ctrl, int idx, const QString& tt, const QStri
}
//---------------------------------------------------------
-// MidiChannelStrip
+// MidiStrip
//---------------------------------------------------------
-MidiChannelStrip::MidiChannelStrip(Mixer* m, MidiChannel* t, bool align)
+MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align)
: Strip(m, t, align)
{
volumeTouched = false;
@@ -233,8 +240,17 @@ MidiChannelStrip::MidiChannelStrip(Mixer* m, MidiChannel* t, bool align)
// mute, solo
//---------------------------------------------------
- if (_align)
- layout->addSpacing(STRIP_WIDTH/3);
+ SimpleButton* monitor = newMonitorButton();
+ monitor->setFixedSize(buttonSize);
+ monitor->setChecked(track->monitor());
+ connect(monitor, SIGNAL(clicked(bool)), SLOT(monitorToggled(bool)));
+ connect(t, SIGNAL(monitorChanged(bool)), monitor, SLOT(setChecked(bool)));
+
+ SimpleButton* record = newRecordButton();
+ record->setFixedSize(buttonSize);
+ record->setChecked(track->recordFlag());
+ connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
+ connect(t, SIGNAL(recordChanged(bool)), record, SLOT(setChecked(bool)));
mute = newMuteButton();
mute->setChecked(track->isMute());
@@ -246,11 +262,16 @@ MidiChannelStrip::MidiChannelStrip(Mixer* m, MidiChannel* t, bool align)
solo->setChecked(track->solo());
connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
+ QHBoxLayout* smBox1 = new QHBoxLayout(0);
QHBoxLayout* smBox2 = new QHBoxLayout(0);
+ smBox1->addWidget(monitor);
+ smBox1->addWidget(record);
+
smBox2->addWidget(mute);
smBox2->addWidget(solo);
+ layout->addLayout(smBox1);
layout->addLayout(smBox2);
//---------------------------------------------------
@@ -264,15 +285,16 @@ MidiChannelStrip::MidiChannelStrip(Mixer* m, MidiChannel* t, bool align)
//---------------------------------------------------
QHBoxLayout* rBox = new QHBoxLayout(0);
- iR = new QToolButton(this);
- iR->setCheckable(false);
- iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
- iR->setText(tr("iR"));
- iR->setToolTip(tr("input routing"));
+ iR = newInRouteButton();
rBox->addWidget(iR);
- connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
- rBox->addStretch(100);
+ connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
+ connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
+
+ oR = newOutRouteButton();
+ rBox->addWidget(oR);
+ connect(oR->menu(), SIGNAL(aboutToShow()), SLOT(oRouteShow()));
+ connect(oR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
+
layout->addLayout(rBox);
connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
@@ -289,7 +311,7 @@ MidiChannelStrip::MidiChannelStrip(Mixer* m, MidiChannel* t, bool align)
// songChanged
//---------------------------------------------------------
-void MidiChannelStrip::songChanged(int val)
+void MidiStrip::songChanged(int val)
{
if (val & SC_TRACK_MODIFIED)
updateLabel();
@@ -299,7 +321,7 @@ void MidiChannelStrip::songChanged(int val)
// heartBeat
//---------------------------------------------------------
-void MidiChannelStrip::heartBeat()
+void MidiStrip::heartBeat()
{
double a = track->meter(0); // fast_log10(track->meter(0)) * .2f;
slider->setMeterVal(a * 0.008);
@@ -310,7 +332,7 @@ void MidiChannelStrip::heartBeat()
// controllerChanged
//---------------------------------------------------------
-void MidiChannelStrip::controllerChanged(int id)
+void MidiStrip::controllerChanged(int id)
{
double val = double(track->ctrlVal(id).i);
@@ -348,7 +370,7 @@ void MidiChannelStrip::controllerChanged(int id)
// called when user changes controller
//---------------------------------------------------------
-void MidiChannelStrip::ctrlChanged(double val, int num)
+void MidiStrip::ctrlChanged(double val, int num)
{
int ival = int(val);
CVal cval;
@@ -360,7 +382,7 @@ void MidiChannelStrip::ctrlChanged(double val, int num)
// sliderPressed
//---------------------------------------------------------
-void MidiChannelStrip::sliderPressed(int id)
+void MidiStrip::sliderPressed(int id)
{
switch (id) {
case CTRL_VOLUME: volumeTouched = true; break;
@@ -376,7 +398,7 @@ void MidiChannelStrip::sliderPressed(int id)
// sliderReleased
//---------------------------------------------------------
-void MidiChannelStrip::sliderReleased(int id)
+void MidiStrip::sliderReleased(int id)
{
switch (id) {
case CTRL_VOLUME: volumeTouched = false; break;
@@ -392,7 +414,7 @@ void MidiChannelStrip::sliderReleased(int id)
// muteToggled
//---------------------------------------------------------
-void MidiChannelStrip::muteToggled(bool val)
+void MidiStrip::muteToggled(bool val)
{
song->setMute(track, val);
}
@@ -401,7 +423,7 @@ void MidiChannelStrip::muteToggled(bool val)
// soloToggled
//---------------------------------------------------------
-void MidiChannelStrip::soloToggled(bool val)
+void MidiStrip::soloToggled(bool val)
{
song->setSolo(track, val);
}
@@ -410,7 +432,7 @@ void MidiChannelStrip::soloToggled(bool val)
// autoChanged
//---------------------------------------------------------
-void MidiChannelStrip::autoChanged()
+void MidiStrip::autoChanged()
{
bool ar = track->autoRead();
bool aw = track->autoWrite();
@@ -432,7 +454,7 @@ void MidiChannelStrip::autoChanged()
// autoReadToggled
//---------------------------------------------------------
-void MidiChannelStrip::autoReadToggled(bool val)
+void MidiStrip::autoReadToggled(bool val)
{
song->setAutoRead(track, val);
}
@@ -441,172 +463,34 @@ void MidiChannelStrip::autoReadToggled(bool val)
// autoWriteToggled
//---------------------------------------------------------
-void MidiChannelStrip::autoWriteToggled(bool val)
+void MidiStrip::autoWriteToggled(bool val)
{
song->setAutoWrite(track, val);
}
//---------------------------------------------------------
-// iRoutePressed
-//---------------------------------------------------------
-
-void MidiChannelStrip::iRoutePressed()
- {
- QMenu pup(iR);
- pup.setSeparatorsCollapsible(false);
- pup.addSeparator()->setText(tr("Tracks"));
-
- MidiChannel* t = (MidiChannel*)track;
- RouteList* irl = t->inRoutes();
-
- addMidiTracks(&pup, irl); // add midi tracks to menu
- addMidiInPorts(&pup, irl); // add midi inputs to menu
-
- if (pup.isEmpty())
- return;
- QAction* n = pup.exec(QCursor::pos());
- if (n) {
- Route srcRoute = n->data().value<Route>();
- Route dstRoute(track);
- audio->msgRoute(n->isChecked(), srcRoute, dstRoute);
- }
- iR->setDown(false); // pup->exec() catches mouse release event
- }
-
-//---------------------------------------------------------
-// MidiStrip
-//---------------------------------------------------------
-
-MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align)
- : Strip(m, t, align)
- {
- if (_align)
- layout->addSpacing(STRIP_WIDTH/2 * 3);
-
- //---------------------------------------------------
- // slider, label, meter
- //---------------------------------------------------
-
- meter = new Awl::MidiMeter(this);
- meter->setId(CTRL_VOLUME);
- meter->setFixedWidth(40);
- layout->addWidget(meter, 100, Qt::AlignRight);
-
- if (_align)
- layout->addSpacing(LABEL_HEIGHT);
-
- //---------------------------------------------------
- // pan, balance
- //---------------------------------------------------
-
- if (_align)
- layout->addSpacing(STRIP_WIDTH/2 + 1);
-
- //---------------------------------------------------
- // mute, solo
- // or
- // record, mixdownfile
- //---------------------------------------------------
-
- SimpleButton* monitor = newMonitorButton();
- monitor->setFixedSize(buttonSize);
- monitor->setChecked(track->monitor());
- connect(monitor, SIGNAL(clicked(bool)), SLOT(monitorToggled(bool)));
- connect(t, SIGNAL(monitorChanged(bool)), monitor, SLOT(setChecked(bool)));
-
- SimpleButton* record = newRecordButton();
- record->setFixedSize(buttonSize);
- record->setChecked(track->recordFlag());
- connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
- connect(t, SIGNAL(recordChanged(bool)), record, SLOT(setChecked(bool)));
-
- mute = newMuteButton();
- mute->setChecked(track->isMute());
- mute->setFixedSize(buttonSize);
- connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
-
- solo = newSoloButton();
- solo->setFixedSize(buttonSize);
- solo->setChecked(track->solo());
- connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
-
- QHBoxLayout* smBox1 = new QHBoxLayout(0);
- QHBoxLayout* smBox2 = new QHBoxLayout(0);
-
- smBox2->addWidget(mute);
- smBox2->addWidget(solo);
-
- smBox1->addWidget(monitor);
- smBox1->addWidget(record);
- layout->addLayout(smBox1);
- layout->addLayout(smBox2);
-
- //---------------------------------------------------
- // automation mode
- //---------------------------------------------------
-
- if (_align)
- layout->addSpacing(STRIP_WIDTH/3);
-
- //---------------------------------------------------
- // routing
- //---------------------------------------------------
-
- QHBoxLayout* rBox = new QHBoxLayout(0);
- iR = new QToolButton(this);
- iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
- iR->setText(tr("iR"));
- iR->setCheckable(false);
- iR->setToolTip(tr("input routing"));
- rBox->addWidget(iR);
- connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
-
- oR = new QToolButton(this);
- oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
- oR->setText(tr("oR"));
- oR->setCheckable(false);
- oR->setToolTip(tr("output routing"));
- rBox->addWidget(oR);
- connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
-
- layout->addLayout(rBox);
-
- connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
- connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
- connect(track, SIGNAL(muteChanged(bool)), mute, SLOT(setChecked(bool)));
- connect(track, SIGNAL(soloChanged(bool)), solo, SLOT(setChecked(bool)));
- }
-
-//---------------------------------------------------------
-// songChanged
-//---------------------------------------------------------
-
-void MidiStrip::songChanged(int val)
- {
- if (val & SC_TRACK_MODIFIED)
- updateLabel();
- }
-
-//---------------------------------------------------------
-// heartBeat
+// iRouteShow
//---------------------------------------------------------
-void MidiStrip::heartBeat()
+void MidiStrip::iRouteShow()
{
- double a = track->meter(0); // fast_log10(track->meter(0)) * .2f;
- meter->setMeterVal(a * 0.008);
- track->setMeter(0, a * 0.8); // hack
+ QMenu* pup = iR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("Tracks"));
+ addMidiInPorts(pup, track, -1); // add midi inputs to menu
}
//---------------------------------------------------------
-// muteToggled
+// oRouteShow
//---------------------------------------------------------
-void MidiStrip::muteToggled(bool val)
+void MidiStrip::oRouteShow()
{
- song->setMute(track, val);
+ QMenu* pup = oR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("OutputPorts"));
+ addMidiOutPorts(pup, track, -1);
+ addSyntiPorts(pup, track, -1);
}
//---------------------------------------------------------
@@ -619,15 +503,6 @@ void MidiStrip::monitorToggled(bool val)
}
//---------------------------------------------------------
-// soloToggled
-//---------------------------------------------------------
-
-void MidiStrip::soloToggled(bool val)
- {
- song->setSolo(track, val);
- }
-
-//---------------------------------------------------------
// recordToggled
//---------------------------------------------------------
@@ -637,71 +512,6 @@ void MidiStrip::recordToggled(bool val)
}
//---------------------------------------------------------
-// iRoutePressed
-//---------------------------------------------------------
-
-void MidiStrip::iRoutePressed()
- {
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
- pup.addSeparator()->setText(tr("Input Ports"));
-
- MidiOutPort* t = (MidiOutPort*)track;
- RouteList* r = t->inRoutes();
-
- MidiInPortList* ipl = song->midiInPorts();
- for (iMidiInPort i = ipl->begin(); i != ipl->end(); ++i) {
- MidiInPort* track = *i;
- QAction* action = pup.addAction(track->name());
- action->setCheckable(true);
- Route src(track);
- action->setData(QVariant::fromValue(src));
-
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (*ir == src) {
- action->setChecked(true);
- break;
- }
- }
- }
- if (pup.isEmpty())
- return;
- QAction* n = pup.exec(QCursor::pos());
- if (n) {
- Route srcRoute = n->data().value<Route>();
- Route dstRoute(track);
- audio->msgRoute(n->isChecked(), srcRoute, dstRoute);
- }
- iR->setDown(false); // pup.exec() catches mouse release event
- }
-
-//---------------------------------------------------------
-// oRoutePressed
-//---------------------------------------------------------
-
-void MidiStrip::oRoutePressed()
- {
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
- pup.addSeparator()->setText(tr("OutputPorts"));
- RouteList* orl = track->outRoutes();
-
- addMidiOutPorts(&pup, orl);
- addSyntiPorts(&pup, orl);
-
- if (pup.isEmpty())
- return;
-
- QAction* n = pup.exec(QCursor::pos());
- if (n) {
- Route srcRoute(track);
- Route dstRoute = n->data().value<Route>();
- audio->msgRoute(n->isChecked(), srcRoute, dstRoute);
- }
- oR->setDown(false); // pup->exec() catches mouse release event
- }
-
-//---------------------------------------------------------
// MidiOutPortStrip
//---------------------------------------------------------
@@ -793,16 +603,16 @@ MidiOutPortStrip::MidiOutPortStrip(Mixer* m, MidiOutPort* t, bool align)
//---------------------------------------------------
QHBoxLayout* rBox = new QHBoxLayout(0);
- rBox->addStretch(100);
-
- oR = new QToolButton(this);
- oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
- oR->setText(tr("oR"));
- oR->setCheckable(false);
- oR->setToolTip(tr("output routing"));
+
+ iR = newInRouteButton();
+ rBox->addWidget(iR);
+ connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
+ connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
+
+ oR = newOutRouteButton();
rBox->addWidget(oR);
- connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
+ connect(oR->menu(), SIGNAL(aboutToShow()), SLOT(oRouteShow()));
+ connect(oR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
layout->addLayout(rBox);
@@ -941,14 +751,31 @@ void MidiOutPortStrip::controllerChanged(int id)
}
//---------------------------------------------------------
-// oRoutePressed
+// iRouteShow
//---------------------------------------------------------
-void MidiOutPortStrip::oRoutePressed()
+void MidiOutPortStrip::iRouteShow()
{
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
- pup.addSeparator()->setText(tr("MidiDevices"));
+ QMenu* pup = iR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("MidiChannel"));
+
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QMenu* m = pup->addMenu(QString("Channel %1").arg(ch+1));
+ addMidiTracks(m, track, ch, true);
+ addMidiInPorts(m, track, ch);
+ }
+ }
+
+//---------------------------------------------------------
+// oRouteShow
+//---------------------------------------------------------
+
+void MidiOutPortStrip::oRouteShow()
+ {
+ QMenu* pup = oR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("MidiDevices"));
RouteList* orl = track->outRoutes();
//
@@ -956,17 +783,12 @@ void MidiOutPortStrip::oRoutePressed()
//
QList<PortName> ol = midiDriver->outputPorts(true);
foreach (PortName ip, ol) {
- QAction* oa = pup.addAction(ip.name);
+ QAction* oa = pup->addAction(ip.name);
oa->setCheckable(true);
- Route dst(ip.port, Route::MIDIPORT);
- oa->setData(QVariant::fromValue(dst));
-
- for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
- if (*ir == dst) {
- oa->setChecked(true);
- break;
- }
- }
+ RouteNode dst(ip.port, RouteNode::MIDIPORT);
+ Route r = Route(RouteNode(track), dst);
+ oa->setData(QVariant::fromValue(r));
+ oa->setChecked(orl->indexOf(r) != -1);
}
//
@@ -974,27 +796,13 @@ void MidiOutPortStrip::oRoutePressed()
//
ol = audioDriver->inputPorts(true);
foreach (PortName ip, ol) {
- QAction* oa = pup.addAction(ip.name);
+ QAction* oa = pup->addAction(ip.name);
oa->setCheckable(true);
- Route dst(ip.port, Route::JACKMIDIPORT);
- oa->setData(QVariant::fromValue(dst));
-
- for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
- if (*ir == dst) {
- oa->setChecked(true);
- break;
- }
- }
- }
- if (pup.isEmpty())
- return;
- QAction* action = pup.exec(QCursor::pos());
- if (action) {
- Route dstRoute = action->data().value<Route>();
- Route srcRoute(track);
- audio->msgRoute(action->isChecked(), srcRoute, dstRoute);
+ RouteNode dst(ip.port, RouteNode::JACKMIDIPORT);
+ Route r = Route(RouteNode(track), dst);
+ oa->setData(QVariant::fromValue(r));
+ oa->setChecked(orl->indexOf(r) != -1);
}
- oR->setDown(false); // pup->exec() catches mouse release event
}
//---------------------------------------------------------
@@ -1073,27 +881,19 @@ MidiInPortStrip::MidiInPortStrip(Mixer* m, MidiInPort* t, bool align)
//---------------------------------------------------
if (_align)
- layout->addSpacing(STRIP_WIDTH/3); // automation line
+ layout->addSpacing(STRIP_WIDTH/3); // automation row
+
+ iR = newInRouteButton();
+ connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
+ connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
+
+ oR = newOutRouteButton();
+ connect(oR->menu(), SIGNAL(aboutToShow()), SLOT(oRouteShow()));
+ connect(oR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
QHBoxLayout* rBox = new QHBoxLayout(0);
- iR = new QToolButton(this);
- iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
- iR->setText(tr("iR"));
- iR->setCheckable(false);
- iR->setToolTip(tr("input routing"));
rBox->addWidget(iR);
- connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
-
- oR = new QToolButton(this);
- oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
- oR->setText(tr("oR"));
- oR->setCheckable(false);
- oR->setToolTip(tr("output routing"));
rBox->addWidget(oR);
- connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
-
layout->addLayout(rBox);
connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
@@ -1142,82 +942,56 @@ void MidiInPortStrip::soloToggled(bool val)
}
//---------------------------------------------------------
-// oRoutePressed
-//---------------------------------------------------------
-
-void MidiInPortStrip::oRoutePressed()
- {
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
-
- RouteList* orl = track->outRoutes();
-
- addMidiTracks(&pup, orl);
- addSyntiPorts(&pup, orl);
- addMidiOutPorts(&pup, orl);
-
- if (pup.isEmpty())
- return;
- QAction* action = pup.exec(QCursor::pos());
- if (action) {
- Route srcRoute(track);
- Route dstRoute = action->data().value<Route>();
- audio->msgRoute(action->isChecked(), srcRoute, dstRoute);
- }
- oR->setDown(false); // pup->exec() catches mouse release event
- }
-
-//---------------------------------------------------------
-// iRoutePressed
+// iRouteShow
//---------------------------------------------------------
-void MidiInPortStrip::iRoutePressed()
+void MidiInPortStrip::iRouteShow()
{
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
- pup.addSeparator()->setText(tr("AlsaDevices"));
+ QMenu* pup = iR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("AlsaDevices"));
RouteList* irl = track->inRoutes();
QList<PortName> ol = midiDriver->inputPorts(false);
foreach (PortName ip, ol) {
- QAction* action = pup.addAction(ip.name);
+ RouteNode src(ip.port, RouteNode::MIDIPORT);
+ Route r = Route(src, RouteNode(track));
+ QAction* action = pup->addAction(ip.name);
action->setCheckable(true);
- Route src(ip.port, Route::MIDIPORT);
- action->setData(QVariant::fromValue(src));
- for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
- if (*ir == src) {
- action->setChecked(true);
- break;
- }
- }
+ action->setData(QVariant::fromValue(r));
+ action->setChecked(irl->indexOf(r) != -1);
}
//
// add JACK midi ports to list
//
ol = audioDriver->outputPorts(true);
foreach (PortName ip, ol) {
- QAction* action = pup.addAction(ip.name);
+ QAction* action = pup->addAction(ip.name);
action->setCheckable(true);
- Route src(ip.port, Route::JACKMIDIPORT);
- action->setData(QVariant::fromValue(src));
-
- for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
- if (*ir == src) {
- action->setChecked(true);
- break;
- }
- }
+ RouteNode src(ip.port, RouteNode::JACKMIDIPORT);
+ Route r = Route(src, RouteNode(track));
+ action->setData(QVariant::fromValue(r));
+ action->setChecked(irl->indexOf(r) != -1);
}
- if (pup.isEmpty())
- return;
- QAction* action = pup.exec(QCursor::pos());
- if (action) {
- Route srcRoute = action->data().value<Route>();
- Route dstRoute(track, -1, Route::TRACK);
- audio->msgRoute(action->isChecked(), srcRoute, dstRoute);
+ }
+
+//---------------------------------------------------------
+// oRouteShow
+//---------------------------------------------------------
+
+void MidiInPortStrip::oRouteShow()
+ {
+ QMenu* pup = oR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("MidiChannel"));
+
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QMenu* m = pup->addMenu(QString("Channel %1").arg(ch+1));
+ addMidiTracks(m, track, ch, false);
+ addSyntiPorts(m, track, ch);
+ addMidiOutPorts(m, track, ch);
}
- iR->setDown(false); // pup->exec() catches mouse release event
}
//---------------------------------------------------------
@@ -1294,24 +1068,15 @@ MidiSyntiStrip::MidiSyntiStrip(Mixer* m, MidiSynti* t, bool align)
QHBoxLayout* rBox = new QHBoxLayout(0);
- iR = new QToolButton(this);
- iR->setFont(config.fonts[1]);
- iR->setFixedWidth((STRIP_WIDTH-4)/2);
- iR->setText(tr("iR"));
- iR->setCheckable(false);
- iR->setToolTip(tr("input routing"));
+ iR = newInRouteButton();
rBox->addWidget(iR);
- connect(iR, SIGNAL(pressed()), SLOT(iRoutePressed()));
+ connect(iR->menu(), SIGNAL(aboutToShow()), SLOT(iRouteShow()));
+ connect(iR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
- oR = new QToolButton(this);
- rBox->addWidget(oR);
- oR->setFont(config.fonts[1]);
- oR->setFixedWidth((STRIP_WIDTH-4)/2);
- oR->setText(tr("oR"));
- oR->setCheckable(false);
- oR->setToolTip(tr("output routing"));
+ oR = newOutRouteButton();
rBox->addWidget(oR);
- connect(oR, SIGNAL(pressed()), SLOT(oRoutePressed()));
+ connect(oR->menu(), SIGNAL(aboutToShow()), SLOT(oRouteShow()));
+ connect(oR->menu(), SIGNAL(triggered(QAction*)), song, SLOT(routeChanged(QAction*)));
layout->addLayout(rBox);
@@ -1450,22 +1215,22 @@ void MidiSyntiStrip::controllerChanged(int id)
}
//---------------------------------------------------------
-// oRoutePressed
+// oRouteShow
//---------------------------------------------------------
-void MidiSyntiStrip::oRoutePressed()
+void MidiSyntiStrip::oRouteShow()
{
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
- pup.addSeparator()->setText(tr("OutputPorts"));
- RouteList* orl = track->outRoutes();
+ QMenu* pup = oR->menu();
+ pup->clear();
+ pup->addSeparator()->setText(tr("OutputPorts"));
MidiOutPortList* mpl = song->midiOutPorts();
int pn = 0;
for (iMidiOutPort i = mpl->begin(); i != mpl->end(); ++i, ++pn) {
MidiOutPort* op = *i;
- QMenu* m = pup.addMenu(op->name());
+ QMenu* m = pup->addMenu(op->name());
m->addSeparator()->setText(tr("Channel"));
+#if 0 //TODO
for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
QString s;
s.setNum(channel+1);
@@ -1482,94 +1247,25 @@ void MidiSyntiStrip::oRoutePressed()
}
}
}
+#endif
}
- if (pup.isEmpty())
- return;
- QAction* action = pup.exec(QCursor::pos());
- if (action) {
- Route dstRoute = action->data().value<Route>();
- Route srcRoute(track, -1, Route::TRACK);
-
- // remove old route
- // note: audio->msgRemoveRoute() changes orl list
- //
- bool removed;
- do {
- removed = false;
- for (iRoute ir = orl->begin(); ir != orl->end(); ++ir) {
- Route s(track, ir->channel, Route::TRACK);
- s.dump();
- ir->dump();
- audio->msgRemoveRoute(s, *ir);
- removed = true;
- break;
- }
- } while (removed);
- audio->msgAddRoute(srcRoute, dstRoute);
- song->update(SC_ROUTE);
- if (mixer)
- mixer->setUpdateMixer();
- }
- oR->setDown(false); // pup->exec() catches mouse release event
}
//---------------------------------------------------------
-// iRoutePressed
+// iRouteShow
//---------------------------------------------------------
-void MidiSyntiStrip::iRoutePressed()
+void MidiSyntiStrip::iRouteShow()
{
- QMenu pup(oR);
- pup.setSeparatorsCollapsible(false);
+ QMenu* pup = oR->menu();
+ pup->clear();
- pup.addSeparator()->setText(tr("Input Ports"));
+ pup->addSeparator()->setText(tr("Input Ports"));
MidiOutPort* t = (MidiOutPort*)track;
- RouteList* irl = t->inRoutes();
-
- MidiInPortList* ipl = song->midiInPorts();
- for (iMidiInPort i = ipl->begin(); i != ipl->end(); ++i) {
- QMenu* m = pup.addMenu((*i)->name());
- m->addSeparator()->setText(tr("Channel"));
- QAction* action = m->addAction(tr("All"));
- Route src(*i, MIDI_CHANNELS, Route::TRACK);
- action->setData(QVariant::fromValue(src));
- for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
- QString s;
- s.setNum(channel+1);
-
- action = m->addAction(s);
- action->setCheckable(true);
- Route src(*i, channel, Route::TRACK);
- action->setData(QVariant::fromValue(src));
-
- for (iRoute ir = irl->begin(); ir != irl->end(); ++ir) {
- if (*ir == src) {
- action->setChecked(true);
- break;
- }
- }
- }
- }
-
- if (pup.isEmpty())
- return;
- QAction* action = pup.exec(QCursor::pos());
- if (action) {
- Route srcRoute = action->data().value<Route>();
- if (srcRoute.channel == MIDI_CHANNELS) {
- for (int channel = 0; channel < MIDI_CHANNELS; ++channel) {
- srcRoute.channel = channel;
- Route dstRoute(track, channel, Route::TRACK);
- audio->msgAddRoute(srcRoute, dstRoute);
- }
- song->update(SC_ROUTE);
- }
- else {
- Route dstRoute(track, srcRoute.channel, Route::TRACK);
- audio->msgRoute(action->isChecked(), srcRoute, dstRoute);
- }
+ for (int ch = 0; ch < MIDI_CHANNELS; ++ch) {
+ QMenu* m = pup->addMenu(QString("Channel %1").arg(ch+1));
+ addMidiTracks(m, t, ch, false);
+ addMidiInPorts(m, t, ch);
}
- iR->setDown(false); // pup->exec() catches mouse release event
}
-
diff --git a/muse/muse/mixer/mstrip.h b/muse/muse/mixer/mstrip.h
index bf23dd95..1f167739 100644
--- a/muse/muse/mixer/mstrip.h
+++ b/muse/muse/mixer/mstrip.h
@@ -32,38 +32,10 @@ class MidiSynti;
class MidiStrip : public Strip {
Q_OBJECT
- Awl::MidiMeter* meter;
- QToolButton* iR;
- QToolButton* oR;
-
- private slots:
- void muteToggled(bool);
- void soloToggled(bool);
- void recordToggled(bool);
- void iRoutePressed();
- void oRoutePressed();
- void monitorToggled(bool);
-
- protected slots:
- virtual void heartBeat();
-
- public slots:
- virtual void songChanged(int);
-
- public:
- MidiStrip(Mixer*, MidiTrack*, bool align);
- };
-
-//---------------------------------------------------------
-// MidiChannelStrip
-//---------------------------------------------------------
-
-class MidiChannelStrip : public Strip {
- Q_OBJECT
-
Awl::MidiMeterSlider* slider;
Awl::MidiVolEntry* sl;
QToolButton* iR;
+ QToolButton* oR;
struct KNOB {
Awl::Knob* knob;
@@ -89,7 +61,10 @@ class MidiChannelStrip : public Strip {
void sliderReleased(int);
void autoReadToggled(bool);
void autoWriteToggled(bool);
- void iRoutePressed();
+ void iRouteShow();
+ void oRouteShow();
+ void recordToggled(bool);
+ void monitorToggled(bool);
protected slots:
virtual void heartBeat();
@@ -98,7 +73,7 @@ class MidiChannelStrip : public Strip {
virtual void songChanged(int);
public:
- MidiChannelStrip(Mixer*, MidiChannel*, bool align = true);
+ MidiStrip(Mixer*, MidiTrack*, bool align = true);
};
//---------------------------------------------------------
@@ -111,6 +86,7 @@ class MidiOutPortStrip : public Strip {
Awl::MidiMeterSlider* slider;
Awl::MidiVolEntry* sl;
QToolButton* oR;
+ QToolButton* iR;
SimpleButton* sync;
bool volumeTouched;
@@ -125,7 +101,8 @@ class MidiOutPortStrip : public Strip {
void sliderReleased(int);
void autoReadToggled(bool);
void autoWriteToggled(bool);
- void oRoutePressed();
+ void iRouteShow();
+ void oRouteShow();
void syncToggled(bool) const;
protected slots:
@@ -162,8 +139,8 @@ class MidiSyntiStrip : public Strip {
void sliderReleased(int);
void autoReadToggled(bool);
void autoWriteToggled(bool);
- void oRoutePressed();
- void iRoutePressed();
+ void iRouteShow();
+ void oRouteShow();
protected slots:
virtual void heartBeat();
@@ -189,8 +166,8 @@ class MidiInPortStrip : public Strip {
private slots:
void muteToggled(bool);
void soloToggled(bool);
- void iRoutePressed();
- void oRoutePressed();
+ void iRouteShow();
+ void oRouteShow();
protected slots:
virtual void heartBeat();
diff --git a/muse/muse/muse.cpp b/muse/muse/muse.cpp
index 1fef1927..0391d446 100644
--- a/muse/muse/muse.cpp
+++ b/muse/muse/muse.cpp
@@ -66,7 +66,7 @@
#include "templatedialog.h"
#include "midiedit/miditracker.h"
#include "projectpropsdialog.h"
-#include "midichannel.h"
+#include "liste/listedit.h"
extern void initMidiInstruments();
@@ -469,6 +469,7 @@ MusE::MusE()
markerView = 0;
exportMidiDialog = 0;
projectPropsDialog = 0;
+ listEditor = 0;
startAction = new QAction(QIcon(":/xpm/start.xpm"), "start", this);
rewindAction = new QAction(QIcon(":/xpm/frewind.xpm"), "rewind", this);
@@ -1234,18 +1235,6 @@ void MusE::loadProject1(const QString& path)
clipboardChanged(); // enable/disable "Paste"
song->setLen(song->len()); // emit song->lenChanged() signal
- //
- // add connected channels
- //
- MidiChannelList* mcl = song->midiChannel();
- TrackList* tl = song->tracks();
- for (iMidiChannel i = mcl->begin(); i != mcl->end(); ++i) {
- MidiChannel* mc = (MidiChannel*)*i;
- if (mc->noInRoute() || song->trackExists(mc))
- continue;
- tl->push_back(mc);
- }
-
selectionChanged(); // enable/disable "Copy" & "Paste"
arranger->endLoadSong();
song->updatePos();
@@ -1254,6 +1243,7 @@ void MusE::loadProject1(const QString& path)
// send "cur" controller values to devices
//
+ TrackList* tl = song->tracks();
for (iTrack i = tl->begin(); i != tl->end(); ++i) {
Track* track = *i;
// track->blockSignals(true);
@@ -1498,8 +1488,7 @@ void MusE::startEditor(Part* part)
case Track::MIDI:
{
MidiTrack* t = (MidiTrack*)track;
- MidiChannel* mc = t->channel();
- if (mc && mc->useDrumMap())
+ if (t->useDrumMap())
startDrumEditor(pl);
else
startPianoroll(pl);
@@ -1562,8 +1551,17 @@ void MusE::startListEditor()
void MusE::startListEditor(PartList* /*pl*/)
{
-// ListEdit* listEditor = new ListEdit(0, pl);
-// listEditor->show();
+ if (listEditor == 0)
+ listEditor = new ListEdit(this);
+ listEditor->show();
+ }
+
+void MusE::showListEditor(const Pos& pos, Track* track, Ctrl* ctrl)
+ {
+ if (listEditor == 0)
+ listEditor = new ListEdit(this);
+ listEditor->selectItem(pos, track, ctrl);
+ listEditor->show();
}
//---------------------------------------------------------
diff --git a/muse/muse/muse.h b/muse/muse/muse.h
index 5045df19..c74d4b8d 100644
--- a/muse/muse/muse.h
+++ b/muse/muse/muse.h
@@ -53,6 +53,8 @@ class PreferencesDialog;
class EditInstrument;
class Mixer;
class ExportMidiDialog;
+class ListEdit;
+class Ctrl;
extern void configMidiController();
@@ -110,6 +112,7 @@ class MusE : public QMainWindow // , public Ui::MuseBase
QAction* aid1a;
Mixer* mixer2;
QAction* aid1b;
+ ListEdit* listEditor;
EditInstrument* editInstrument;
@@ -198,8 +201,7 @@ class MusE : public QMainWindow // , public Ui::MuseBase
void configShortCuts();
void startMasterEditor();
- void startListEditor();
- void startListEditor(PartList*);
+
void startDrumEditor();
void startDrumEditor(PartList* pl);
void startEditor(Part*);
@@ -212,6 +214,10 @@ class MusE : public QMainWindow // , public Ui::MuseBase
void startWaveEditor(PartList*);
void writeGlobalConfiguration() const;
void startEditInstrument();
+
+ void startListEditor();
+ void startListEditor(PartList*);
+
void showProjectPropsDialog();
void openRecentMenu();
@@ -302,6 +308,8 @@ class MusE : public QMainWindow // , public Ui::MuseBase
QAction* forwardAction;
QAction* stopAction;
QAction* playAction;
+
+ void showListEditor(const Pos&, Track*, Ctrl*);
};
extern MusE* muse;
diff --git a/muse/muse/preferences.cpp b/muse/muse/preferences.cpp
index 52773b53..e0b9b4be 100644
--- a/muse/muse/preferences.cpp
+++ b/muse/muse/preferences.cpp
@@ -162,7 +162,7 @@ PreferencesDialog::PreferencesDialog(Arranger* a, QWidget* parent)
twi(id, "Midi Track", 0x500 + Track::MIDI);
twi(id, "Midi Output", 0x500 + Track::MIDI_OUT);
twi(id, "Midi Input", 0x500 + Track::MIDI_IN);
- twi(id, "Midi Channel", 0x500 + Track::MIDI_CHANNEL);
+// twi(id, "Midi Channel", 0x500 + Track::MIDI_CHANNEL);
twi(id, "Midi Synti", 0x500 + Track::MIDI_SYNTI);
id = twi(itemList, "BigTime", 0);
diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp
index 89f819ee..4129b884 100644
--- a/muse/muse/route.cpp
+++ b/muse/muse/route.cpp
@@ -27,13 +27,12 @@
#include "driver/mididev.h"
#include "al/xml.h"
#include "auxplugin.h"
-#include "midichannel.h"
//---------------------------------------------------------
-// Route
+// RouteNode
//---------------------------------------------------------
-Route::Route()
+RouteNode::RouteNode()
{
track = 0;
channel = -1;
@@ -41,7 +40,7 @@ Route::Route()
disconnected = false;
}
-Route::Route(Port p, int ch, RouteType t)
+RouteNode::RouteNode(Port p, int ch, RouteNodeType t)
{
port = p;
channel = ch;
@@ -49,7 +48,7 @@ Route::Route(Port p, int ch, RouteType t)
disconnected = false;
}
-Route::Route(Port p, RouteType t)
+RouteNode::RouteNode(Port p, RouteNodeType t)
{
port = p;
channel = -1;
@@ -57,7 +56,7 @@ Route::Route(Port p, RouteType t)
disconnected = false;
}
-Route::Route(Track* tr)
+RouteNode::RouteNode(Track* tr)
{
track = tr;
channel = -1;
@@ -65,7 +64,7 @@ Route::Route(Track* tr)
disconnected = false;
}
-Route::Route(AuxPluginIF* p)
+RouteNode::RouteNode(AuxPluginIF* p)
{
plugin = p;
channel = -1;
@@ -73,7 +72,7 @@ Route::Route(AuxPluginIF* p)
disconnected = false;
}
-Route::Route(Track* tr, int ch, RouteType t)
+RouteNode::RouteNode(Track* tr, int ch, RouteNodeType t)
{
track = tr;
channel = ch;
@@ -86,60 +85,57 @@ Route::Route(Track* tr, int ch, RouteType t)
// return false, if route invalid or cannot be found
//---------------------------------------------------------
-bool addRoute(Route src, Route dst)
+bool addRoute(const Route& r)
{
//printf("addRoute %s.%d:<%s> %s.%d:<%s>\n",
-// src.tname(), src.channel, src.name().toLatin1().data(),
-// dst.tname(), dst.channel, dst.name().toLatin1().data());
+// r.src.tname(), r.src.channel, r.src.name().toLatin1().data(),
+// r.dst.tname(), r.dst.channel, r.dst.name().toLatin1().data());
- if (src.type == Route::AUDIOPORT || src.type == Route::MIDIPORT
- || src.type == Route::JACKMIDIPORT) {
- if (dst.type != Route::TRACK) {
+ if (r.src.type == RouteNode::AUDIOPORT || r.src.type == RouteNode::MIDIPORT
+ || r.src.type == RouteNode::JACKMIDIPORT) {
+ if (r.dst.type != RouteNode::TRACK) {
fprintf(stderr, "addRoute: bad route 1\n");
return false;
}
- if (dst.track->type() != Track::AUDIO_INPUT && dst.track->type() != Track::MIDI_IN) {
+ if (r.dst.track->type() != Track::AUDIO_INPUT && r.dst.track->type() != Track::MIDI_IN) {
fprintf(stderr, "addRoute: bad route 2\n");
return false;
}
- src.channel = dst.channel;
- RouteList* inRoutes = dst.track->inRoutes();
- if (inRoutes->indexOf(src) != -1) {
+ RouteList* inRoutes = r.dst.track->inRoutes();
+ if (inRoutes->indexOf(r) != -1) {
printf(" route already there 1\n");
return true;
}
- inRoutes->push_back(src);
+ inRoutes->push_back(r);
}
- else if (dst.type == Route::AUDIOPORT || dst.type == Route::MIDIPORT
- || dst.type == Route::JACKMIDIPORT) {
- if (src.type != Route::TRACK) {
+ else if (r.dst.type == RouteNode::AUDIOPORT || r.dst.type == RouteNode::MIDIPORT
+ || r.dst.type == RouteNode::JACKMIDIPORT) {
+ if (r.src.type != RouteNode::TRACK) {
fprintf(stderr, "addRoute: bad route 3\n");
return false;
}
- if (src.track->type() != Track::AUDIO_OUTPUT && src.track->type() != Track::MIDI_OUT) {
- fprintf(stderr, "addRoute: bad route 4, tracktype %s\n", src.track->cname().toLatin1().data());
+ if (r.src.track->type() != Track::AUDIO_OUTPUT && r.src.track->type() != Track::MIDI_OUT) {
+ fprintf(stderr, "addRoute: bad route 4, tracktype %s\n", r.src.track->cname().toLatin1().data());
return false;
}
- RouteList* outRoutes = src.track->outRoutes();
- dst.channel = src.channel;
-
- if (outRoutes->indexOf(dst) != -1) {
+ RouteList* outRoutes = r.src.track->outRoutes();
+ if (outRoutes->indexOf(r) != -1) {
printf(" route already there 2\n");
return true;
}
- outRoutes->push_back(dst);
+ outRoutes->push_back(r);
}
- else if (src.type == Route::AUXPLUGIN) {
- RouteList* inRoutes = dst.track->inRoutes();
- inRoutes->insert(inRoutes->begin(), src);
+ else if (r.src.type == RouteNode::AUXPLUGIN) {
+ RouteList* inRoutes = r.dst.track->inRoutes();
+ inRoutes->insert(inRoutes->begin(), r);
}
else {
- if (src.track->outRoutes()->indexOf(dst) != -1) {
+ if (r.src.track->outRoutes()->indexOf(r) != -1) {
printf(" route already there 3\n");
return true;
}
- src.track->outRoutes()->push_back(dst);
- dst.track->inRoutes()->push_back(src);
+ r.src.track->outRoutes()->push_back(r);
+ r.dst.track->inRoutes()->push_back(r);
}
return true;
}
@@ -148,76 +144,75 @@ bool addRoute(Route src, Route dst)
// removeRoute
//---------------------------------------------------------
-void removeRoute(Route src, Route dst)
+void removeRoute(const Route& r)
{
// printf("removeRoute %s.%d:<%s> %s.%d:<%s>\n",
-// src.tname(), src.channel, src.name().toLatin1().data(),
-// dst.tname(), dst.channel, dst.name().toLatin1().data());
- if (src.type == Route::AUDIOPORT || src.type == Route::MIDIPORT
- || src.type == Route::JACKMIDIPORT) {
- if (dst.type != Route::TRACK && dst.type != Route::SYNTIPORT) {
+// r.src.tname(), r.src.channel, r.src.name().toLatin1().data(),
+// r.dst.tname(), r.dst.channel, r.dst.name().toLatin1().data());
+ if (r.src.type == RouteNode::AUDIOPORT || r.src.type == RouteNode::MIDIPORT
+ || r.src.type == RouteNode::JACKMIDIPORT) {
+ if (r.dst.type != RouteNode::TRACK && r.dst.type != RouteNode::SYNTIPORT) {
fprintf(stderr, "removeRoute: bad route 1\n");
goto error;
}
- if (dst.track->type() != Track::AUDIO_INPUT
- && dst.track->type() != Track::AUDIO_SOFTSYNTH
- && dst.track->type() != Track::MIDI_IN) {
+ if (r.dst.track->type() != Track::AUDIO_INPUT
+ && r.dst.track->type() != Track::AUDIO_SOFTSYNTH
+ && r.dst.track->type() != Track::MIDI_IN) {
fprintf(stderr, "removeRoute: bad route 2\n");
goto error;
}
- RouteList* inRoutes = dst.track->inRoutes();
+ RouteList* inRoutes = r.dst.track->inRoutes();
iRoute i;
for (i = inRoutes->begin(); i != inRoutes->end(); ++i) {
- if (*i == src) {
+ if (*i == r) {
inRoutes->erase(i);
break;
}
}
}
- else if (dst.type == Route::AUDIOPORT || dst.type == Route::MIDIPORT
- || dst.type == Route::JACKMIDIPORT) {
-// | dst.type == Route::SYNTIPORT) {
- if (src.type != Route::TRACK) {
+ else if (r.dst.type == RouteNode::AUDIOPORT || r.dst.type == RouteNode::MIDIPORT
+ || r.dst.type == RouteNode::JACKMIDIPORT) {
+ if (r.src.type != RouteNode::TRACK) {
fprintf(stderr, "removeRoute: bad route 3\n");
goto error;
}
- if (src.track->type() != Track::AUDIO_OUTPUT && src.track->type() != Track::MIDI_OUT) {
+ if (r.src.track->type() != Track::AUDIO_OUTPUT && r.src.track->type() != Track::MIDI_OUT) {
fprintf(stderr, "removeRoute: bad route 4\n");
goto error;
}
- RouteList* outRoutes = src.track->outRoutes();
+ RouteList* outRoutes = r.src.track->outRoutes();
iRoute i;
for (i = outRoutes->begin(); i != outRoutes->end(); ++i) {
- if (*i == dst) {
+ if (*i == r) {
outRoutes->erase(i);
break;
}
}
}
- else if (src.type == Route::AUXPLUGIN) {
- if (dst.type != Route::TRACK) {
+ else if (r.src.type == RouteNode::AUXPLUGIN) {
+ if (r.dst.type != RouteNode::TRACK) {
fprintf(stderr, "removeRoute: bad route 5\n");
goto error;
}
- RouteList* inRoutes = dst.track->inRoutes();
+ RouteList* inRoutes = r.dst.track->inRoutes();
for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i) {
- if (*i == src) {
+ if (*i == r) {
inRoutes->erase(i);
break;
}
}
}
else {
- RouteList* outRoutes = src.track->outRoutes();
+ RouteList* outRoutes = r.src.track->outRoutes();
for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i) {
- if (*i == dst) {
+ if (*i == r) {
outRoutes->erase(i);
break;
}
}
- RouteList* inRoutes = dst.track->inRoutes();
+ RouteList* inRoutes = r.dst.track->inRoutes();
for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i) {
- if (*i == src) {
+ if (*i == r) {
inRoutes->erase(i);
break;
}
@@ -226,8 +221,8 @@ void removeRoute(Route src, Route dst)
return;
error:
printf("removeRoute %s.%d:<%s> %s.%d:<%s>\n",
- src.tname(), src.channel, src.name().toLatin1().data(),
- dst.tname(), dst.channel, dst.name().toLatin1().data());
+ r.src.tname(), r.src.channel, r.src.name().toLatin1().data(),
+ r.dst.tname(), r.dst.channel, r.dst.name().toLatin1().data());
abort();
}
@@ -246,7 +241,7 @@ static QString track2name(const Track* n)
// create string name representation for audio node
//---------------------------------------------------------
-QString Route::name() const
+QString RouteNode::name() const
{
switch (type) {
case TRACK:
@@ -273,7 +268,7 @@ QString Route::name() const
void Song::readRoute(QDomNode n)
{
- Route s, d;
+ RouteNode s, d;
for (QDomNode node = n.firstChild(); !node.isNull(); node = node.nextSibling()) {
QDomElement e = node.toElement();
if (e.tagName() == "src")
@@ -295,23 +290,19 @@ void Song::readRoute(QDomNode n)
d.tname(), d.channel, d.name().toLatin1().data());
return;
}
-
- if (s.type == Route::AUDIOPORT)
- s.channel = d.channel;
- if (d.type == Route::AUDIOPORT)
- d.channel = s.channel;
s.disconnected = true;
d.disconnected = true;
- addRoute(s, d);
+ Route r(s, d);
+ addRoute(r);
}
//---------------------------------------------------------
// dump
//---------------------------------------------------------
-void Route::dump() const
+void RouteNode::dump() const
{
- printf("Route %p dump: <%s> channel %d, type %s\n",
+ printf("RouteNode %p dump: <%s> channel %d, type %s\n",
track, name().toLatin1().data(), channel, tname());
}
@@ -319,7 +310,7 @@ void Route::dump() const
// operator==
//---------------------------------------------------------
-bool Route::operator==(const Route& a) const
+bool RouteNode::operator==(const RouteNode& a) const
{
if (type != a.type)
return false;
@@ -342,7 +333,7 @@ bool Route::operator==(const Route& a) const
// tname
//---------------------------------------------------------
-const char* Route::tname(RouteType t)
+const char* RouteNode::tname(RouteNodeType t)
{
static const char* names[] = {
"TRACK", "AUDIOPORT", "MIDIPORT", "JACKMIDIPORT",
@@ -353,7 +344,7 @@ const char* Route::tname(RouteType t)
return names[t];
}
-const char* Route::tname() const
+const char* RouteNode::tname() const
{
return tname(type);
}
@@ -362,7 +353,7 @@ const char* Route::tname() const
// write
//---------------------------------------------------------
-void Route::write(Xml& xml, const char* label) const
+void RouteNode::write(Xml& xml, const char* label) const
{
switch (type) {
case AUDIOPORT:
@@ -389,7 +380,7 @@ void Route::write(Xml& xml, const char* label) const
// read
//---------------------------------------------------------
-void Route::read(QDomNode node)
+void RouteNode::read(QDomNode node)
{
QDomElement e = node.toElement();
channel = e.attribute("channel","0").toInt() - 1;
@@ -397,7 +388,7 @@ void Route::read(QDomNode node)
QString st = e.attribute("type", "TRACK");
if (st == "TRACK") {
- type = Route::TRACK;
+ type = RouteNode::TRACK;
track = 0;
TrackList* tl = song->tracks();
for (iTrack i = tl->begin(); i != tl->end(); ++i) {
@@ -407,39 +398,29 @@ void Route::read(QDomNode node)
break;
}
}
- if (track == 0) {
- MidiChannelList* mc = song->midiChannel();
- for (iMidiChannel i = mc->begin(); i != mc->end(); ++i) {
- MidiChannel* t = *i;
- if (t->name() == s) {
- track = t;
- break;
- }
- }
- }
if (track == 0)
printf("Route::read(): track <%s> not found\n", s.toLatin1().data());
}
else if (st == "AUDIOPORT") {
- type = Route::AUDIOPORT;
+ type = RouteNode::AUDIOPORT;
port = audioDriver->findPort(s);
if (port.isZero())
printf("Route::read(): audioport <%s> not found\n", s.toLatin1().data());
}
else if (st == "JACKMIDIPORT") {
- type = Route::JACKMIDIPORT;
+ type = RouteNode::JACKMIDIPORT;
port = audioDriver->findPort(s);
if (port.isZero())
printf("Route::read(): jack midiport <%s> not found\n", s.toLatin1().data());
}
else if (st == "MIDIPORT") {
- type = Route::MIDIPORT;
+ type = RouteNode::MIDIPORT;
port = midiDriver->findPort(s);
if (port.isZero())
printf("Route::read(): midiport <%s> not found\n", s.toLatin1().data());
}
else if (st == "SYNTIPORT") {
- type = Route::SYNTIPORT;
+ type = RouteNode::SYNTIPORT;
SynthIList* tl = song->syntis();
for (iSynthI i = tl->begin(); i != tl->end(); ++i) {
SynthI* t = *i;
@@ -450,7 +431,7 @@ void Route::read(QDomNode node)
}
}
else if (st == "AUX") {
- type = Route::AUXPLUGIN;
+ type = RouteNode::AUXPLUGIN;
plugin = 0;
TrackList* tl = song->tracks();
for (iTrack i = tl->begin(); i != tl->end(); ++i) {
@@ -481,7 +462,7 @@ void Route::read(QDomNode node)
}
else {
printf("Route::read(): unknown type <%s>\n", st.toLatin1().data());
- type = Route::TRACK;
+ type = RouteNode::TRACK;
}
}
diff --git a/muse/muse/route.h b/muse/muse/route.h
index 70ed536b..a57b6405 100644
--- a/muse/muse/route.h
+++ b/muse/muse/route.h
@@ -31,23 +31,8 @@ using AL::Xml;
#include "driver/driver.h"
-// Routing Types:
-//
-// Audio:
-// Port - Track::Channel Audio Input
-// Track::Channel - Port Audio Ouput
-// Track - Track
-// Aux - Track Audio Aux Send
-// Midi:
-// Port - Track Midi Input
-// Track - Port Midi Output
-// Track - Track
-//
-// A software synthesizer is somewhat special as it has
-// a midi input and an audio output
-
//---------------------------------------------------------
-// Route
+// RouteNode
// this describes one endpoint of a route
// Track
// Track/Channel
@@ -56,8 +41,8 @@ using AL::Xml;
// SYNTI
//---------------------------------------------------------
-struct Route {
- enum RouteType { TRACK, AUDIOPORT, MIDIPORT, JACKMIDIPORT,
+struct RouteNode {
+ enum RouteNodeType { TRACK, AUDIOPORT, MIDIPORT, JACKMIDIPORT,
SYNTIPORT, AUXPLUGIN};
Port port;
@@ -69,14 +54,14 @@ struct Route {
bool disconnected; // if true, do not remove route in graphChanged()
// or removeConnection()
- RouteType type;
+ RouteNodeType type;
- Route();
- Route(Port, int, RouteType);
- Route(Port, RouteType);
- Route(Track*);
- Route(Track*, int, RouteType t = TRACK);
- Route(AuxPluginIF*);
+ RouteNode();
+ RouteNode(Port, int, RouteNodeType);
+ RouteNode(Port, RouteNodeType);
+ RouteNode(Track*);
+ RouteNode(Track*, int, RouteNodeType t = TRACK);
+ RouteNode(AuxPluginIF*);
bool isPortType() const {
return type==AUDIOPORT || type == MIDIPORT || type == JACKMIDIPORT;
@@ -90,10 +75,25 @@ struct Route {
void read(QDomNode node);
void write(Xml&, const char* name) const;
- bool operator==(const Route& a) const;
+ bool operator==(const RouteNode& a) const;
void dump() const;
const char* tname() const;
- static const char* tname(RouteType);
+ static const char* tname(RouteNodeType);
+ };
+
+//---------------------------------------------------------
+// Route
+//---------------------------------------------------------
+
+struct Route {
+ RouteNode src;
+ RouteNode dst;
+
+ Route() {}
+ Route(const RouteNode& s, const RouteNode& d) : src(s), dst(d) {}
+ bool operator==(const Route& a) const {
+ return (src==a.src) && (dst==a.dst);
+ }
};
Q_DECLARE_METATYPE(struct Route);
@@ -102,9 +102,8 @@ typedef QList<Route> RouteList;
typedef RouteList::iterator iRoute;
typedef RouteList::const_iterator ciRoute;
-extern bool addRoute(Route, Route);
-extern void removeRoute(Route, Route);
-extern bool checkRoute(const QString&, const QString&);
+extern bool addRoute(const Route&);
+extern void removeRoute(const Route&);
#endif
diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp
index b2f26361..1033381a 100644
--- a/muse/muse/seqmsg.cpp
+++ b/muse/muse/seqmsg.cpp
@@ -34,7 +34,6 @@
#include "midictrl.h"
#include "midiplugin.h"
#include "part.h"
-#include "midichannel.h"
#include "midioutport.h"
#include "midiinport.h"
@@ -79,12 +78,12 @@ bool Audio::sendMessage(AudioMsg* m, bool doUndo)
// msgRoute
//---------------------------------------------------------
-void Audio::msgRoute(bool add, Route src, Route dst)
+void Audio::msgRoute(bool add, Route r)
{
if (add)
- msgAddRoute(src, dst);
+ msgAddRoute(r);
else
- msgRemoveRoute(src, dst);
+ msgRemoveRoute(r);
song->update(SC_ROUTE);
}
@@ -92,41 +91,40 @@ void Audio::msgRoute(bool add, Route src, Route dst)
// msgRemoveRoute
//---------------------------------------------------------
-void Audio::msgRemoveRoute(Route src, Route dst)
+void Audio::msgRemoveRoute(Route r)
{
- if (src.type == Route::AUDIOPORT) {
- AudioInput* ai = (AudioInput*)(dst.track);
- audioDriver->disconnect(src.port, ai->jackPort(dst.channel));
+ if (r.src.type == RouteNode::AUDIOPORT) {
+ AudioInput* ai = (AudioInput*)(r.dst.track);
+ audioDriver->disconnect(r.src.port, ai->jackPort(r.dst.channel));
}
- else if (src.type == Route::JACKMIDIPORT) {
- audioDriver->disconnect(src.port, ((MidiInPort*)dst.track)->jackPort());
+ else if (r.src.type == RouteNode::JACKMIDIPORT) {
+ audioDriver->disconnect(r.src.port, ((MidiInPort*)r.dst.track)->jackPort());
}
- else if (src.type == Route::MIDIPORT) {
- midiDriver->disconnect(src.port, ((MidiInPort*)dst.track)->alsaPort());
+ else if (r.src.type == RouteNode::MIDIPORT) {
+ midiDriver->disconnect(r.src.port, ((MidiInPort*)r.dst.track)->alsaPort());
}
- else if (dst.type == Route::AUDIOPORT) {
- AudioOutput* ai = (AudioOutput*)(src.track);
- audioDriver->disconnect(ai->jackPort(src.channel), dst.port);
+ else if (r.dst.type == RouteNode::AUDIOPORT) {
+ AudioOutput* ai = (AudioOutput*)(r.src.track);
+ audioDriver->disconnect(ai->jackPort(r.src.channel), r.dst.port);
}
- else if (dst.type == Route::MIDIPORT) {
- midiDriver->disconnect(((MidiOutPort*)src.track)->alsaPort(), dst.port);
+ else if (r.dst.type == RouteNode::MIDIPORT) {
+ midiDriver->disconnect(((MidiOutPort*)r.src.track)->alsaPort(), r.dst.port);
}
- else if (dst.type == Route::JACKMIDIPORT) {
- audioDriver->disconnect(((MidiOutPort*)src.track)->jackPort(), dst.port);
+ else if (r.dst.type == RouteNode::JACKMIDIPORT) {
+ audioDriver->disconnect(((MidiOutPort*)r.src.track)->jackPort(), r.dst.port);
}
- msgRemoveRoute1(src, dst);
+ msgRemoveRoute1(r);
}
//---------------------------------------------------------
// msgRemoveRoute1
//---------------------------------------------------------
-void Audio::msgRemoveRoute1(Route src, Route dst)
+void Audio::msgRemoveRoute1(Route r)
{
AudioMsg msg;
msg.id = AUDIO_ROUTEREMOVE;
- msg.sroute = src;
- msg.droute = dst;
+ msg.route = r;
sendMsg(&msg);
}
@@ -134,28 +132,28 @@ void Audio::msgRemoveRoute1(Route src, Route dst)
// msgAddRoute
//---------------------------------------------------------
-void Audio::msgAddRoute(Route src, Route dst)
+void Audio::msgAddRoute(Route r)
{
- msgAddRoute1(src, dst);
- if (src.type == Route::AUDIOPORT) {
- AudioInput* ai = (AudioInput*)dst.track;
- audioDriver->connect(src.port, ai->jackPort(dst.channel));
+ msgAddRoute1(r);
+ if (r.src.type == RouteNode::AUDIOPORT) {
+ AudioInput* ai = (AudioInput*)r.dst.track;
+ audioDriver->connect(r.src.port, ai->jackPort(r.dst.channel));
}
- else if (src.type == Route::JACKMIDIPORT) {
- audioDriver->connect(src.port, ((MidiInPort*)dst.track)->jackPort());
+ else if (r.src.type == RouteNode::JACKMIDIPORT) {
+ audioDriver->connect(r.src.port, ((MidiInPort*)r.dst.track)->jackPort());
}
- else if (src.type == Route::MIDIPORT) {
- midiDriver->connect(src.port, ((MidiInPort*)dst.track)->alsaPort());
+ else if (r.src.type == RouteNode::MIDIPORT) {
+ midiDriver->connect(r.src.port, ((MidiInPort*)r.dst.track)->alsaPort());
}
- else if (dst.type == Route::AUDIOPORT) {
- AudioOutput* ao = (AudioOutput*)src.track;
- audioDriver->connect(ao->jackPort(src.channel), dst.port);
+ else if (r.dst.type == RouteNode::AUDIOPORT) {
+ AudioOutput* ao = (AudioOutput*)r.src.track;
+ audioDriver->connect(ao->jackPort(r.src.channel), r.dst.port);
}
- else if (dst.type == Route::MIDIPORT) {
- midiDriver->connect(((MidiOutPort*)src.track)->alsaPort(), dst.port);
+ else if (r.dst.type == RouteNode::MIDIPORT) {
+ midiDriver->connect(((MidiOutPort*)r.src.track)->alsaPort(), r.dst.port);
}
- else if (dst.type == Route::JACKMIDIPORT) {
- audioDriver->connect(((MidiOutPort*)src.track)->jackPort(), dst.port);
+ else if (r.dst.type == RouteNode::JACKMIDIPORT) {
+ audioDriver->connect(((MidiOutPort*)r.src.track)->jackPort(), r.dst.port);
}
}
@@ -163,12 +161,11 @@ void Audio::msgAddRoute(Route src, Route dst)
// msgAddRoute1
//---------------------------------------------------------
-void Audio::msgAddRoute1(Route src, Route dst)
+void Audio::msgAddRoute1(Route r)
{
AudioMsg msg;
msg.id = AUDIO_ROUTEADD;
- msg.sroute = src;
- msg.droute = dst;
+ msg.route = r;
sendMsg(&msg);
}
@@ -230,8 +227,8 @@ void Audio::msgSetChannels(AudioTrack* node, int n)
RouteList* ir = node->inRoutes();
for (iRoute ii = ir->begin(); ii != ir->end(); ++ii) {
Route r = *ii;
- if ((r.type == Route::AUDIOPORT) && (r.channel == i)) {
- msgRemoveRoute(r, Route(node,i, Route::TRACK));
+ if ((r.src.type == RouteNode::AUDIOPORT) && (r.src.channel == i)) {
+ msgRemoveRoute(r);
break;
}
}
@@ -253,8 +250,8 @@ void Audio::msgSetChannels(AudioTrack* node, int n)
RouteList* ir = node->outRoutes();
for (iRoute ii = ir->begin(); ii != ir->end(); ++ii) {
Route r = *ii;
- if ((r.type == Route::AUDIOPORT) && (r.channel == i)) {
- msgRemoveRoute(Route(node,i,Route::TRACK), r);
+ if ((r.src.type == RouteNode::AUDIOPORT) && (r.src.channel == i)) {
+ msgRemoveRoute(r);
break;
}
}
@@ -591,8 +588,8 @@ void Audio::msgPanic()
MidiEvent ev1(0, 0, ME_CONTROLLER, CTRL_ALL_SOUNDS_OFF, 0);
MidiEvent ev2(0, 0, ME_CONTROLLER, CTRL_RESET_ALL_CTRL, 0);
- MidiChannelList* cl = song->midiChannel();
- for (iMidiChannel i = cl->begin(); i != cl->end(); ++i) {
+ MidiTrackList* cl = song->midis();
+ for (iMidiTrack i = cl->begin(); i != cl->end(); ++i) {
(*i)->playMidiEvent(&ev1);
(*i)->playMidiEvent(&ev2);
}
@@ -606,8 +603,8 @@ void Audio::msgLocalOff()
{
MidiEvent ev1(0, 0, ME_CONTROLLER, CTRL_LOCAL_OFF, 0);
- MidiChannelList* cl = song->midiChannel();
- for (iMidiChannel i = cl->begin(); i != cl->end(); ++i)
+ MidiTrackList* cl = song->midis();
+ for (iMidiTrack i = cl->begin(); i != cl->end(); ++i)
(*i)->playMidiEvent(&ev1);
}
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index 2b9f9ff9..f14d4253 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -41,7 +41,6 @@
#include "midirc.h"
#include "part.h"
#include "conf.h"
-#include "midichannel.h"
#include "midioutport.h"
#include "midiinport.h"
#include "instruments/minstrument.h"
@@ -163,12 +162,11 @@ bool Song::addEvent(Event& event, Part* part)
MidiTrack* track = (MidiTrack*)part->track();
int tick = event.tick();
int cntrl = event.dataA();
- MidiChannel* mc = track->channel();
CVal val;
val.i = event.dataB();
- if (mc && !mc->addControllerVal(cntrl, tick, val)) {
- mc->addMidiController(mc->port()->instrument(), cntrl);
- if (!mc->addControllerVal(cntrl, tick, val)) {
+ if (!track->addControllerVal(cntrl, tick, val)) {
+//TODOA track->addMidiController(track->port()->instrument(), cntrl);
+ if (!track->addControllerVal(cntrl, tick, val)) {
return false;
}
}
@@ -194,14 +192,11 @@ void Song::changeEvent(Event& oldEvent, Event& newEvent, Part* part)
if (newEvent.type() == Controller) {
MidiTrack* track = (MidiTrack*)part->track();
- MidiChannel* mc = track->channel();
- if (mc) {
- int tick = newEvent.tick();
- int cntrl = newEvent.dataA();
- CVal val;
- val.i = newEvent.dataB();
- mc->addControllerVal(cntrl, tick, val);
- }
+ int tick = newEvent.tick();
+ int cntrl = newEvent.dataA();
+ CVal val;
+ val.i = newEvent.dataB();
+ track->addControllerVal(cntrl, tick, val);
}
}
@@ -590,37 +585,6 @@ void Song::update(int flags)
{
if (flags == 0)
return;
- if (flags & SC_ROUTE) {
- //
- // remove unconnected channels
- //
-// printf("update tracks %d channels: %d\n", _tracks.size(), _midiChannel.size());
- bool again;
- do {
- again = false;
- for (iTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
- if ((*i)->type() != Track::MIDI_CHANNEL)
- continue;
- MidiChannel* mc = (MidiChannel*)*i;
- if (mc->noInRoute()) {
- emit trackRemoved(mc);
- _tracks.erase(i);
- again = true;
- break;
- }
- }
- } while(again);
- //
- // add new connected channels
- //
- for (iMidiChannel i = _midiChannel.begin(); i != _midiChannel.end(); ++i) {
- MidiChannel* mc = (MidiChannel*)*i;
- if (mc->noInRoute() || trackExists(mc))
- continue;
- _tracks.push_back(mc);
- emit trackAdded(mc, _tracks.size()-1);
- }
- }
emit songChanged(flags);
if (flags & SC_TEMPO)
emit tempoChanged();
@@ -1159,8 +1123,6 @@ void Song::clear(bool signal)
qDeleteAll(_midiInPorts);
_midiInPorts.clear();
- _midiChannel.clear();
-
AL::tempomap.clear();
AL::sigmap.clear();
undoList->clear();
@@ -1551,7 +1513,6 @@ void Song::insertTrack(Track* track, int idx)
case Track::TRACK_TYPES:
case Track::MIDI_OUT:
case Track::MIDI_IN:
- case Track::MIDI_CHANNEL:
case Track::MIDI_SYNTI:
break;
case Track::MIDI:
@@ -1560,6 +1521,7 @@ void Song::insertTrack(Track* track, int idx)
// if there is already a route, do not add another
// default routing
//
+#if 0
if (track->noOutRoute()) {
for (iMidiChannel i = _midiChannel.begin(); i != _midiChannel.end(); ++i) {
if ((*i)->noInRoute()) {
@@ -1568,10 +1530,12 @@ void Song::insertTrack(Track* track, int idx)
}
}
}
+#endif
//
// connect to all midi inputs, if there is not already
// a route
//
+#if 0 //TODOA
if (!track->noInRoute()) {
MidiInPortList* mi = midiInPorts();
for (iMidiInPort i = mi->begin(); i != mi->end(); ++i) {
@@ -1579,20 +1543,22 @@ void Song::insertTrack(Track* track, int idx)
track->inRoutes()->push_back(Route(*i, ch, Route::TRACK));
}
}
+#endif
break;
case Track::AUDIO_SOFTSYNTH:
- if (mo)
- track->inRoutes()->push_back(Route(mo, -1, Route::TRACK));
+//TODOA if (mo)
+// track->inRoutes()->push_back(Route(mo, -1, Route::TRACK));
// fall through
case Track::WAVE:
case Track::AUDIO_GROUP:
- if (ao)
- track->outRoutes()->push_back(Route(ao));
+//TODOA if (ao)
+// track->outRoutes()->push_back(Route(ao));
break;
case Track::AUDIO_INPUT:
{
+#if 0 //TODOA
// connect first input channel to first available jack output
// etc.
QList<PortName> op = audioDriver->outputPorts(false);
@@ -1605,10 +1571,12 @@ void Song::insertTrack(Track* track, int idx)
}
if (ao)
track->outRoutes()->push_back(Route(ao));
+#endif
}
break;
case Track::AUDIO_OUTPUT:
{
+#if 0 //TODOA
QList<PortName> op = audioDriver->inputPorts(false);
QList<PortName>::iterator is = op.begin();
for (int ch = 0; ch < track->channels(); ++ch) {
@@ -1617,6 +1585,7 @@ void Song::insertTrack(Track* track, int idx)
++is;
}
}
+#endif
}
break;
}
@@ -1685,17 +1654,10 @@ void Song::insertTrack2(Track* track)
break;
case Track::MIDI_OUT:
_midiOutPorts.push_back((MidiOutPort*)track);
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- MidiChannel* mc = ((MidiOutPort*)track)->channel(i);
- _midiChannel.push_back(mc);
- }
break;
case Track::MIDI_IN:
_midiInPorts.push_back((MidiInPort*)track);
break;
- case Track::MIDI_CHANNEL:
- _midiChannel.push_back((MidiChannel*)track);
- break;
case Track::WAVE:
_waves.push_back((WaveTrack*)track);
break;
@@ -1713,10 +1675,6 @@ void Song::insertTrack2(Track* track)
SynthI* s = (SynthI*)track;
midiInstruments.push_back(s->instrument());
_synthIs.push_back(s);
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- MidiChannel* mc = ((SynthI*)track)->channel(i);
- _midiChannel.push_back(mc);
- }
}
break;
default:
@@ -1728,34 +1686,29 @@ void Song::insertTrack2(Track* track)
//
// connect routes
//
- Route src(track);
if (track->type() == Track::AUDIO_OUTPUT || track->type() == Track::MIDI_OUT) {
foreach(Route r, *(track->inRoutes())) {
- if (r.type != Route::AUXPLUGIN) {
- src.channel = r.channel;
- r.track->outRoutes()->push_back(src);
+ if (r.src.type != RouteNode::AUXPLUGIN) {
+ r.src.track->outRoutes()->push_back(r);
}
}
}
else if (track->type() == Track::AUDIO_INPUT || track->type() == Track::MIDI_IN) {
foreach(Route r, *(track->outRoutes())) {
- if (r.type != Route::AUXPLUGIN) {
- src.channel = r.channel;
- r.track->inRoutes()->push_back(src);
+ if (r.dst.type != RouteNode::AUXPLUGIN) {
+ r.dst.track->inRoutes()->push_back(r);
}
}
}
else {
foreach(Route r, *(track->inRoutes())) {
- if (r.type != Route::AUXPLUGIN) {
- src.channel = r.channel;
- r.track->outRoutes()->push_back(src);
+ if (r.src.type != RouteNode::AUXPLUGIN) {
+ r.src.track->outRoutes()->push_back(r);
}
}
foreach(Route r, *(track->outRoutes())) {
- if (r.type != Route::AUXPLUGIN) {
- src.channel = r.channel;
- r.track->inRoutes()->push_back(src);
+ if (r.dst.type != RouteNode::AUXPLUGIN) {
+ r.dst.track->inRoutes()->push_back(r);
}
}
}
@@ -1769,31 +1722,6 @@ void Song::insertTrack2(Track* track)
void Song::removeTrack(Track* track)
{
startUndo();
-
- if (track->type() == Track::AUDIO_SOFTSYNTH) {
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- MidiChannel* mc = ((SynthI*)track)->channel(i);
- if (!mc->noInRoute()) {
- int idx = _tracks.indexOf(mc);
- undoOp(UndoOp::DeleteTrack, idx, mc);
- removeTrack1(mc);
- audio->msgRemoveTrack(mc);
- removeTrack3(mc);
- }
- }
- }
- else if (track->type() == Track::MIDI_OUT) {
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- MidiChannel* mc = ((MidiOutPort*)track)->channel(i);
- if (!mc->noInRoute()) {
- int idx = _tracks.indexOf(mc);
- undoOp(UndoOp::DeleteTrack, idx, mc);
- removeTrack1(mc);
- audio->msgRemoveTrack(mc);
- removeTrack3(mc);
- }
- }
- }
int idx = _tracks.indexOf(track);
undoOp(UndoOp::DeleteTrack, idx, track);
removeTrack1(track);
@@ -1834,9 +1762,6 @@ void Song::removeTrack2(Track* track)
case Track::MIDI_IN:
_midiInPorts.removeAt(_midiInPorts.indexOf((MidiInPort*)track));
break;
- case Track::MIDI_CHANNEL:
- _midiChannel.removeAt(_midiChannel.indexOf((MidiChannel*)track));
- break;
case Track::WAVE:
_waves.removeAt(_waves.indexOf((WaveTrack*)track));
break;
@@ -1862,30 +1787,28 @@ void Song::removeTrack2(Track* track)
//
// remove routes
//
- Route src(track, -1, Route::TRACK);
foreach (const Route r, *(track->inRoutes())) {
- if (r.type != Route::TRACK && r.type != Route::SYNTIPORT)
+ if (r.src.type != RouteNode::TRACK && r.src.type != RouteNode::SYNTIPORT)
continue;
- src.channel = r.channel;
- int idx = r.track->outRoutes()->indexOf(src);
+ int idx = r.src.track->outRoutes()->indexOf(r);
if (idx != -1)
- r.track->outRoutes()->removeAt(idx);
+ r.src.track->outRoutes()->removeAt(idx);
else
printf("Song::removeTrack2(): input route not found\n");
}
foreach (const Route r, *(track->outRoutes())) {
- if (r.type != Route::TRACK && r.type != Route::SYNTIPORT)
+ if (r.dst.type != RouteNode::TRACK && r.dst.type != RouteNode::SYNTIPORT)
continue;
- src.channel = r.channel;
- int idx = r.track->inRoutes()->indexOf(src);
+ int idx = r.dst.track->inRoutes()->indexOf(r);
if (idx != -1)
- r.track->inRoutes()->removeAt(idx);
+ r.dst.track->inRoutes()->removeAt(idx);
else {
printf("Song::removeTrack2(): output route not found\n");
- src.dump();
+/*TODOA src.dump();
printf(" in route list:\n");
foreach (const Route rr, *(r.track->inRoutes()))
rr.dump();
+*/
}
}
}
@@ -2208,12 +2131,9 @@ void Song::addControllerVal(Track* t, Ctrl* c, const Pos& p, CVal val)
unsigned ctime = t->timeType() == AL::FRAMES ? pos[0].frame() : pos[0].tick();
CVal cval = c->value(ctime);
if (c->curVal().i != cval.i) {
- if (t->isMidiTrack()) {
- if (t->type() == Track::MIDI_CHANNEL) {
- MidiChannel* mc = (MidiChannel*)t;
- MidiEvent ev(0, 0, ME_CONTROLLER, c->id(), cval.i);
- mc->playMidiEvent(&ev);
- }
+ if (t->type() == Track::MIDI) {
+ MidiEvent ev(0, 0, ME_CONTROLLER, c->id(), cval.i);
+ ((MidiTrack*)t)->playMidiEvent(&ev);
}
c->setCurVal(cval);
}
@@ -2239,8 +2159,8 @@ void Song::setControllerVal(Track* t, int id, CVal val)
void Song::setControllerVal(Track* t, Ctrl* c, CVal val)
{
if (t->isMidiTrack()) {
- if (t->type() == Track::MIDI_CHANNEL) {
- MidiChannel* mc = (MidiChannel*)t;
+ if (t->type() == Track::MIDI) {
+ MidiTrack* mc = (MidiTrack*)t;
MidiEvent ev(0, 0, ME_CONTROLLER, c->id(), val.i);
mc->playMidiEvent(&ev);
}
@@ -2486,3 +2406,13 @@ void Song::restartJack()
muse->seqRestart();
}
+//---------------------------------------------------------
+// routeChanged
+//---------------------------------------------------------
+
+void Song::routeChanged(QAction* a)
+ {
+ audio->msgRoute(a->isChecked(), a->data().value<Route>());
+ }
+
+
diff --git a/muse/muse/song.h b/muse/muse/song.h
index d06aad88..af2e426b 100644
--- a/muse/muse/song.h
+++ b/muse/muse/song.h
@@ -24,7 +24,6 @@
#include "undo.h"
#include "midiinport.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "miditrack.h"
#include "midisynti.h"
#include "wavetrack.h"
@@ -110,13 +109,11 @@ class Song : public QObject {
MidiSyntiList _midiSyntis;
MidiOutPortList _midiOutPorts;
MidiInPortList _midiInPorts;
- MidiChannelList _midiChannel;
Track* _selectedTrack;
UndoList* undoList;
UndoList* redoList;
Pos pos[3];
-// Pos _vcpos; // virtual CPOS (locate in progress)
AL::MarkerList* _markerList;
bool seekInProgress; // user initiated a seek
@@ -165,6 +162,7 @@ class Song : public QObject {
void setPos(int, const AL::Pos&);
void setPos(int, const AL::Pos&, bool sig, bool isSeek = true,
bool adjustScrollbar = false);
+ void routeChanged(QAction*);
signals:
void songChanged(int);
@@ -309,7 +307,6 @@ class Song : public QObject {
MidiOutPortList* midiOutPorts() { return &_midiOutPorts; }
MidiSyntiList* midiSyntis() { return &_midiSyntis; }
MidiInPortList* midiInPorts() { return &_midiInPorts; }
- MidiChannelList* midiChannel() { return &_midiChannel; }
bool trackExists(Track*) const;
diff --git a/muse/muse/songfile.cpp b/muse/muse/songfile.cpp
index 51898d07..c8f89e7b 100644
--- a/muse/muse/songfile.cpp
+++ b/muse/muse/songfile.cpp
@@ -40,7 +40,6 @@
#include "marker/markerview.h"
#include "midioutport.h"
#include "midiinport.h"
-// #include "midichannel.h"
//---------------------------------------------------------
// readPart
@@ -310,11 +309,8 @@ void Song::write(Xml& xml) const
cloneList.clear();
// write tracks
- for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
- // midi channels are saved as part of midi out ports
- if ((*i)->type() != Track::MIDI_CHANNEL)
- (*i)->write(xml);
- }
+ for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i)
+ (*i)->write(xml);
// write routing
for (ciTrack i = _tracks.begin(); i != _tracks.end(); ++i)
diff --git a/muse/muse/synth.cpp b/muse/muse/synth.cpp
index 23efe9c2..1b5d09fa 100644
--- a/muse/muse/synth.cpp
+++ b/muse/muse/synth.cpp
@@ -31,7 +31,6 @@
#include "audio.h"
#include "event.h"
#include "midievent.h"
-#include "midichannel.h"
#include "audio.h"
#include "midiseq.h"
#include "midictrl.h"
@@ -189,8 +188,8 @@ SynthI::SynthI()
// setVolume(1.0);
// setPan(0.0);
_instrument = this;
- for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
- _channel[ch] = new MidiChannel(this, ch);
+// for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
+// _channel[ch] = new MidiChannel(this, ch);
}
//---------------------------------------------------------
@@ -201,8 +200,8 @@ SynthI::~SynthI()
{
deactivate2();
deactivate3();
- for (int ch = 0; ch < MIDI_CHANNEL; ++ch)
- delete _channel[ch];
+// for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
+// delete _channel[ch];
}
//---------------------------------------------------------
@@ -212,8 +211,8 @@ SynthI::~SynthI()
void SynthI::setName(const QString& s)
{
Track::setName(s);
- for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
- _channel[ch]->setDefaultName();
+// for (int ch = 0; ch < MIDI_CHANNELS; ++ch)
+// _channel[ch]->setDefaultName();
}
//---------------------------------------------------------
@@ -373,10 +372,10 @@ void SynthI::write(Xml& xml) const
AudioTrack::writeProperties(xml);
xml.strTag("class", synth()->name());
- for (int i = 0; i < MIDI_CHANNELS; ++i) {
- if (!_channel[i]->noInRoute())
- _channel[i]->write(xml);
- }
+// for (int i = 0; i < MIDI_CHANNELS; ++i) {
+// if (!_channel[i]->noInRoute())
+// _channel[i]->write(xml);
+// }
//---------------------------------------------
// if soft synth is attached to a midi port,
@@ -454,10 +453,10 @@ void SynthI::read(QDomNode node)
}
else if (tag == "geometry")
r = AL::readGeometry(node);
- else if (tag == "MidiChannel") {
- int idx = e.attribute("idx", "0").toInt();
- _channel[idx]->read(node.firstChild());
- }
+// else if (tag == "MidiChannel") {
+// int idx = e.attribute("idx", "0").toInt();
+// _channel[idx]->read(node.firstChild());
+// }
else if (AudioTrack::readProperties(node)) {
printf("MusE:SynthI: unknown tag %s\n", e.tagName().toLatin1().data());
}
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index 18749960..2b4f0b79 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -32,7 +32,6 @@
#include "part.h"
#include "gui.h"
#include "midioutport.h"
-#include "midichannel.h"
#include "driver/audiodev.h"
#include "driver/mididev.h"
@@ -40,12 +39,12 @@
const char* Track::_cname[] = {
"AudioOut", "Group", "Wave", "AudioIn",
- "Synth", "Midi", "MidiOut", "MidiIn", "M-Ch", "M-Synth"
+ "Synth", "Midi", "MidiOut", "MidiIn", "M-Synth"
};
const char* Track::_clname[] = {
"Audio Output", "Audio Group", "Wave Track", "Audio Input",
- "Synti", "Midi Track", "Midi Output", "Midi Input", "Midi Channel",
+ "Synti", "Midi Track", "Midi Output", "Midi Input",
"Midi Synth"
};
@@ -87,7 +86,6 @@ QPixmap* Track::pixmap(TrackType t)
case MIDI: return addtrack_addmiditrackIcon;
case MIDI_OUT: return addtrack_addmiditrackIcon;
case MIDI_IN: return addtrack_addmiditrackIcon;
- case MIDI_CHANNEL: return addtrack_addmiditrackIcon;
}
}
@@ -149,15 +147,6 @@ void Track::setDefaultName()
case WAVE:
base = QString("Track");
break;
- case MIDI_CHANNEL:
- {
- MidiOut* mop = ((MidiChannel*)this)->port();
- int no = ((MidiChannel*)this)->channelNo();
- base = QString("%1:%2").arg(mop->track->name()).arg(no + 1);
- setName(base);
- return;
- }
- break;
case AUDIO_GROUP:
base = QString("Group");
break;
@@ -191,24 +180,11 @@ void Track::setDefaultName()
break;
}
}
- MidiChannelList* mc = song->midiChannel();
- for (iMidiChannel ic = mc->begin(); ic != mc->end(); ++ic) {
- MidiChannel* t = *ic;
- if (t->name() == s) {
- found = true;
- break;
- }
- }
if (!found) {
setName(s);
break;
}
}
- if (type() == MIDI_OUT) {
- MidiOutPort* mop = (MidiOutPort*) this;
- for (int i = 0; i < MIDI_CHANNELS; ++i)
- mop->channel(i)->setDefaultName();
- }
}
//---------------------------------------------------------
@@ -679,34 +655,18 @@ void Track::updateController()
void Track::writeRouting(Xml& xml) const
{
- foreach(Route src, _inRoutes) {
- Route dst((Track*)this);
- if (type() == AUDIO_INPUT || type() == MIDI_IN) {
+ if (type() == AUDIO_INPUT || type() == MIDI_IN) {
+ foreach(Route r, _inRoutes) {
xml.tag("Route");
- dst.channel = src.channel;
- src.write(xml, "src");
- dst.write(xml, "dst");
- xml.etag("Route");
- }
- else if (src.type == Route::AUXPLUGIN) {
- xml.tag("Route");
- src.write(xml, "src");
- dst.write(xml, "dst");
+ r.src.write(xml, "src");
+ r.dst.write(xml, "dst");
xml.etag("Route");
}
}
foreach(Route r, _outRoutes) {
- Route src((Track*)this);
- Route dst(r);
- if (type() == MIDI_IN) {
- src.channel = dst.channel;
- dst.channel = 0;
- }
- else if (type() == AUDIO_OUTPUT)
- src.channel = r.channel;
xml.tag("Route");
- src.write(xml, "src");
- dst.write(xml, "dst");
+ r.src.write(xml, "src");
+ r.dst.write(xml, "dst");
xml.etag("Route");
}
}
@@ -1014,34 +974,32 @@ void Track::activate2()
printf("Track::activate2(): no audio running !\n");
abort();
}
- for (iRoute ri = _outRoutes.begin(); ri != _outRoutes.end(); ++ri) {
- Route& r = *ri;
- if (r.type == Route::JACKMIDIPORT) {
- audioDriver->connect(_jackPort[0], r.port);
- r.disconnected = false;
+ foreach(Route r, _outRoutes) {
+ if (r.dst.type == RouteNode::JACKMIDIPORT) {
+ audioDriver->connect(_jackPort[0], r.dst.port);
+ r.dst.disconnected = false;
}
- else if (r.type == Route::AUDIOPORT) {
- audioDriver->connect(_jackPort[r.channel], r.port);
- r.disconnected = false;
+ else if (r.dst.type == RouteNode::AUDIOPORT) {
+ audioDriver->connect(_jackPort[r.dst.channel], r.dst.port);
+ r.dst.disconnected = false;
}
- else if (r.type == Route::MIDIPORT) {
- midiDriver->connect(_alsaPort[0], r.port);
- r.disconnected = false;
+ else if (r.dst.type == RouteNode::MIDIPORT) {
+ midiDriver->connect(_alsaPort[0], r.dst.port);
+ r.dst.disconnected = false;
}
}
- for (iRoute ri = _inRoutes.begin(); ri != _inRoutes.end(); ++ri) {
- Route& r = *ri;
- if (r.type == Route::JACKMIDIPORT) {
- audioDriver->connect(r.port, _jackPort[0]);
- r.disconnected = false;
+ foreach(Route r, _inRoutes) {
+ if (r.src.type == RouteNode::JACKMIDIPORT) {
+ audioDriver->connect(r.src.port, _jackPort[0]);
+ r.src.disconnected = false;
}
- else if (r.type == Route::AUDIOPORT) {
- audioDriver->connect(r.port, _jackPort[r.channel]);
- r.disconnected = false;
+ else if (r.src.type == RouteNode::AUDIOPORT) {
+ audioDriver->connect(r.src.port, _jackPort[r.src.channel]);
+ r.src.disconnected = false;
}
- else if (r.type == Route::MIDIPORT) {
- midiDriver->connect(r.port, _alsaPort[0]);
- r.disconnected = false;
+ else if (r.src.type == RouteNode::MIDIPORT) {
+ midiDriver->connect(r.src.port, _alsaPort[0]);
+ r.src.disconnected = false;
}
}
}
@@ -1054,34 +1012,32 @@ void Track::activate2()
void Track::deactivate()
{
// printf("deactivate<%s>\n", name().toLatin1().data());
- for (iRoute ri = _outRoutes.begin(); ri != _outRoutes.end(); ++ri) {
- Route& r = *ri;
- if (r.type == Route::JACKMIDIPORT) {
- r.disconnected = true;
- audioDriver->disconnect(_jackPort[0], r.port);
+ foreach(Route r, _outRoutes) {
+ if (r.dst.type == RouteNode::JACKMIDIPORT) {
+ r.dst.disconnected = true;
+ audioDriver->disconnect(_jackPort[0], r.dst.port);
}
- else if (r.type == Route::AUDIOPORT) {
- audioDriver->disconnect(_jackPort[r.channel], r.port);
- r.disconnected = true;
+ else if (r.dst.type == RouteNode::AUDIOPORT) {
+ audioDriver->disconnect(_jackPort[r.dst.channel], r.dst.port);
+ r.dst.disconnected = true;
}
- else if (r.type == Route::MIDIPORT) {
- r.disconnected = true;
- midiDriver->disconnect(_alsaPort[0], r.port);
+ else if (r.dst.type == RouteNode::MIDIPORT) {
+ r.dst.disconnected = true;
+ midiDriver->disconnect(_alsaPort[0], r.dst.port);
}
}
- for (iRoute ri = _inRoutes.begin(); ri != _inRoutes.end(); ++ri) {
- Route& r = *ri;
- if (r.type == Route::JACKMIDIPORT) {
- r.disconnected = true;
- audioDriver->disconnect(r.port, _jackPort[0]);
+ foreach(Route r, _inRoutes) {
+ if (r.src.type == RouteNode::JACKMIDIPORT) {
+ r.src.disconnected = true;
+ audioDriver->disconnect(r.src.port, _jackPort[0]);
}
- else if (r.type == Route::AUDIOPORT) {
- r.disconnected = true;
- audioDriver->disconnect(r.port, _jackPort[r.channel]);
+ else if (r.src.type == RouteNode::AUDIOPORT) {
+ r.src.disconnected = true;
+ audioDriver->disconnect(r.src.port, _jackPort[r.src.channel]);
}
- else if (r.type == Route::MIDIPORT) {
- r.disconnected = true;
- midiDriver->disconnect(r.port, _alsaPort[0]);
+ else if (r.src.type == RouteNode::MIDIPORT) {
+ r.src.disconnected = true;
+ midiDriver->disconnect(r.src.port, _alsaPort[0]);
}
}
for (int i = 0; i < channels(); ++i) {
diff --git a/muse/muse/track.h b/muse/muse/track.h
index 354edf46..7940aa75 100644
--- a/muse/muse/track.h
+++ b/muse/muse/track.h
@@ -87,7 +87,6 @@ class Track : public QObject {
MIDI,
MIDI_OUT,
MIDI_IN,
- MIDI_CHANNEL,
MIDI_SYNTI,
TRACK_TYPES
};
@@ -100,7 +99,6 @@ class Track : public QObject {
M_MIDI = 1 << MIDI,
M_MIDI_OUT = 1 << MIDI_OUT,
M_MIDI_IN = 1 << MIDI_IN,
- M_MIDI_CHANNEL = 1 << MIDI_CHANNEL,
M_MIDI_SYNTI = 1 << MIDI_SYNTI
};
@@ -287,7 +285,6 @@ class Track : public QObject {
return type() == MIDI
|| type() == MIDI_IN
|| type() == MIDI_OUT
- || type() == MIDI_CHANNEL
|| type() == MIDI_SYNTI;
}
virtual bool canRecord() const { return false; }
diff --git a/muse/muse/widgets/utils.cpp b/muse/muse/widgets/utils.cpp
index 89417f5c..16feb0d0 100644
--- a/muse/muse/widgets/utils.cpp
+++ b/muse/muse/widgets/utils.cpp
@@ -360,6 +360,42 @@ SimpleButton* newStereoButton()
}
//---------------------------------------------------------
+// newOutRouteButton
+//---------------------------------------------------------
+
+QToolButton* newOutRouteButton()
+ {
+ QToolButton* oR = new QToolButton;
+ oR->setFont(config.fonts[BFONT]);
+ oR->setFixedWidth((STRIP_WIDTH-4)/2);
+ oR->setText(oR->tr("oR"));
+ oR->setCheckable(false);
+ oR->setToolTip(oR->tr("output routing"));
+ oR->setMenu(new QMenu);
+ oR->setPopupMode(QToolButton::InstantPopup);
+ oR->menu()->setSeparatorsCollapsible(false);
+ return oR;
+ }
+
+//---------------------------------------------------------
+// newInRouteButton
+//---------------------------------------------------------
+
+QToolButton* newInRouteButton()
+ {
+ QToolButton* iR = new QToolButton;
+ iR->setFont(config.fonts[BFONT]);
+ iR->setFixedWidth((STRIP_WIDTH-4)/2);
+ iR->setText(iR->tr("iR"));
+ iR->setCheckable(false);
+ iR->setToolTip(iR->tr("input routing"));
+ iR->setMenu(new QMenu);
+ iR->setPopupMode(QToolButton::InstantPopup);
+ iR->menu()->setSeparatorsCollapsible(false);
+ return iR;
+ }
+
+//---------------------------------------------------------
// fatalError
//---------------------------------------------------------
diff --git a/muse/muse/widgets/utils.h b/muse/muse/widgets/utils.h
index e395ff3a..c520c6d5 100644
--- a/muse/muse/widgets/utils.h
+++ b/muse/muse/widgets/utils.h
@@ -45,6 +45,8 @@ extern SimpleButton* newSyncButton();
extern SimpleButton* newPlusButton();
extern SimpleButton* newMinusButton();
extern SimpleButton* newStereoButton();
+QToolButton* newOutRouteButton();
+QToolButton* newInRouteButton();
extern void fatalError(const char*);