summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-08-31 12:20:07 +0000
committerWerner Schweer <ws.seh.de>2006-08-31 12:20:07 +0000
commit836679274cd3b18aedfb3851e89540da0f2d03b7 (patch)
tree10641f904233c376dfd245598639a74eae80dbb2
parent5fdc88d60b6c6b779b4cd0747b8faec99349343f (diff)
plugin racks can now hold an unlimited number of plugins
-rw-r--r--muse/ChangeLog4
-rw-r--r--muse/awl/tcanvas.cpp8
-rw-r--r--muse/muse/audiotrack.cpp15
-rw-r--r--muse/muse/midiedit/pianoroll.cpp2
-rw-r--r--muse/muse/midiplugin.cpp30
-rw-r--r--muse/muse/midiplugin.h18
-rw-r--r--muse/muse/mixer/midirack.cpp74
-rw-r--r--muse/muse/mixer/rack.cpp101
-rw-r--r--muse/muse/muse.cpp7
-rw-r--r--muse/muse/muse.h1
-rw-r--r--muse/muse/plugin.cpp46
-rw-r--r--muse/muse/plugin.h12
-rw-r--r--muse/muse/plugingui.cpp4
-rw-r--r--muse/muse/seqmsg.cpp4
-rw-r--r--muse/muse/track.cpp24
15 files changed, 147 insertions, 203 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index 0aea89c9..d29a75f2 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,7 @@
+31.8 (ws)
+ * plugin racks can now hold an unlimited number of plugins
+29.8 (ws)
+ * fixed drawing of y-magnified pianoroll canvas
28.8 (ws)
* added simple midi event dump plugin
* add midi plugin rack to midi port strips
diff --git a/muse/awl/tcanvas.cpp b/muse/awl/tcanvas.cpp
index 8a9d5d0e..eef9c8ee 100644
--- a/muse/awl/tcanvas.cpp
+++ b/muse/awl/tcanvas.cpp
@@ -1241,7 +1241,7 @@ void TimeCanvas::setCornerWidget(QWidget* w)
0 1 2 3 4 5 6 7 8 9 10
c-2 c-1 C0 C1 C2 C3 C4 C5 C6 C7 C8 - G8
- Grid über Oktave:
+ Grid üve:
+------------+ ------------------------------
11 | |
@@ -1476,11 +1476,11 @@ int TimeCanvas::pitch2y(int pitch) const
static int tt[] = {
12, 19, 25, 32, 38, 51, 58, 64, 71, 77, 84, 90
};
- y = (75 * keyHeight) - (tt[pitch%12] + (7 * keyHeight) * (pitch/12));
+ y = (75 * keyHeight) - (tt[pitch % 12] + (7 * keyHeight) * (pitch / 12));
if (y < 0)
y = 0;
}
- return lrint(y * _ymag) - wpos.y();
+ return lrint(y - wpos.y() / _ymag);
}
//---------------------------------------------------------
@@ -1541,7 +1541,7 @@ void TimeCanvas::paintPiano(QPainter& p, QRect r)
p.drawTiledPixmap(QRectF(x, y, qreal(r.width()), h), *octave, offset);
if (curPitch != -1) {
- int y = pitch2y(curPitch); // - lrint(wpos.y() / _ymag);
+ int y = pitch2y(curPitch);
QPixmap* pm;
switch(curPitch % 12) {
case 0:
diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp
index 02cd857a..067d5efe 100644
--- a/muse/muse/audiotrack.cpp
+++ b/muse/muse/audiotrack.cpp
@@ -103,19 +103,10 @@ void AudioTrack::addPlugin(PluginI* plugin, int idx)
}
}
}
- if (idx == -1) {
- idx = 0;
- for (; idx < 4; ++idx) {
- if ((*_efxPipe)[idx] == 0)
- break;
- }
- if (idx == 4) {
- printf("internal error: too many plugins\n");
- return;
- }
- }
+ if (idx == -1)
+ idx = _efxPipe->size();
- efxPipe()->insert(plugin, idx);
+ efxPipe()->insert(idx, plugin);
if (plugin) {
int ncontroller = plugin->plugin()->parameter();
for (int i = 0; i < ncontroller; ++i) {
diff --git a/muse/muse/midiedit/pianoroll.cpp b/muse/muse/midiedit/pianoroll.cpp
index f0ba5c32..b7def4d9 100644
--- a/muse/muse/midiedit/pianoroll.cpp
+++ b/muse/muse/midiedit/pianoroll.cpp
@@ -64,7 +64,7 @@ PianoRoll::PianoRoll(PartList* pl, bool init)
tcanvas = new PianoCanvas(this);
QMenuBar* mb = menuBar();
- //---------Menü----------------------------------
+ //---------Menu----------------------------------
menuEdit->addSeparator();
QAction* a;
diff --git a/muse/muse/midiplugin.cpp b/muse/muse/midiplugin.cpp
index 4787957a..5c230e6c 100644
--- a/muse/muse/midiplugin.cpp
+++ b/muse/muse/midiplugin.cpp
@@ -267,20 +267,8 @@ MidiPlugin* MidiPluginList::find(const QString& /*file*/, const QString& name)
//---------------------------------------------------------
MidiPipeline::MidiPipeline()
- : std::vector<MidiPluginI*>()
+ : QList<MidiPluginI*>()
{
- for (int i = 0; i < MidiPipelineDepth; ++i)
- push_back(0);
- }
-
-//---------------------------------------------------------
-// insert
-// give ownership of object plugin to Pipeline
-//---------------------------------------------------------
-
-void MidiPipeline::insert(MidiPluginI* plugin, int index)
- {
- (*this)[index] = plugin;
}
//---------------------------------------------------------
@@ -319,6 +307,7 @@ QString MidiPipeline::name(int idx) const
return QString("empty");
}
+#if 0
//---------------------------------------------------------
// empty
//---------------------------------------------------------
@@ -328,6 +317,7 @@ bool MidiPipeline::empty(int idx) const
MidiPluginI* p = (*this)[idx];
return p == 0;
}
+#endif
//---------------------------------------------------------
// move
@@ -361,7 +351,7 @@ void MidiPipeline::showGui(int idx, bool flag)
// guiVisible
//---------------------------------------------------------
-bool MidiPipeline::guiVisible(int idx)
+bool MidiPipeline::guiVisible(int idx) const
{
MidiPluginI* p = (*this)[idx];
if (p)
@@ -370,6 +360,18 @@ bool MidiPipeline::guiVisible(int idx)
}
//---------------------------------------------------------
+// hasGui
+//---------------------------------------------------------
+
+bool MidiPipeline::hasGui(int idx) const
+ {
+ MidiPluginI* p = (*this)[idx];
+ if (p)
+ return p->hasGui();
+ return false;
+ }
+
+//---------------------------------------------------------
// apply
//---------------------------------------------------------
diff --git a/muse/muse/midiplugin.h b/muse/muse/midiplugin.h
index 944b395a..dbe8e631 100644
--- a/muse/muse/midiplugin.h
+++ b/muse/muse/midiplugin.h
@@ -72,9 +72,9 @@ class MidiPlugin {
// MidiPluginList
//---------------------------------------------------------
-typedef std::list<MidiPlugin*>::iterator iMidiPlugin;
+typedef QList<MidiPlugin*>::iterator iMidiPlugin;
-class MidiPluginList : public std::list<MidiPlugin*> {
+class MidiPluginList : public QList<MidiPlugin*> {
public:
MidiPlugin* find(const QString&, const QString&);
MidiPluginList() {}
@@ -115,9 +115,9 @@ class MidiPluginI {
void showGui();
void showGui(bool);
bool hasGui() const { return mempi->hasGui(); }
+ bool guiVisible() const;
void getInitData(int* len, const unsigned char** p) { mempi->getInitData(len, p); }
void setInitData(int len, const unsigned char* p) { mempi->setInitData(len, p); }
- bool guiVisible() const;
};
//---------------------------------------------------------
@@ -125,21 +125,17 @@ class MidiPluginI {
// chain of connected efx inserts
//---------------------------------------------------------
-const int MidiPipelineDepth = 4;
-
-class MidiPipeline : public std::vector<MidiPluginI*> {
+class MidiPipeline : public QList<MidiPluginI*> {
public:
MidiPipeline();
- void insert(MidiPluginI* p, int index);
bool isOn(int idx) const;
void setOn(int, bool);
QString name(int idx) const;
void showGui(int, bool);
- bool guiVisible(int);
+ bool guiVisible(int) const;
+ bool hasGui(int) const;
void apply(unsigned, unsigned, MPEventList*, MPEventList*);
void move(int idx, bool up);
- bool empty(int idx) const;
- MidiPluginI* plugin(int idx) { return (*this)[idx]; }
};
typedef MidiPipeline::iterator iMidiPluginI;
@@ -163,6 +159,8 @@ class MidiPluginDialog : public QDialog {
void fillPlugs();
};
+static const int MidiPipelineDepth = 4;
+
extern void initMidiPlugins();
extern MidiPluginList midiPlugins;
diff --git a/muse/muse/mixer/midirack.cpp b/muse/muse/mixer/midirack.cpp
index 099e27e2..3e8da952 100644
--- a/muse/muse/mixer/midirack.cpp
+++ b/muse/muse/mixer/midirack.cpp
@@ -13,6 +13,7 @@
#include "song.h"
#include "midiplugin.h"
#include "audio.h"
+#include "muse.h"
//---------------------------------------------------------
// MidiRack
@@ -22,19 +23,14 @@ MidiRack::MidiRack(QWidget* parent, MidiTrackBase* t)
: QListWidget(parent)
{
setAttribute(Qt::WA_DeleteOnClose, true);
+ verticalScrollBar()->setStyle(smallStyle);
track = t;
setFont(*config.fonts[1]);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setSelectionMode(QAbstractItemView::SingleSelection);
- for (int i = 0; i < MidiPipelineDepth; ++i) {
- QListWidgetItem* item = new QListWidgetItem;
- item->setText(t->pipeline()->name(i));
- item->setBackgroundColor(t->pipeline()->isOn(i) ? Qt::white : Qt::gray);
- addItem(item);
- }
+ songChanged(SC_RACK); // force update
connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
this, SLOT(doubleClicked(QListWidgetItem*)));
connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
@@ -59,48 +55,41 @@ QSize MidiRack::sizeHint() const
void MidiRack::songChanged(int typ)
{
if (typ & (SC_ROUTE | SC_RACK)) {
- for (int i = 0; i < MidiPipelineDepth; ++i) {
- QListWidgetItem* it = item(i);
- it->setText(track->pipeline()->name(i));
- it->setBackgroundColor(track->pipeline()->isOn(i) ? Qt::white : Qt::gray);
+ clear();
+ foreach(MidiPluginI* plugin, *(track->pipeline())) {
+ QListWidgetItem* item = new QListWidgetItem;
+ item->setText(plugin->name());
+ // tooltip should only be set if name does not fit
+ // (is elided)
+ item->setToolTip(plugin->name());
+ item->setBackgroundColor(plugin->on() ? Qt::white : Qt::gray);
+ addItem(item);
}
}
}
//---------------------------------------------------------
-// menuRequested
+// contextMenuEvent
//---------------------------------------------------------
void MidiRack::contextMenuEvent(QContextMenuEvent* ev)
{
QPoint pt(ev->pos());
QListWidgetItem* item = itemAt(pt);
+ MidiPipeline* pipe = track->pipeline();
- if (item == 0 || track == 0)
- return;
-
- int idx = row(item);
- QString name;
- bool mute;
-
- MidiPipeline* pipe = track->pipeline();
- name = pipe->name(idx);
- mute = pipe->isOn(idx);
-
- QMenu* menu = new QMenu;
-
- QAction* upAction = menu->addAction(QIcon(*upIcon), tr("move up"));
- QAction* downAction = menu->addAction(QIcon(*downIcon), tr("move down"));
+ QMenu* menu = new QMenu;
+ QAction* upAction = menu->addAction(QIcon(*upIcon), tr("move up"));
+ QAction* downAction = menu->addAction(QIcon(*downIcon), tr("move down"));
QAction* removeAction = menu->addAction(tr("remove"));
QAction* bypassAction = menu->addAction(tr("bypass"));
QAction* showAction = menu->addAction(tr("show gui"));
- QAction* newAction;
-
- bypassAction->setChecked(!pipe->isOn(idx));
- showAction->setChecked(pipe->guiVisible(idx));
+ QAction* newAction = menu->addAction(tr("new"));
+ bypassAction->setCheckable(true);
+ showAction->setCheckable(true);
- if (pipe->empty(idx)) {
- newAction = menu->addAction(tr("new"));
+ int idx = -1;
+ if (item == 0) {
upAction->setEnabled(false);
downAction->setEnabled(false);
removeAction->setEnabled(false);
@@ -108,11 +97,13 @@ void MidiRack::contextMenuEvent(QContextMenuEvent* ev)
showAction->setEnabled(false);
}
else {
- newAction = menu->addAction(tr("change"));
- if (idx == 0)
- upAction->setEnabled(false);
- if (idx == (MidiPipelineDepth-1))
- downAction->setEnabled(false);
+ idx = row(item);
+ upAction->setEnabled(idx != 0);
+ downAction->setEnabled(idx < (pipe->size() - 1));
+ showAction->setEnabled(pipe->hasGui(idx));
+ bypassAction->setEnabled(true);
+ bypassAction->setChecked(!pipe->isOn(idx));
+ showAction->setChecked(pipe->guiVisible(idx));
}
QAction* sel = menu->exec(mapToGlobal(pt), newAction);
@@ -130,7 +121,7 @@ void MidiRack::contextMenuEvent(QContextMenuEvent* ev)
delete plugi;
}
else
- audio->msgAddMidiPlugin(track, idx, plugi);
+ audio->msgAddMidiPlugin(track, pipe->size(), plugi);
}
}
else if (sel == removeAction) {
@@ -151,7 +142,7 @@ void MidiRack::contextMenuEvent(QContextMenuEvent* ev)
}
}
else if (sel == downAction) {
- if (idx < (MidiPipelineDepth-1)) {
+ if (idx < (pipe->size() - 1)) {
setCurrentRow(idx+1);
pipe->move(idx, false);
}
@@ -172,7 +163,7 @@ void MidiRack::doubleClicked(QListWidgetItem* it)
int idx = row(it);
MidiPipeline* pipe = track->pipeline();
- if (!pipe->empty(idx)) {
+ if (!pipe->value(idx)) {
bool flag = !pipe->guiVisible(idx);
pipe->showGui(idx, flag);
}
@@ -190,5 +181,6 @@ void MidiRack::doubleClicked(QListWidgetItem* it)
}
}
}
+ song->update(SC_RACK);
}
diff --git a/muse/muse/mixer/rack.cpp b/muse/muse/mixer/rack.cpp
index 609f571f..863a788a 100644
--- a/muse/muse/mixer/rack.cpp
+++ b/muse/muse/mixer/rack.cpp
@@ -6,8 +6,6 @@
// (C) Copyright 2000-2003 Werner Schweer (ws@seh.de)
//=========================================================
-//#include <QDrag>
-//#include <QMimeData>
#include "rack.h"
#include "song.h"
#include "audio.h"
@@ -16,6 +14,9 @@
#include "plugin.h"
#include "plugingui.h"
#include "widgets/filedialog.h"
+#include "muse.h"
+
+static const int PipelineDepth = 4;
//---------------------------------------------------------
// EffectRack
@@ -25,19 +26,15 @@ EffectRack::EffectRack(QWidget* parent, AudioTrack* t)
: QListWidget(parent)
{
setAttribute(Qt::WA_DeleteOnClose, true);
+ verticalScrollBar()->setStyle(smallStyle);
+
track = t;
setFont(*config.fonts[1]);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setSelectionMode(QAbstractItemView::SingleSelection);
- for (int i = 0; i < PipelineDepth; ++i) {
- QListWidgetItem* item = new QListWidgetItem;
- item->setText(t->efxPipe()->name(i));
- item->setBackgroundColor(t->efxPipe()->isOn(i) ? Qt::white : Qt::gray);
- addItem(item);
- }
+ songChanged(SC_RACK); // force update
connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
this, SLOT(doubleClicked(QListWidgetItem*)));
connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
@@ -63,10 +60,15 @@ QSize EffectRack::sizeHint() const
void EffectRack::songChanged(int typ)
{
if (typ & (SC_ROUTE | SC_RACK)) {
- for (int i = 0; i < PipelineDepth; ++i) {
- QListWidgetItem* it = item(i);
- it->setText(track->efxPipe()->name(i));
- it->setBackgroundColor(track->efxPipe()->isOn(i) ? Qt::white : Qt::gray);
+ clear();
+ foreach(PluginI* plugin, *(track->efxPipe())) {
+ QListWidgetItem* item = new QListWidgetItem;
+ item->setText(plugin->name());
+ // tooltip should only be set if name does not fit
+ // (is elided)
+ item->setToolTip(plugin->name());
+ item->setBackgroundColor(plugin->on() ? Qt::white : Qt::gray);
+ addItem(item);
}
}
}
@@ -79,40 +81,25 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
{
QPoint pt(ev->pos());
QListWidgetItem* item = itemAt(pt);
- if (item == 0 || track == 0)
- return;
- int idx = row(item);
+ int idx = -1;
QString name;
- bool mute;
Pipeline* pipe = track->efxPipe();
- if (pipe) {
- name = pipe->name(idx);
- mute = pipe->isOn(idx);
- }
- QAction* newAction;
- QAction* upAction;
- QAction* downAction;
- QAction* removeAction;
- QAction* bypassAction;
- QAction* showAction;
- QAction* showCustomAction;
-
- QMenu* menu = new QMenu;
- upAction = menu->addAction(QIcon(*upIcon), tr("move up"));
- downAction = menu->addAction(QIcon(*downIcon), tr("move down"));
- removeAction = menu->addAction(tr("remove"));
- bypassAction = menu->addAction(tr("bypass"));
- showAction = menu->addAction(tr("show gui"));
- showCustomAction = menu->addAction(tr("show native gui"));
-
- bypassAction->setChecked(!pipe->isOn(idx));
- showAction->setChecked(pipe->guiVisible(idx));
- showCustomAction->setChecked(pipe->nativeGuiVisible(idx));
-
- if (pipe->empty(idx)) {
- newAction = menu->addAction(tr("new"));
+ QMenu* menu = new QMenu;
+ QAction* upAction = menu->addAction(QIcon(*upIcon), tr("move up"));
+ QAction* downAction = menu->addAction(QIcon(*downIcon), tr("move down"));
+ QAction* removeAction = menu->addAction(tr("remove"));
+ QAction* bypassAction = menu->addAction(tr("bypass"));
+ QAction* showAction = menu->addAction(tr("show gui"));
+ QAction* showCustomAction = menu->addAction(tr("show native gui"));
+ QAction* newAction = menu->addAction(tr("new"));
+
+ bypassAction->setCheckable(true);
+ showAction->setCheckable(true);
+ showCustomAction->setCheckable(true);
+
+ if (!item) {
upAction->setEnabled(false);
downAction->setEnabled(false);
removeAction->setEnabled(false);
@@ -121,12 +108,18 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
showCustomAction->setEnabled(false);
}
else {
- newAction = menu->addAction(tr("change"));
- if (idx == 0)
- upAction->setEnabled(false);
- if (idx == (PipelineDepth-1))
- downAction->setEnabled(false);
+ idx = row(item);
+ upAction->setEnabled(idx != 0);
+ downAction->setEnabled(idx < pipe->size()-1);
showCustomAction->setEnabled(pipe->hasNativeGui(idx));
+
+ bypassAction->setEnabled(true);
+ showAction->setEnabled(true);
+ showCustomAction->setEnabled(true);
+
+ bypassAction->setChecked(!pipe->isOn(idx));
+ showAction->setChecked(pipe->guiVisible(idx));
+ showCustomAction->setChecked(pipe->nativeGuiVisible(idx));
}
QAction* sel = menu->exec(mapToGlobal(pt), newAction);
@@ -184,13 +177,13 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
void EffectRack::doubleClicked(QListWidgetItem* it)
{
- if (it == 0 || track == 0)
+ if (track == 0)
return;
- int idx = row(it);
- Pipeline* pipe = track->efxPipe();
- if (!pipe->empty(idx)) {
- bool flag = !pipe->guiVisible(idx);
+ if (it) {
+ int idx = row(it);
+ Pipeline* pipe = track->efxPipe();
+ bool flag = !pipe->guiVisible(idx);
pipe->showGui(idx, flag);
}
else {
@@ -203,7 +196,7 @@ void EffectRack::doubleClicked(QListWidgetItem* it)
delete plugi;
}
else {
- audio->msgAddPlugin(track, idx, plugi);
+ audio->msgAddPlugin(track, -1, plugi);
}
song->update(SC_RACK);
}
diff --git a/muse/muse/muse.cpp b/muse/muse/muse.cpp
index 67832ac9..695fbf98 100644
--- a/muse/muse/muse.cpp
+++ b/muse/muse/muse.cpp
@@ -98,6 +98,8 @@ extern void initDSSI();
extern bool initJackAudio();
extern void exitJackAudio();
+QStyle* smallStyle;
+
int watchAudio, watchAudioPrefetch, watchMidi;
pthread_t splashThread;
MusE* muse;
@@ -2820,7 +2822,10 @@ int main(int argc, char* argv[])
gmDrumMap.initGm(); // init default drum map
readConfiguration();
- QApplication::setFont(*config.fonts[0]);
+ QApplication::setFont(*config.fonts[0]);
+
+ // this style is used for scrollbars in mixer plugin racks:
+ smallStyle = new QWindowsStyle();
// SHOW MUSE SPLASH SCREEN
if (config.showSplashScreen) {
diff --git a/muse/muse/muse.h b/muse/muse/muse.h
index 36c23ae3..bcd13af9 100644
--- a/muse/muse/muse.h
+++ b/muse/muse/muse.h
@@ -295,6 +295,7 @@ class MusE : public QMainWindow, public Ui::MuseBase
};
extern MusE* muse;
+extern QStyle* smallStyle;
#endif
diff --git a/muse/muse/plugin.cpp b/muse/muse/plugin.cpp
index aeee6cc5..09cdf555 100644
--- a/muse/muse/plugin.cpp
+++ b/muse/muse/plugin.cpp
@@ -236,35 +236,13 @@ Plugin* PluginList::find(const QString& file, const QString& name)
}
//---------------------------------------------------------
-// Pipeline
-//---------------------------------------------------------
-
-Pipeline::Pipeline()
- : std::vector<PluginI*>()
- {
- for (int i = 0; i < PipelineDepth; ++i)
- push_back(0);
- }
-
-//---------------------------------------------------------
// setChannels
//---------------------------------------------------------
void Pipeline::setChannels(int n)
{
- for (int i = 0; i < PipelineDepth; ++i)
- if ((*this)[i])
- (*this)[i]->setChannels(n);
- }
-
-//---------------------------------------------------------
-// insert
-// give ownership of object plugin to Pipeline
-//---------------------------------------------------------
-
-void Pipeline::insert(PluginI* plugin, int index)
- {
- (*this)[index] = plugin;
+ foreach(PluginI* plugin, *this)
+ plugin->setChannels(n);
}
//---------------------------------------------------------
@@ -273,7 +251,7 @@ void Pipeline::insert(PluginI* plugin, int index)
bool Pipeline::isOn(int idx) const
{
- PluginI* p = (*this)[idx];
+ PluginI* p = value(idx);
if (p)
return p->on();
return false;
@@ -285,7 +263,7 @@ bool Pipeline::isOn(int idx) const
void Pipeline::setOn(int idx, bool flag)
{
- PluginI* p = (*this)[idx];
+ PluginI* p = value(idx);
if (p) {
p->setOn(flag);
if (p->gui())
@@ -299,7 +277,7 @@ void Pipeline::setOn(int idx, bool flag)
QString Pipeline::label(int idx) const
{
- PluginI* p = (*this)[idx];
+ PluginI* p = value(idx);
if (p)
return p->label();
return QString("");
@@ -311,7 +289,7 @@ QString Pipeline::label(int idx) const
QString Pipeline::name(int idx) const
{
- PluginI* p = (*this)[idx];
+ PluginI* p = value(idx);
if (p)
return p->name();
return QString("empty");
@@ -323,23 +301,13 @@ QString Pipeline::name(int idx) const
bool Pipeline::hasNativeGui(int idx) const
{
- PluginI* p = (*this)[idx];
+ PluginI* p = value(idx);
if (p)
return p->hasNativeGui();
return false;
}
//---------------------------------------------------------
-// empty
-//---------------------------------------------------------
-
-bool Pipeline::empty(int idx) const
- {
- PluginI* p = (*this)[idx];
- return p == 0;
- }
-
-//---------------------------------------------------------
// move
//---------------------------------------------------------
diff --git a/muse/muse/plugin.h b/muse/muse/plugin.h
index a31db428..08e61f4d 100644
--- a/muse/muse/plugin.h
+++ b/muse/muse/plugin.h
@@ -308,12 +308,12 @@ class PluginI {
// chain of connected efx inserts
//---------------------------------------------------------
-const int PipelineDepth = 4;
+// const int PipelineDepth = 4;
-class Pipeline : public std::vector<PluginI*> {
+class Pipeline : public QList<PluginI*> {
public:
- Pipeline();
- void insert(PluginI* p, int index);
+ Pipeline() {}
+// void insert(PluginI* p, int index);
bool isOn(int idx) const;
void setOn(int, bool);
QString label(int idx) const;
@@ -325,9 +325,9 @@ class Pipeline : public std::vector<PluginI*> {
void showNativeGui(int, bool);
void apply(int ports, unsigned long nframes, float** buffer);
void move(int idx, bool up);
- bool empty(int idx) const;
+// bool empty(int idx) const;
void setChannels(int);
- PluginI* plugin(int idx) { return (*this)[idx]; }
+ PluginI* plugin(int idx) { return value(idx); }
};
typedef Pipeline::iterator iPluginI;
diff --git a/muse/muse/plugingui.cpp b/muse/muse/plugingui.cpp
index c6b0ffcd..2bc0929f 100644
--- a/muse/muse/plugingui.cpp
+++ b/muse/muse/plugingui.cpp
@@ -660,9 +660,9 @@ void PluginGui::bypassToggled(bool val)
void PluginGui::setOn(bool val)
{
- onOff->blockSignals(true);
+// onOff->blockSignals(true);
onOff->setChecked(val);
- onOff->blockSignals(false);
+// onOff->blockSignals(false);
}
//---------------------------------------------------------
diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp
index 930ed13a..c4e947cc 100644
--- a/muse/muse/seqmsg.cpp
+++ b/muse/muse/seqmsg.cpp
@@ -181,11 +181,7 @@ void Audio::msgAddPlugin(AudioTrack* node, int idx, PluginI* plugin)
msg.track = node;
msg.ival = idx;
msg.plugin = plugin;
- PluginI* oldPlugin = node->plugin(idx);
sendMsg(&msg);
- if (oldPlugin) {
- delete oldPlugin;
- }
}
//---------------------------------------------------------
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index 6c011d5e..a12890b9 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -769,13 +769,13 @@ bool MidiTrackBase::readProperties(QDomNode node)
MidiPluginI* MidiTrackBase::plugin(int idx) const
{
- return (*_pipeline)[idx];
+ return _pipeline->value(idx);
}
-
//---------------------------------------------------------
// addPlugin
-// idx = -1 insert into first free slot
+// idx = -1 append
+// plugin = 0 remove slot
//---------------------------------------------------------
void MidiTrackBase::addPlugin(MidiPluginI* plugin, int idx)
@@ -792,20 +792,11 @@ void MidiTrackBase::addPlugin(MidiPluginI* plugin, int idx)
}
#endif
}
- if (idx == -1) {
- idx = 0;
- for (; idx < 4; ++idx) {
- if ((*_pipeline)[idx] == 0)
- break;
- }
- if (idx == 4) {
- printf("internal error: too many plugins\n");
- return;
- }
- }
+ if (idx == -1)
+ idx = _pipeline->size();
- _pipeline->insert(plugin, idx);
if (plugin) {
+ _pipeline->insert(idx, plugin);
#if 0
int ncontroller = plugin->plugin()->parameter();
for (int i = 0; i < ncontroller; ++i) {
@@ -827,6 +818,9 @@ void MidiTrackBase::addPlugin(MidiPluginI* plugin, int idx)
}
#endif
}
+ else {
+ _pipeline->removeAt(idx);
+ }
}