summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Schweer <ws.seh.de>2006-10-10 19:09:47 +0000
committerWerner Schweer <ws.seh.de>2006-10-10 19:09:47 +0000
commitd7a402c098878184319e86b68f7d28ba221254d1 (patch)
tree0a1c30c461cbee55eeb6c4518818712e4f3a7bdc
parent45a852eda3872deeb9cd6c85886fb02b7bfdadc0 (diff)
aux send updates part I
-rw-r--r--muse/CMakeLists.txt4
-rw-r--r--muse/muse/CMakeLists.txt5
-rw-r--r--muse/muse/arranger/arranger.cpp1
-rw-r--r--muse/muse/arranger/trackinfo.cpp1
-rw-r--r--muse/muse/audio.cpp7
-rw-r--r--muse/muse/audio.h2
-rw-r--r--muse/muse/audioaux.cpp106
-rw-r--r--muse/muse/audioaux.h50
-rw-r--r--muse/muse/audiotrack.cpp89
-rw-r--r--muse/muse/audiotrack.h10
-rw-r--r--muse/muse/auxplugin.cpp191
-rw-r--r--muse/muse/auxplugin.h81
-rw-r--r--muse/muse/conf.cpp3
-rw-r--r--muse/muse/ctrl.h29
-rw-r--r--muse/muse/ctrl/ctrldialog.cpp28
-rw-r--r--muse/muse/gconfig.cpp1
-rw-r--r--muse/muse/icons.cpp3
-rw-r--r--muse/muse/icons.h1
-rw-r--r--muse/muse/ladspaplugin.cpp235
-rw-r--r--muse/muse/ladspaplugin.h127
-rw-r--r--muse/muse/mixer/astrip.cpp520
-rw-r--r--muse/muse/mixer/astrip.h12
-rw-r--r--muse/muse/mixer/mixer.cpp22
-rw-r--r--muse/muse/mixer/mixer.h2
-rw-r--r--muse/muse/mixer/mstrip.cpp18
-rw-r--r--muse/muse/mixer/rack.cpp95
-rw-r--r--muse/muse/mixer/rack.h16
-rw-r--r--muse/muse/mixer/routedialog.cpp2
-rw-r--r--muse/muse/muse.cpp5
-rw-r--r--muse/muse/pipeline.cpp199
-rw-r--r--muse/muse/plugin.cpp435
-rw-r--r--muse/muse/plugin.h142
-rw-r--r--muse/muse/plugingui.cpp5
-rw-r--r--muse/muse/preferences.cpp1
-rw-r--r--muse/muse/route.cpp94
-rw-r--r--muse/muse/route.h14
-rw-r--r--muse/muse/seqmsg.cpp16
-rw-r--r--muse/muse/shortcuts.cpp1
-rw-r--r--muse/muse/shortcuts.h1
-rw-r--r--muse/muse/song.cpp45
-rw-r--r--muse/muse/song.h3
-rw-r--r--muse/muse/songfile.cpp5
-rw-r--r--muse/muse/track.cpp32
-rw-r--r--muse/muse/track.h2
44 files changed, 1278 insertions, 1383 deletions
diff --git a/muse/CMakeLists.txt b/muse/CMakeLists.txt
index 531eae2b..80c712f9 100644
--- a/muse/CMakeLists.txt
+++ b/muse/CMakeLists.txt
@@ -26,8 +26,8 @@ if (NOT CMAKE_INSTALL_LIBDIR)
SET(CMAKE_INSTALL_LIBDIR "lib")
endif (NOT CMAKE_INSTALL_LIBDIR)
-# set(CMAKE_BUILD_TYPE Debug)
-set(CMAKE_BUILD_TYPE Release)
+set(CMAKE_BUILD_TYPE Debug)
+# set(CMAKE_BUILD_TYPE Release)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
diff --git a/muse/muse/CMakeLists.txt b/muse/muse/CMakeLists.txt
index 1793c33b..74020594 100644
--- a/muse/muse/CMakeLists.txt
+++ b/muse/muse/CMakeLists.txt
@@ -68,7 +68,6 @@ QT4_WRAP_CPP ( muse_moc_headers
miditrack.h
wavetrack.h
audiotrack.h
- audioaux.h
audiooutput.h
audioinput.h
audiogroup.h
@@ -88,6 +87,9 @@ add_executable ( muse
dssihost.cpp
synth.cpp
plugin.cpp
+ ladspaplugin.cpp
+ auxplugin.cpp
+ pipeline.cpp
mtc.cpp
thread.cpp
audio.cpp
@@ -141,7 +143,6 @@ add_executable ( muse
miditrack.cpp
wavetrack.cpp
audiotrack.cpp
- audioaux.cpp
audiooutput.cpp
audioinput.cpp
audiogroup.cpp
diff --git a/muse/muse/arranger/arranger.cpp b/muse/muse/arranger/arranger.cpp
index fe795543..53afff1a 100644
--- a/muse/muse/arranger/arranger.cpp
+++ b/muse/muse/arranger/arranger.cpp
@@ -52,7 +52,6 @@ const TrElement trElements[] = {
TrElement(TR_OFF, 2, "off",
Track::M_AUDIO_OUTPUT
| Track::M_AUDIO_GROUP
- | Track::M_AUDIO_AUX
| Track::M_WAVE
| Track::M_AUDIO_INPUT
| Track::M_AUDIO_SOFTSYNTH),
diff --git a/muse/muse/arranger/trackinfo.cpp b/muse/muse/arranger/trackinfo.cpp
index fb563b8a..9f44cadc 100644
--- a/muse/muse/arranger/trackinfo.cpp
+++ b/muse/muse/arranger/trackinfo.cpp
@@ -41,7 +41,6 @@ TrackInfo* Arranger::createTrackInfo()
case Track::MIDI: return new MidiTrackInfo();
case Track::AUDIO_OUTPUT: return new AudioOutputInfo();
case Track::AUDIO_GROUP: return new AudioGroupInfo();
- case Track::AUDIO_AUX: return new AudioAuxInfo();
case Track::WAVE: return new WaveTrackInfo();
case Track::AUDIO_INPUT: return new AudioInputInfo();
case Track::AUDIO_SOFTSYNTH: return new SynthIInfo();
diff --git a/muse/muse/audio.cpp b/muse/muse/audio.cpp
index a1168e0b..6f0209fe 100644
--- a/muse/muse/audio.cpp
+++ b/muse/muse/audio.cpp
@@ -467,7 +467,6 @@ void Audio::process(unsigned frames)
processMidi(frames);
GroupList* gl = song->groups();
- AuxList* al = song->auxs();
SynthIList* sl = song->syntis();
InputList* il = song->inputs();
WaveTrackList* wl = song->waves();
@@ -515,9 +514,6 @@ void Audio::process(unsigned frames)
}
for (iAudioGroup i = gl->begin(); i != gl->end(); ++i)
(*i)->process();
- for (iAudioAux i = al->begin(); i != al->end(); ++i)
- (*i)->process();
-
for (iAudioOutput i = ol->begin(); i != ol->end(); ++i) {
AudioOutput* ao = *i;
ao->process();
@@ -573,7 +569,8 @@ void Audio::processMsg()
msg->track->setChannels(msg->ival);
break;
case AUDIO_ADDPLUGIN:
- ((AudioTrack*)msg->track)->addPlugin(msg->plugin, msg->ival);
+ ((AudioTrack*)msg->track)->addPlugin(msg->plugin, msg->ival,
+ msg->iival);
break;
case AUDIO_SET_SEG_SIZE:
diff --git a/muse/muse/audio.h b/muse/muse/audio.h
index bb411770..18530398 100644
--- a/muse/muse/audio.h
+++ b/muse/muse/audio.h
@@ -239,7 +239,7 @@ class Audio {
void msgRemoveRoute1(Route, Route);
void msgAddRoute(Route, Route);
void msgAddRoute1(Route, Route);
- void msgAddPlugin(AudioTrack*, int idx, PluginI* plugin);
+ void msgAddPlugin(AudioTrack*, int idx, PluginI* plugin, bool prefader);
void msgAddMidiPlugin(MidiTrackBase*, int idx, MidiPluginI* plugin);
void msgSetMute(AudioTrack*, bool val);
void msgAddSynthI(SynthI* synth);
diff --git a/muse/muse/audioaux.cpp b/muse/muse/audioaux.cpp
deleted file mode 100644
index 1d5a16f9..00000000
--- a/muse/muse/audioaux.cpp
+++ /dev/null
@@ -1,106 +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 "globals.h"
-#include "audioaux.h"
-#include "al/xml.h"
-#include "song.h"
-
-//---------------------------------------------------------
-// AudioAux
-//---------------------------------------------------------
-
-AudioAux::AudioAux()
- : AudioTrack(AUDIO_AUX)
- {
- _channels = 0;
- setChannels(2);
- }
-
-//---------------------------------------------------------
-// AudioAux
-//---------------------------------------------------------
-
-AudioAux::~AudioAux()
- {
- }
-
-//---------------------------------------------------------
-// read
-//---------------------------------------------------------
-
-void AudioAux::read(QDomNode node)
- {
- while (!node.isNull()) {
- AudioTrack::readProperties(node);
- node = node.nextSibling();
- }
- }
-
-//---------------------------------------------------------
-// write
-//---------------------------------------------------------
-
-void AudioAux::write(Xml& xml) const
- {
- xml.tag("AudioAux");
- AudioTrack::writeProperties(xml);
- xml.etag("AudioAux");
- }
-
-//---------------------------------------------------------
-// setChannels
-//---------------------------------------------------------
-
-void AudioAux::setChannels(int n)
- {
- AudioTrack::setChannels(n);
- }
-
-//---------------------------------------------------------
-// collectInputData
-//---------------------------------------------------------
-
-void AudioAux::collectInputData()
- {
- bufferEmpty = false;
- AuxList* al = song->auxs(); // aux sends
- int bus = AC_AUX + al->index(this) + 1;
- bool copy = true;
-
- TrackList* tl = song->tracks();
- for (iTrack i = tl->begin(); i != tl->end(); ++i) {
- if ((*i)->isMidiTrack())
- continue;
- AudioTrack* track = (AudioTrack*)(*i);
- if (!track->hasAuxSend() || track->off() || song->bounceTrack == track)
- continue;
- if (copy)
- copy = !track->multiplyCopy(channels(), buffer, bus);
- else
- track->multiplyAdd(channels(), buffer, bus);
- }
- if (copy) {
- for (int i = 0; i < channels(); ++i)
- memset(buffer[i], 0, sizeof(float) * segmentSize);
- bufferEmpty = true;
- }
- }
-
diff --git a/muse/muse/audioaux.h b/muse/muse/audioaux.h
deleted file mode 100644
index d0a3cbc9..00000000
--- a/muse/muse/audioaux.h
+++ /dev/null
@@ -1,50 +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 __AUDIOAUX_H__
-#define __AUDIOAUX_H__
-
-#include "audiotrack.h"
-
-//---------------------------------------------------------
-// AudioAux
-//---------------------------------------------------------
-
-class AudioAux : public AudioTrack {
- Q_OBJECT
-
- protected:
- virtual void collectInputData();
-
- public:
- AudioAux();
- ~AudioAux();
- virtual AudioAux* newTrack() const { return new AudioAux(); }
- virtual void read(QDomNode);
- virtual void write(Xml&) const;
- virtual void setChannels(int n);
- };
-
-typedef tracklist<AudioAux*>::iterator iAudioAux;
-typedef tracklist<AudioAux*>::const_iterator ciAudioAux;
-typedef tracklist<AudioAux*> AuxList;
-
-#endif
-
diff --git a/muse/muse/audiotrack.cpp b/muse/muse/audiotrack.cpp
index 83b23bd8..fa091263 100644
--- a/muse/muse/audiotrack.cpp
+++ b/muse/muse/audiotrack.cpp
@@ -25,7 +25,8 @@
#include "audio.h"
#include "wave.h"
#include "al/xml.h"
-#include "plugin.h"
+#include "auxplugin.h"
+#include "pipeline.h"
#include "driver/audiodev.h"
#include "gconfig.h"
@@ -38,7 +39,8 @@ AudioTrack::AudioTrack(TrackType t)
{
_tt = AL::FRAMES;
_prefader = false;
- _efxPipe = new Pipeline();
+ _prePipe = new Pipeline();
+ _postPipe = new Pipeline();
_recFile = 0;
_channels = 0;
bufferEmpty = false;
@@ -69,7 +71,8 @@ AudioTrack::AudioTrack(TrackType t)
AudioTrack::~AudioTrack()
{
- delete _efxPipe;
+ delete _prePipe;
+ delete _postPipe;
for (int i = 0; i < MAX_CHANNELS; ++i) {
if (buffer[i])
delete[] buffer[i];
@@ -91,45 +94,44 @@ Part* AudioTrack::newPart(Part*, bool /*clone*/)
// idx = -1 insert into first free slot
//---------------------------------------------------------
-void AudioTrack::addPlugin(PluginI* plugin, int idx)
+void AudioTrack::addPlugin(PluginI* plugin, int idx, bool pre)
{
+ Pipeline* pipe = pre ? _prePipe : _postPipe;
if (plugin == 0) {
- PluginI* oldPlugin = (*_efxPipe)[idx];
+ PluginI* oldPlugin = (*pipe)[idx];
if (oldPlugin) {
int controller = oldPlugin->plugin()->parameter();
for (int i = 0; i < controller; ++i) {
- int id = (idx + 1) * 0x1000 + i;
+ int id = genACnum(idx, i, pre);
removeController(id);
}
- _efxPipe->removeAt(idx);
+ pipe->removeAt(idx);
}
+ return;
}
if (idx == -1)
- idx = _efxPipe->size();
-
- if (plugin) {
- efxPipe()->insert(idx, plugin);
- int ncontroller = plugin->plugin()->parameter();
- for (int i = 0; i < ncontroller; ++i) {
- int id = (idx + 1) * 0x1000 + i;
- QString name(plugin->getParameterName(i));
- double min, max;
- plugin->range(i, &min, &max);
- Ctrl* cl = getController(id);
- //printf("Plugin name: %s id:%d\n",name.toAscii().data(), id);
- if (cl == 0) {
- cl = new Ctrl(id, name);
- cl->setRange(min, max);
- float defaultValue = plugin->defaultValue(i);
- cl->setDefault(defaultValue);
- cl->setCurVal(defaultValue);
- addController(cl);
- }
+ idx = pipe->size();
+ pipe->insert(idx, plugin);
+ int ncontroller = plugin->plugin()->parameter();
+ for (int i = 0; i < ncontroller; ++i) {
+ int id = genACnum(idx, i, pre);
+ QString name(plugin->getParameterName(i));
+ double min, max;
+ plugin->range(i, &min, &max);
+ Ctrl* cl = getController(id);
+ //printf("Plugin name: %s id:%d\n",name.toAscii().data(), id);
+ if (cl == 0) {
+ cl = new Ctrl(id, name);
cl->setRange(min, max);
- cl->setName(name);
- plugin->setParam(i, cl->schedVal().f);
- plugin->setControllerList(cl);
+ float defaultValue = plugin->defaultValue(i);
+ cl->setDefault(defaultValue);
+ cl->setCurVal(defaultValue);
+ addController(cl);
}
+ cl->setRange(min, max);
+ cl->setName(name);
+ plugin->setParam(i, cl->schedVal().f);
+ plugin->setControllerList(cl);
}
}
@@ -137,9 +139,10 @@ void AudioTrack::addPlugin(PluginI* plugin, int idx)
// plugin
//---------------------------------------------------------
-PluginI* AudioTrack::plugin(int idx) const
+PluginI* AudioTrack::plugin(int idx, bool prefader) const
{
- return (*_efxPipe)[idx];
+ Pipeline* pipe = prefader ? _prePipe : _postPipe;
+ return (*pipe)[idx];
}
//---------------------------------------------------------
@@ -180,11 +183,10 @@ void AudioTrack::addAuxSend(int n)
void AudioTrack::writeProperties(Xml& xml) const
{
Track::writeProperties(xml);
- xml.intTag("prefader", prefader());
- for (ciPluginI ip = _efxPipe->begin(); ip != _efxPipe->end(); ++ip) {
- if (*ip)
- (*ip)->writeConfiguration(xml);
- }
+ foreach (PluginI* plugin, *_prePipe)
+ plugin->writeConfiguration(xml, true);
+ foreach (PluginI* plugin, *_postPipe)
+ plugin->writeConfiguration(xml, false);
}
//---------------------------------------------------------
@@ -197,13 +199,14 @@ bool AudioTrack::readProperties(QDomNode node)
QString tag(e.tagName());
if (tag == "plugin") {
PluginI* pi = new PluginI(this);
- if (pi->readConfiguration(node)) {
+ bool prefader;
+ if (pi->readConfiguration(node, &prefader)) {
delete pi;
}
else {
// insert plugin into first free slot
// of plugin rack
- addPlugin(pi, -1);
+ addPlugin(pi, -1, prefader);
}
}
else if (tag == "prefader")
@@ -385,8 +388,10 @@ void AudioTrack::setChannels(int n)
abort();
}
Track::setChannels(n);
- if (_efxPipe)
- _efxPipe->setChannels(n);
+ if (_prePipe)
+ _prePipe->setChannels(n);
+ if (_postPipe)
+ _postPipe->setChannels(n);
}
//---------------------------------------------------------
@@ -422,7 +427,7 @@ void AudioTrack::process()
// apply plugin chain
//---------------------------------------------------
- _efxPipe->apply(channels(), segmentSize, buffer);
+ _prePipe->apply(channels(), segmentSize, buffer);
//---------------------------------------------------
// metering
diff --git a/muse/muse/audiotrack.h b/muse/muse/audiotrack.h
index 54fe4ab4..91c2ffcc 100644
--- a/muse/muse/audiotrack.h
+++ b/muse/muse/audiotrack.h
@@ -42,7 +42,8 @@ class AudioTrack : public Track {
Q_OBJECT
bool _prefader; // prefader metering
- Pipeline* _efxPipe;
+ Pipeline* _prePipe;
+ Pipeline* _postPipe;
QList<AuxSend> sends;
void readRecfile(QDomNode);
@@ -91,9 +92,10 @@ class AudioTrack : public Track {
bool prefader() const { return _prefader; }
void addAuxSend(int n);
void setPrefader(bool val);
- Pipeline* efxPipe() { return _efxPipe; }
- void addPlugin(PluginI* plugin, int idx);
- PluginI* plugin(int idx) const;
+ Pipeline* prePipe() { return _prePipe; }
+ Pipeline* postPipe() { return _postPipe; }
+ void addPlugin(PluginI* plugin, int idx, bool pre);
+ PluginI* plugin(int idx, bool prefader) const;
virtual bool hasAuxSend() const { return false; }
virtual void process();
diff --git a/muse/muse/auxplugin.cpp b/muse/muse/auxplugin.cpp
new file mode 100644
index 00000000..0f25f814
--- /dev/null
+++ b/muse/muse/auxplugin.cpp
@@ -0,0 +1,191 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 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 "globaldefs.h"
+#include "auxplugin.h"
+
+AuxPlugin* auxPlugin;
+
+//---------------------------------------------------------
+// AuxPlugin
+//---------------------------------------------------------
+
+AuxPlugin::AuxPlugin()
+ : Plugin(0)
+ {
+ }
+
+//---------------------------------------------------------
+// range
+//---------------------------------------------------------
+
+void AuxPlugin::range(int idx, double* min, double* max) const
+ {
+ switch(idx) {
+ case 0: // volume
+ *min = -60.0;
+ *max = 10.0;
+ break;
+ case 1: // pan
+ *min = -1.0;
+ *max = 1.0;
+ break;
+ default:
+ printf("AuxPlugin::bad index\n");
+ break;
+ }
+ }
+
+//---------------------------------------------------------
+// createPIF
+//---------------------------------------------------------
+
+PluginIF* AuxPlugin::createPIF(PluginI* pi)
+ {
+ AuxPluginIF* pif = new AuxPluginIF(pi);
+ pif->init(pi->plugin());
+ return pif;
+ }
+
+//---------------------------------------------------------
+// isLog
+//---------------------------------------------------------
+
+bool AuxPlugin::isLog(int idx) const
+ {
+ return idx == 0 ? true : false;
+ }
+
+//---------------------------------------------------------
+// isBool
+//---------------------------------------------------------
+
+bool AuxPlugin::isBool(int) const
+ {
+ return false;
+ }
+
+//---------------------------------------------------------
+// isInt
+//---------------------------------------------------------
+
+bool AuxPlugin::isInt(int) const
+ {
+ return false;
+ }
+
+//---------------------------------------------------------
+// defaultValue
+//---------------------------------------------------------
+
+double AuxPlugin::defaultValue(int idx) const
+ {
+ return idx == 0 ? -70.0 : 0.0;
+ }
+
+//---------------------------------------------------------
+// AuxPluginIF
+//---------------------------------------------------------
+
+AuxPluginIF::AuxPluginIF(PluginI* pi)
+ : PluginIF(pi)
+ {
+ buffer = new float*[MAX_CHANNELS];
+ for (int i = 0; i < MAX_CHANNELS; ++i)
+ buffer[i] = new float[segmentSize];
+ }
+
+//---------------------------------------------------------
+// AuxPluginIF
+//---------------------------------------------------------
+
+AuxPluginIF::~AuxPluginIF()
+ {
+ for (int i = 0; i < MAX_CHANNELS; ++i) {
+ if (buffer[i])
+ delete[] buffer[i];
+ }
+ delete[] buffer;
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void AuxPluginIF::apply(unsigned nframes, float** s, float** /*dst*/)
+ {
+ // TODO: optimize copy away if there is no route
+ double vol[2];
+ vol[0] = volume * (1.0 - pan);
+ vol[1] = volume * (1.0 + pan);
+
+ for (int i = 0; i < pluginI->channel(); ++i) {
+ float* dst = buffer[i];
+ float* src = s[i];
+ double v = vol[i];
+ for (int k = 0; k < nframes; ++k)
+ *dst++ = (*src++) * v;
+ }
+ }
+
+//---------------------------------------------------------
+// getParameterName
+//---------------------------------------------------------
+
+const char* AuxPluginIF::getParameterName(int i) const
+ {
+ if (i == 0)
+ return "Volume";
+ else
+ return "Pan";
+ }
+
+//---------------------------------------------------------
+// setParam
+//---------------------------------------------------------
+
+void AuxPluginIF::setParam(int i, double val)
+ {
+ if (i == 0)
+ volume = val;
+ else
+ pan = val;
+ }
+
+//---------------------------------------------------------
+// param
+//---------------------------------------------------------
+
+float AuxPluginIF::param(int i) const
+ {
+ return i == 0 ? volume : pan;
+ }
+
+//---------------------------------------------------------
+// init
+//---------------------------------------------------------
+
+bool AuxPluginIF::init(Plugin* p)
+ {
+ volume = p->defaultValue(0);
+ pan = p->defaultValue(1);
+ return true;
+ }
+
diff --git a/muse/muse/auxplugin.h b/muse/muse/auxplugin.h
new file mode 100644
index 00000000..80624a27
--- /dev/null
+++ b/muse/muse/auxplugin.h
@@ -0,0 +1,81 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 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 __AUXPLUGIN_H__
+#define __AUXPLUGIN_H__
+
+#include "plugin.h"
+
+//---------------------------------------------------------
+// AuxPlugin
+//---------------------------------------------------------
+
+class AuxPlugin : public Plugin {
+
+ public:
+ AuxPlugin();
+
+ virtual QString label() const { return "Aux"; }
+ virtual QString name() const { return "Aux"; }
+ virtual unsigned long id() const { return 0; }
+ virtual QString maker() const { return ""; }
+ virtual QString copyright() const { return ""; }
+
+ void* instantiate() { return 0; }
+ virtual void range(int i, double*, double*) const;
+ virtual int parameter() const { return 2; }
+ virtual int inports() const { return 100; }
+ virtual int outports() const { return 100; }
+
+ virtual bool inPlaceCapable() const { return true; }
+ virtual PluginIF* createPIF(PluginI*);
+
+ virtual bool isLog(int k) const;
+ virtual bool isBool(int k) const;
+ virtual bool isInt(int k) const;
+ virtual double defaultValue(int) const;
+ };
+
+//---------------------------------------------------------
+// AuxPluginIF
+//---------------------------------------------------------
+
+class AuxPluginIF : public PluginIF {
+ double volume;
+ double pan;
+ float** buffer; // this buffer is filled by apply()
+ // _volume and _pan is applied
+
+ public:
+ AuxPluginIF(PluginI* pi);
+ virtual ~AuxPluginIF();
+
+ virtual void apply(unsigned nframes, float** src, float** dst);
+ virtual void activate() {}
+ virtual void deactivate() {}
+ virtual void cleanup() {}
+ virtual const char* getParameterName(int i) const;
+ virtual void setParam(int i, double val);
+ virtual float param(int i) const;
+ bool init(Plugin*);
+ };
+
+extern AuxPlugin* auxPlugin;
+#endif
diff --git a/muse/muse/conf.cpp b/muse/muse/conf.cpp
index 6520727a..65b1c229 100644
--- a/muse/muse/conf.cpp
+++ b/muse/muse/conf.cpp
@@ -114,8 +114,6 @@ void readConfiguration(QDomNode node)
config.trackBg[Track::AUDIO_OUTPUT] = readColor(node);
else if (tag == "groupTrackBg")
config.trackBg[Track::AUDIO_GROUP] = readColor(node);
- else if (tag == "auxTrackBg")
- config.trackBg[Track::AUDIO_AUX] = readColor(node);
else if (tag == "waveTrackBg")
config.trackBg[Track::WAVE] = readColor(node);
else if (tag == "inputTrackBg")
@@ -413,7 +411,6 @@ void MusE::writeGlobalConfiguration(Xml& xml) const
static const char* colorNames[Track::TRACK_TYPES] = {
"outputTrackBg",
"groupTrackBg",
- "auxTrackBg",
"waveTrackBg",
"inputTrackBg",
"synthTrackBg",
diff --git a/muse/muse/ctrl.h b/muse/muse/ctrl.h
index 3d5f7139..34a81c79 100644
--- a/muse/muse/ctrl.h
+++ b/muse/muse/ctrl.h
@@ -39,7 +39,34 @@ const int AC_MUTE = 2;
const int AC_AUX = 3; // 3 -- 3+NUM_AUX
const int AC_AUX_PAN = AC_AUX + NUM_AUX;
-inline int genACnum(int plugin, int ctrl) { return plugin * 0x10000 + ctrl; }
+const int CTRL_PLUGIN_MASK = 0x3ff0000;
+const int CTRL_PLUGIN_OFFSET = 0x10000;
+const int CTRL_INDEX_MASK = 0xffff;
+const int CTRL_PREFADER = 0x40000000;
+
+//---------------------------------------------------------
+// genACnum
+// create a controller number out of plugin index,
+// controller index and prefader flag
+//---------------------------------------------------------
+
+inline static int genACnum(int plugin, int ctrl, bool prefader) {
+ int pre = prefader ? CTRL_PREFADER : 0;
+ return pre | ((plugin+1) * CTRL_PLUGIN_OFFSET + ctrl);
+ }
+
+//---------------------------------------------------------
+// getCtrlPlugin
+// destill plugin index, controller index and prefader
+// flag from controller id
+//---------------------------------------------------------
+
+inline static void getCtrlPlugin(int id, bool* prefader, int* pluginIndex,
+ int* ctrlIndex) {
+ *prefader = (id & CTRL_PREFADER) ? true : false;
+ *pluginIndex = ((id & CTRL_PLUGIN_MASK) / CTRL_PLUGIN_OFFSET) - 1;
+ *ctrlIndex = id & CTRL_INDEX_MASK;
+ }
//---------------------------------------------------------
// ControllerName
diff --git a/muse/muse/ctrl/ctrldialog.cpp b/muse/muse/ctrl/ctrldialog.cpp
index 77307204..23eec660 100644
--- a/muse/muse/ctrl/ctrldialog.cpp
+++ b/muse/muse/ctrl/ctrldialog.cpp
@@ -24,6 +24,7 @@
#include "miditrack.h"
#include "audiotrack.h"
#include "plugin.h"
+#include "pipeline.h"
//---------------------------------------------------------
// CtrlDialog
@@ -71,12 +72,29 @@ CtrlDialog::CtrlDialog(Track* track, int currentId, QWidget* parent)
//
// present plugin parameter
//
- Pipeline* pl = ((AudioTrack*)track)->efxPipe();
+ Pipeline* pl = ((AudioTrack*)track)->prePipe();
int idx = 0;
- for (iPluginI i = pl->begin(); i != pl->end(); ++i, ++idx) {
- PluginI* plugin = *i;
- if (plugin == 0)
- continue;
+ foreach (PluginI* plugin, *pl) {
+ ci = new QTreeWidgetItem(tw, CTRL_NO_CTRL);
+ ci->setText(0, plugin->name());
+ int ncontroller = plugin->plugin()->parameter();
+ for (int i = 0; i < ncontroller; ++i) {
+ QString name(plugin->getParameterName(i));
+ int id = (idx + 1) * 0x1000 + i;
+ QTreeWidgetItem* cci = new QTreeWidgetItem(ci, id);
+ cci->setText(0, name);
+ Ctrl* ctrl = track->getController(id);
+ if (!ctrl->empty())
+ cci->setText(1, "*");
+ if (id == currentId) {
+ tw->setCurrentItem(cci);
+ tw->setItemSelected(cci, true);
+ }
+ }
+ }
+ pl = ((AudioTrack*)track)->postPipe();
+ idx = 0;
+ foreach (PluginI* plugin, *pl) {
ci = new QTreeWidgetItem(tw, CTRL_NO_CTRL);
ci->setText(0, plugin->name());
int ncontroller = plugin->plugin()->parameter();
diff --git a/muse/muse/gconfig.cpp b/muse/muse/gconfig.cpp
index 1d6f258a..78d24194 100644
--- a/muse/muse/gconfig.cpp
+++ b/muse/muse/gconfig.cpp
@@ -56,7 +56,6 @@ GlobalConfigValues config = {
{
QColor(Qt::white), // outputTrackBg;
QColor(Qt::yellow), // groupTrackBg;
- QColor(Qt::cyan), // auxTrackBg;
QColor(Qt::green), // waveTrackBg;
QColor(Qt::red), // inputTrackBg;
QColor(Qt::blue), // synthTrackBg;
diff --git a/muse/muse/icons.cpp b/muse/muse/icons.cpp
index bf2c3a1e..e7494902 100644
--- a/muse/muse/icons.cpp
+++ b/muse/muse/icons.cpp
@@ -131,7 +131,6 @@
#include "xpm/addtrack_audiogroup.xpm"
#include "xpm/addtrack_audioinput.xpm"
#include "xpm/addtrack_audiooutput.xpm"
-#include "xpm/addtrack_auxsend.xpm"
#include "xpm/addtrack_drumtrack.xpm"
#include "xpm/addtrack_wavetrack.xpm"
#include "xpm/edit_drumms.xpm"
@@ -251,7 +250,6 @@ QPixmap* addtrack_addmiditrackIcon;
QPixmap* addtrack_audiogroupIcon;
QPixmap* addtrack_audioinputIcon;
QPixmap* addtrack_audiooutputIcon;
-QPixmap* addtrack_auxsendIcon;
QPixmap* addtrack_drumtrackIcon;
QPixmap* addtrack_wavetrackIcon;
QPixmap* edit_drummsIcon;
@@ -399,7 +397,6 @@ void initIcons()
addtrack_audiogroupIcon = new QPixmap(addtrack_audiogroup_xpm);
addtrack_audioinputIcon = new QPixmap(addtrack_audioinput_xpm);
addtrack_audiooutputIcon = new QPixmap(addtrack_audiooutput_xpm);
- addtrack_auxsendIcon = new QPixmap(addtrack_auxsend_xpm);
addtrack_drumtrackIcon = new QPixmap(addtrack_drumtrack_xpm);
addtrack_wavetrackIcon = new QPixmap(addtrack_wavetrack_xpm);
edit_drummsIcon = new QPixmap(edit_drumms_xpm);
diff --git a/muse/muse/icons.h b/muse/muse/icons.h
index 0a87af3c..eae10087 100644
--- a/muse/muse/icons.h
+++ b/muse/muse/icons.h
@@ -116,7 +116,6 @@ extern QPixmap* addtrack_addmiditrackIcon;
extern QPixmap* addtrack_audiogroupIcon;
extern QPixmap* addtrack_audioinputIcon;
extern QPixmap* addtrack_audiooutputIcon;
-extern QPixmap* addtrack_auxsendIcon;
extern QPixmap* addtrack_drumtrackIcon;
extern QPixmap* addtrack_wavetrackIcon;
extern QPixmap* edit_drummsIcon;
diff --git a/muse/muse/ladspaplugin.cpp b/muse/muse/ladspaplugin.cpp
new file mode 100644
index 00000000..ee8b0e14
--- /dev/null
+++ b/muse/muse/ladspaplugin.cpp
@@ -0,0 +1,235 @@
+//=============================================================================
+// 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 "al/al.h"
+#include "ladspaplugin.h"
+#include "fastlog.h"
+#include "ctrl.h"
+
+//---------------------------------------------------------
+// defaultValue
+//---------------------------------------------------------
+
+float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k)
+ {
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[k];
+ LADSPA_PortRangeHintDescriptor rh = range.HintDescriptor;
+// bool isLog = LADSPA_IS_HINT_LOGARITHMIC(rh);
+ double val = 1.0;
+ float m = (rh & LADSPA_HINT_SAMPLE_RATE) ? float(AL::sampleRate) : 1.0f;
+ if (LADSPA_IS_HINT_DEFAULT_MINIMUM(rh)) {
+ val = range.LowerBound * m;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_LOW(rh)) {
+ if (LADSPA_IS_HINT_LOGARITHMIC(rh))
+ val = exp(fast_log10(range.LowerBound * m) * .75 +
+ log(range.UpperBound * m) * .25);
+ else
+ val = range.LowerBound*.75*m + range.UpperBound*.25*m;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(rh)) {
+ if (LADSPA_IS_HINT_LOGARITHMIC(rh))
+ val = exp(log(range.LowerBound * m) * .5 +
+ log10(range.UpperBound * m) * .5);
+ else
+ val = range.LowerBound*.5*m + range.UpperBound*.5*m;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_HIGH(rh)) {
+ if (LADSPA_IS_HINT_LOGARITHMIC(rh))
+ val = exp(log(range.LowerBound * m) * .25 +
+ log(range.UpperBound * m) * .75);
+ else
+ val = range.LowerBound*.25*m + range.UpperBound*.75*m;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(rh)) {
+ val = range.UpperBound*m;
+ }
+ else if (LADSPA_IS_HINT_DEFAULT_0(rh))
+ val = 0.0;
+ else if (LADSPA_IS_HINT_DEFAULT_1(rh))
+ val = 1.0;
+ else if (LADSPA_IS_HINT_DEFAULT_100(rh))
+ val = 100.0;
+ else if (LADSPA_IS_HINT_DEFAULT_440(rh))
+ val = 440.0;
+ return val;
+ }
+
+//---------------------------------------------------------
+// LadpsaPlugin
+//---------------------------------------------------------
+
+LadspaPlugin::LadspaPlugin(const QFileInfo* f,
+ const LADSPA_Descriptor_Function ldf,
+ const LADSPA_Descriptor* d)
+ : Plugin(f), ladspa(ldf), plugin(d)
+ {
+ _inports = 0;
+ _outports = 0;
+ _parameter = 0;
+ for (unsigned k = 0; k < plugin->PortCount; ++k) {
+ LADSPA_PortDescriptor pd = d->PortDescriptors[k];
+ static const int CI = LADSPA_PORT_CONTROL | LADSPA_PORT_INPUT;
+ if ((pd & CI) == CI) {
+ ++_parameter;
+ pIdx.push_back(k);
+ }
+ else if (pd & LADSPA_PORT_INPUT) {
+ ++_inports;
+ iIdx.push_back(k);
+ }
+ else if (pd & LADSPA_PORT_OUTPUT) {
+ ++_outports;
+ oIdx.push_back(k);
+ }
+ }
+ LADSPA_Properties properties = plugin->Properties;
+ _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(properties);
+ if (_inports != _outports)
+ _inPlaceCapable = false;
+ }
+
+//---------------------------------------------------------
+// instantiate
+//---------------------------------------------------------
+
+void* LadspaPlugin::instantiate()
+ {
+ return plugin->instantiate(plugin, AL::sampleRate);
+ }
+
+//---------------------------------------------------------
+// range
+//---------------------------------------------------------
+
+void LadspaPlugin::range(int i, double* min, double* max) const
+ {
+ i = pIdx[i];
+ LADSPA_PortRangeHint range = plugin->PortRangeHints[i];
+ LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
+ if (desc & LADSPA_HINT_TOGGLED) {
+ *min = 0.0;
+ *max = 1.0;
+ return;
+ }
+ double m = (desc & LADSPA_HINT_SAMPLE_RATE) ? float(AL::sampleRate) : 1.0f;
+
+ if (desc & LADSPA_HINT_BOUNDED_BELOW)
+ *min = range.LowerBound * m;
+ else
+ *min = 0.0;
+ if (desc & LADSPA_HINT_BOUNDED_ABOVE)
+ *max = range.UpperBound * m;
+ else
+ *max = 1.0;
+ }
+
+//---------------------------------------------------------
+// createPIF
+//---------------------------------------------------------
+
+PluginIF* LadspaPlugin::createPIF(PluginI* pi)
+ {
+ LadspaPluginIF* pif = new LadspaPluginIF(pi);
+ pif->init(pi->plugin());
+ return pif;
+ }
+
+//---------------------------------------------------------
+// LadspaPluginIF
+//---------------------------------------------------------
+
+LadspaPluginIF::LadspaPluginIF(PluginI* pi)
+ : PluginIF(pi)
+ {
+ descr = 0;
+ plugin = (LadspaPlugin*)(pi->plugin());
+ }
+
+//---------------------------------------------------------
+// init
+// return true on error
+//---------------------------------------------------------
+
+bool LadspaPluginIF::init(Plugin* pl)
+ {
+ handle = (LADSPA_Descriptor*) ((LadspaPlugin*)pl)->instantiate();
+ plugin = (LadspaPlugin*)pl;
+ descr = plugin->ladspaDescriptor();
+
+ int controlPorts = plugin->parameter();
+ controls = new LadspaPort[controlPorts];
+
+ for (int k = 0; k < controlPorts; ++k) {
+ controls[k].val = plugin->defaultValue(k);
+ descr->connect_port(handle, plugin->pIdx[k], &controls[k].val);
+ }
+ return handle == 0;
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void LadspaPluginIF::apply(unsigned nframes, float** src, float** dst)
+ {
+ int iports = plugin->inports();
+ int oports = plugin->outports();
+ int cports = plugin->parameter();
+
+ //
+ // update parameter
+ //
+ for (int i = 0; i < cports; ++i)
+ controls[i].val = pluginI->controllerList[i]->curVal().f;
+ //
+ // set connections
+ //
+ for (int k = 0; k < iports; ++k)
+ descr->connect_port(handle, plugin->iIdx[k], src[k]);
+ for (int k = 0; k < oports; ++k)
+ descr->connect_port(handle, plugin->oIdx[k], dst[k]);
+
+ descr->run(handle, nframes);
+ }
+
+//---------------------------------------------------------
+// defaultValue
+//---------------------------------------------------------
+
+double LadspaPlugin::defaultValue(int k) const
+ {
+ k = pIdx[k];
+ return ladspaDefaultValue(plugin, k);
+ }
+
+//---------------------------------------------------------
+// activate
+//---------------------------------------------------------
+
+void LadspaPluginIF::activate()
+ {
+ //
+ // TODO: init values?
+ //
+ if (descr->activate)
+ descr->activate(handle);
+ }
+
diff --git a/muse/muse/ladspaplugin.h b/muse/muse/ladspaplugin.h
new file mode 100644
index 00000000..4c492813
--- /dev/null
+++ b/muse/muse/ladspaplugin.h
@@ -0,0 +1,127 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 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 __LADSPAPLUGIN_H__
+#define __LADSPAPLUGIN_H__
+
+#include "ladspa.h"
+#include "plugin.h"
+
+//---------------------------------------------------------
+// LadspaPlugin
+//---------------------------------------------------------
+
+class LadspaPlugin : public Plugin {
+ LADSPA_Descriptor_Function ladspa;
+ const LADSPA_Descriptor* plugin;
+
+ protected:
+ int _parameter;
+ std::vector<int> pIdx;
+
+ int _inports;
+ std::vector<int> iIdx;
+
+ int _outports;
+ std::vector<int> oIdx;
+
+ bool _inPlaceCapable;
+ friend class LadspaPluginIF;
+
+ public:
+ LadspaPlugin(const QFileInfo* f,
+ const LADSPA_Descriptor_Function,
+ const LADSPA_Descriptor* d);
+
+ virtual QString label() const { return QString(plugin->Label); }
+ virtual QString name() const { return QString(plugin->Name); }
+ virtual unsigned long id() const { return plugin->UniqueID; }
+ virtual QString maker() const { return QString(plugin->Maker); }
+ virtual QString copyright() const { return QString(plugin->Copyright); }
+
+ void* instantiate();
+ virtual void range(int i, double*, double*) const;
+ virtual int parameter() const { return _parameter; }
+ virtual int inports() const { return _inports; }
+ virtual int outports() const { return _outports; }
+
+ virtual bool inPlaceCapable() const { return _inPlaceCapable; }
+ virtual PluginIF* createPIF(PluginI*);
+ const LADSPA_Descriptor* ladspaDescriptor() const { return plugin; }
+
+ virtual bool isLog(int k) const {
+ LADSPA_PortRangeHint r = plugin->PortRangeHints[pIdx[k]];
+ return LADSPA_IS_HINT_LOGARITHMIC(r.HintDescriptor);
+ }
+ virtual bool isBool(int k) const {
+ return LADSPA_IS_HINT_TOGGLED(plugin->PortRangeHints[pIdx[k]].HintDescriptor);
+ }
+ virtual bool isInt(int k) const {
+ LADSPA_PortRangeHint r = plugin->PortRangeHints[pIdx[k]];
+ return LADSPA_IS_HINT_INTEGER(r.HintDescriptor);
+ }
+ virtual double defaultValue(int) const;
+ };
+
+//---------------------------------------------------------
+// LadspaPort
+//---------------------------------------------------------
+
+struct LadspaPort {
+ float val;
+ };
+
+//---------------------------------------------------------
+// LadspaPluginIF
+//---------------------------------------------------------
+
+class LadspaPluginIF : public PluginIF {
+ const LADSPA_Descriptor* descr;
+ LADSPA_Handle handle; // per instance
+ LadspaPlugin* plugin;
+
+ LadspaPort* controls;
+
+ public:
+ LadspaPluginIF(PluginI* pi);
+
+ virtual void apply(unsigned nframes, float** src, float** dst);
+ virtual void activate();
+ virtual void deactivate() {
+ if (descr->deactivate)
+ descr->deactivate(handle);
+ }
+ virtual void cleanup() {
+ if (descr->cleanup)
+ descr->cleanup(handle);
+ }
+ virtual const char* getParameterName(int i) const {
+ return plugin->plugin->PortNames[plugin->pIdx[i]];
+ }
+ virtual void setParam(int i, double val) { controls[i].val = val; }
+ virtual float param(int i) const { return controls[i].val; }
+ bool init(Plugin*);
+ };
+
+extern float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k);
+
+#endif
+
+
diff --git a/muse/muse/mixer/astrip.cpp b/muse/muse/mixer/astrip.cpp
index c8746430..03b0f133 100644
--- a/muse/muse/mixer/astrip.cpp
+++ b/muse/muse/mixer/astrip.cpp
@@ -25,6 +25,191 @@
#include "awl/panentry.h"
//---------------------------------------------------------
+// AudioStrip
+// create mixer strip
+//---------------------------------------------------------
+
+AudioStrip::AudioStrip(Mixer* m, AudioTrack* t, bool align)
+ : Strip(m, t, align)
+ {
+ iR = 0;
+ oR = 0;
+ off = 0;
+ volume = -1.0;
+ channel = t->channels();
+
+ //---------------------------------------------------
+ // prefader plugin rack
+ //---------------------------------------------------
+
+ rack1 = new EffectRack(this, t, true);
+ rack1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ rack1->setFixedHeight(rack1->sizeHint().height() + 2);
+ layout->addWidget(rack1);
+
+ //---------------------------------------------------
+ // mono/stereo pre/post
+ //---------------------------------------------------
+
+ QHBoxLayout* ppBox = new QHBoxLayout;
+ stereo = newStereoButton();
+ stereo->setChecked(channel == 2);
+ stereo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ stereo->setFixedHeight(LABEL_HEIGHT);
+ connect(stereo, SIGNAL(clicked(bool)), SLOT(stereoToggled(bool)));
+
+ pre = new QToolButton;
+ pre->setFont(config.fonts[1]);
+ pre->setCheckable(true);
+ pre->setText(tr("Pre"));
+ pre->setToolTip(tr("pre fader - post fader"));
+ pre->setChecked(t->prefader());
+ pre->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ pre->setFixedHeight(LABEL_HEIGHT);
+ connect(pre, SIGNAL(clicked(bool)), SLOT(preToggled(bool)));
+
+ ppBox->addWidget(stereo);
+ ppBox->addWidget(pre);
+ layout->addLayout(ppBox);
+
+ //---------------------------------------------------
+ // slider, label
+ //---------------------------------------------------
+
+ slider = new Awl::MeterSlider(this);
+ slider->setRange(config.minSlider-0.1f, 10.0f);
+ slider->setFixedWidth(60);
+ slider->setChannel(channel);
+ Ctrl* ctrl = t->getController(AC_VOLUME);
+ double vol = 0.0f;
+ if (ctrl)
+ vol = ctrl->curVal().f;
+ slider->setValue(vol);
+ layout->addWidget(slider, 100, Qt::AlignRight);
+
+ sl = new Awl::VolEntry(this);
+ sl->setFont(config.fonts[1]);
+ sl->setSuffix(tr("dB"));
+ sl->setFrame(true);
+ sl->setValue(vol);
+
+ connect(slider, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double)));
+ connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double)));
+
+ connect(slider, SIGNAL(sliderPressed(int)), SLOT(volumePressed()));
+ connect(slider, SIGNAL(sliderReleased(int)), SLOT(volumeReleased()));
+ connect(slider, SIGNAL(meterClicked()), SLOT(resetPeaks()));
+ layout->addWidget(sl);
+
+ //---------------------------------------------------
+ // pan, balance
+ //---------------------------------------------------
+
+ pan = addPanKnob(&panl);
+ double panv = t->getController(AC_PAN)->curVal().f;
+ pan->setValue(panv);
+ panl->setValue(panv);
+
+ //---------------------------------------------------
+ // postfader plugin rack
+ //---------------------------------------------------
+
+ rack2 = new EffectRack(this, t, false);
+ rack2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ rack2->setFixedHeight(rack1->sizeHint().height() + 2);
+ layout->addWidget(rack2);
+
+ //---------------------------------------------------
+ // mute, solo, record
+ //---------------------------------------------------
+
+ Track::TrackType type = t->type();
+
+ QHBoxLayout* smBox1 = new QHBoxLayout(0);
+ QHBoxLayout* smBox2 = new QHBoxLayout(0);
+
+ mute = newMuteButton();
+ mute->setChecked(t->mute());
+ mute->setFixedSize(buttonSize);
+ connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
+ connect(t, SIGNAL(muteChanged(bool)), mute, SLOT(setChecked(bool)));
+ smBox2->addWidget(mute);
+
+ solo = newSoloButton();
+ solo->setDisabled(true);
+ solo->setFixedSize(buttonSize);
+ smBox2->addWidget(solo);
+ connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
+ connect(t, SIGNAL(soloChanged(bool)), solo, SLOT(setChecked(bool)));
+
+ off = newOffButton();
+ off->setFixedSize(buttonSize);
+ off->setChecked(t->off());
+ connect(off, SIGNAL(clicked(bool)), SLOT(offToggled(bool)));
+ connect(t, SIGNAL(offChanged(bool)), this, SLOT(updateOffState()));
+
+ smBox1->addWidget(off);
+
+ if (track->canRecord()) {
+ record = newRecordButton();
+ record->setFixedSize(buttonSize);
+ if (type == Track::AUDIO_OUTPUT)
+ record->setToolTip(tr("record downmix"));
+ record->setChecked(t->recordFlag());
+ connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
+ connect(t, SIGNAL(recordChanged(bool)), record, SLOT(setChecked(bool)));
+ smBox1->addWidget(record);
+ }
+ else {
+ record = 0;
+ smBox1->addStretch(100);
+ }
+
+ layout->addLayout(smBox1);
+ layout->addLayout(smBox2);
+
+ //---------------------------------------------------
+ // automation read write
+ //---------------------------------------------------
+
+ addAutomationButtons();
+
+ //---------------------------------------------------
+ // 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);
+
+ if (off) {
+ updateOffState(); // init state
+ }
+ connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(track, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
+ connect(track, SIGNAL(autoReadChanged(bool)), SLOT(autoChanged()));
+ connect(track, SIGNAL(autoWriteChanged(bool)), SLOT(autoChanged()));
+ autoChanged();
+ }
+
+//---------------------------------------------------------
// heartBeat
//---------------------------------------------------------
@@ -83,7 +268,8 @@ void AudioStrip::updateOffState()
pan->setEnabled(val);
panl->setEnabled(val);
pre->setEnabled(val);
- rack->setEnabled(val);
+ rack1->setEnabled(val);
+ rack2->setEnabled(val);
if (track->type() != Track::AUDIO_SOFTSYNTH)
stereo->setEnabled(val);
@@ -126,20 +312,6 @@ void AudioStrip::stereoToggled(bool val)
}
//---------------------------------------------------------
-// auxChanged
-//---------------------------------------------------------
-
-void AudioStrip::auxChanged(double v, int idx)
- {
- if (auxValue[idx] != v) {
- CVal val;
- val.f = v;
- song->setControllerVal(track, AC_AUX+idx, val);
- auxValue[idx] = v;
- }
- }
-
-//---------------------------------------------------------
// volumeChanged
//---------------------------------------------------------
@@ -151,35 +323,6 @@ void AudioStrip::volumeChanged(double v)
}
//---------------------------------------------------------
-// setAux
-//---------------------------------------------------------
-
-void AudioStrip::setAux(double val, int idx)
- {
- auxKnob[idx]->setValue(val);
- auxLabel[idx]->setValue(val);
- auxValue[idx] = val;
- }
-
-//---------------------------------------------------------
-// auxPressed
-//---------------------------------------------------------
-
-void AudioStrip::auxPressed(int n)
- {
- ((AudioTrack*)track)->startAutoRecord(AC_AUX+n);
- }
-
-//---------------------------------------------------------
-// auxReleased
-//---------------------------------------------------------
-
-void AudioStrip::auxReleased(int n)
- {
- ((AudioTrack*)track)->stopAutoRecord(AC_AUX+n);
- }
-
-//---------------------------------------------------------
// volumePressed
//---------------------------------------------------------
@@ -258,53 +401,6 @@ void AudioStrip::updateChannels()
}
//---------------------------------------------------------
-// addAuxKnob
-//---------------------------------------------------------
-
-Awl::VolKnob* AudioStrip::addAuxKnob(int id, Awl::VolEntry** dlabel)
- {
- QString label;
-
- Awl::VolKnob* knob = new Awl::VolKnob(this);
- knob->setToolTip(tr("aux send level"));
- knob->setRange(config.minSlider-0.1f, 10.0f);
-
- Awl::VolEntry* pl = new Awl::VolEntry(this);
- pl->setRange(config.minSlider, 10.0f);
- label.sprintf("Aux%d", id+1);
-
- knob->setFixedWidth(STRIP_WIDTH/2-2);
- knob->setFixedHeight(STRIP_WIDTH/2);
-
- if (dlabel)
- *dlabel = pl;
- pl->setFont(config.fonts[1]);
- pl->setFrame(true);
- pl->setFixedWidth(STRIP_WIDTH/2-2);
-
- QLabel* plb = new QLabel(label, this);
- plb->setFont(config.fonts[1]);
- plb->setFixedWidth(STRIP_WIDTH/2-2);
- plb->setAlignment(Qt::AlignCenter);
-
- QGridLayout* pangrid = new QGridLayout;
- pangrid->setSpacing(0);
- pangrid->setMargin(0);
- pangrid->addWidget(plb, 0, 0);
- pangrid->addWidget(pl, 1, 0);
- pangrid->addWidget(knob, 0, 1, 2, 1);
- layout->addLayout(pangrid);
-
- knob->setId(id);
-
- connect(knob, SIGNAL(sliderPressed(int)), SLOT(auxPressed(int)));
- connect(knob, SIGNAL(sliderReleased(int)), SLOT(auxReleased(int)));
- connect(knob, SIGNAL(valueChanged(double, int)), SLOT(auxChanged(double, int)));
- connect(pl, SIGNAL(valueChanged(double, int)), SLOT(auxChanged(double, int)));
- return knob;
- }
-
-//---------------------------------------------------------
// addPanKnob
//---------------------------------------------------------
@@ -347,229 +443,6 @@ Awl::PanKnob* AudioStrip::addPanKnob(Awl::PanEntry** dlabel)
}
//---------------------------------------------------------
-// AudioStrip
-// create mixer strip
-//---------------------------------------------------------
-
-AudioStrip::AudioStrip(Mixer* m, AudioTrack* t, bool align)
- : Strip(m, t, align)
- {
- iR = 0;
- oR = 0;
- off = 0;
- volume = -1.0;
- channel = t->channels();
-
- //---------------------------------------------------
- // plugin rack
- //---------------------------------------------------
-
- rack = new EffectRack(this, t);
- rack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- rack->setFixedHeight(rack->sizeHint().height() + 2);
- layout->addWidget(rack);
-
- //---------------------------------------------------
- // mono/stereo pre/post
- //---------------------------------------------------
-
- QHBoxLayout* ppBox = new QHBoxLayout;
- stereo = newStereoButton();
- stereo->setChecked(channel == 2);
- stereo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- stereo->setFixedHeight(LABEL_HEIGHT);
- connect(stereo, SIGNAL(clicked(bool)), SLOT(stereoToggled(bool)));
-
- pre = new QToolButton;
- pre->setFont(config.fonts[1]);
- pre->setCheckable(true);
- pre->setText(tr("Pre"));
- pre->setToolTip(tr("pre fader - post fader"));
- pre->setChecked(t->prefader());
- pre->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- pre->setFixedHeight(LABEL_HEIGHT);
- connect(pre, SIGNAL(clicked(bool)), SLOT(preToggled(bool)));
-
- ppBox->addWidget(stereo);
- ppBox->addWidget(pre);
- layout->addLayout(ppBox);
-
- //---------------------------------------------------
- // aux send
- //---------------------------------------------------
-
- int auxsSize = song->auxs()->size();
- if (t->hasAuxSend()) {
- for (int idx = 0; idx < auxsSize; ++idx) {
- Awl::VolEntry* al;
- Awl::VolKnob* ak = addAuxKnob(idx, &al);
- auxKnob.push_back(ak);
- auxLabel.push_back(al);
- auxValue.push_back(0.0f);
- double as = t->getController(AC_AUX+idx)->curVal().f;
- ak->setValue(as);
- al->setValue(as);
- }
- }
- else if (auxsSize && _align)
- layout->addSpacing((STRIP_WIDTH/2 + 2) * auxsSize);
-
- //---------------------------------------------------
- // slider, label
- //---------------------------------------------------
-
- slider = new Awl::MeterSlider(this);
- slider->setRange(config.minSlider-0.1f, 10.0f);
- slider->setFixedWidth(60);
- slider->setChannel(channel);
- Ctrl* ctrl = t->getController(AC_VOLUME);
- double vol = 0.0f;
- if (ctrl)
- vol = ctrl->curVal().f;
- slider->setValue(vol);
- layout->addWidget(slider, 100, Qt::AlignRight);
-
- sl = new Awl::VolEntry(this);
- sl->setFont(config.fonts[1]);
- sl->setSuffix(tr("dB"));
- sl->setFrame(true);
- sl->setValue(vol);
-
- connect(slider, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double)));
- connect(sl, SIGNAL(valueChanged(double,int)), SLOT(volumeChanged(double)));
-
- connect(slider, SIGNAL(sliderPressed(int)), SLOT(volumePressed()));
- connect(slider, SIGNAL(sliderReleased(int)), SLOT(volumeReleased()));
- connect(slider, SIGNAL(meterClicked()), SLOT(resetPeaks()));
- layout->addWidget(sl);
-
- //---------------------------------------------------
- // pan, balance
- //---------------------------------------------------
-
- pan = addPanKnob(&panl);
- double panv = t->getController(AC_PAN)->curVal().f;
- pan->setValue(panv);
- panl->setValue(panv);
-
- //---------------------------------------------------
- // mute, solo, record
- //---------------------------------------------------
-
- Track::TrackType type = t->type();
-
- QHBoxLayout* smBox1 = new QHBoxLayout(0);
- QHBoxLayout* smBox2 = new QHBoxLayout(0);
-
- mute = newMuteButton();
- mute->setChecked(t->mute());
- mute->setFixedSize(buttonSize);
- connect(mute, SIGNAL(clicked(bool)), SLOT(muteToggled(bool)));
- connect(t, SIGNAL(muteChanged(bool)), mute, SLOT(setChecked(bool)));
- smBox2->addWidget(mute);
-
- solo = newSoloButton();
- solo->setDisabled(true);
- solo->setFixedSize(buttonSize);
- smBox2->addWidget(solo);
- connect(solo, SIGNAL(clicked(bool)), SLOT(soloToggled(bool)));
- connect(t, SIGNAL(soloChanged(bool)), solo, SLOT(setChecked(bool)));
-
- off = newOffButton();
- off->setFixedSize(buttonSize);
- off->setChecked(t->off());
- connect(off, SIGNAL(clicked(bool)), SLOT(offToggled(bool)));
- connect(t, SIGNAL(offChanged(bool)), this, SLOT(updateOffState()));
-
- smBox1->addWidget(off);
-
- if (track->canRecord()) {
- record = newRecordButton();
- record->setFixedSize(buttonSize);
- if (type == Track::AUDIO_OUTPUT)
- record->setToolTip(tr("record downmix"));
- record->setChecked(t->recordFlag());
- connect(record, SIGNAL(clicked(bool)), SLOT(recordToggled(bool)));
- connect(t, SIGNAL(recordChanged(bool)), record, SLOT(setChecked(bool)));
- smBox1->addWidget(record);
- }
- else {
- record = 0;
- smBox1->addStretch(100);
- }
-
- layout->addLayout(smBox1);
- layout->addLayout(smBox2);
-
- //---------------------------------------------------
- // automation read write
- //---------------------------------------------------
-
- addAutomationButtons();
-
- //---------------------------------------------------
- // routing
- //---------------------------------------------------
-
- QHBoxLayout* rBox = new QHBoxLayout(0);
- if (type != Track::AUDIO_AUX) {
- 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()));
- }
- else
- rBox->addSpacing((STRIP_WIDTH-4)/2);
- 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);
-
- if (off) {
- updateOffState(); // init state
- }
- connect(heartBeatTimer, SIGNAL(timeout()), SLOT(heartBeat()));
- connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
- connect(track, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
- connect(track, SIGNAL(autoReadChanged(bool)), SLOT(autoChanged()));
- connect(track, SIGNAL(autoWriteChanged(bool)), SLOT(autoChanged()));
- autoChanged();
- }
-
-//---------------------------------------------------------
-// addAuxPorts
-//---------------------------------------------------------
-
-static void addAuxPorts(AudioTrack* t, QMenu* lb, RouteList* r)
- {
- AuxList* al = song->auxs();
- for (iAudioAux i = al->begin(); i != al->end(); ++i) {
- Track* track = *i;
- if (t == track)
- continue;
- QString s(track->name());
- QAction* it = lb->addAction(s); //int it = lb->insertItem(s);
- for (iRoute ir = r->begin(); ir != r->end(); ++ir) {
- if (ir->type == 0 && ir->track == track) {
- it->setCheckable(true); //lb->setItemChecked(it, true);
- it->setChecked(true);
- break;
- }
- }
- }
- }
-
-//---------------------------------------------------------
// addInPorts
//---------------------------------------------------------
@@ -780,7 +653,6 @@ void AudioStrip::iRoutePressed()
addWavePorts(t, pup, irl);
addInPorts(t, pup, irl);
addGroupPorts(t, pup, irl);
- addAuxPorts(t, pup, irl);
addSyntiPorts(t, pup, irl);
break;
case Track::WAVE:
@@ -884,9 +756,6 @@ void AudioStrip::oRoutePressed()
addOutPorts(t, pup, orl);
addGroupPorts(t, pup, orl);
break;
- case Track::AUDIO_AUX:
- addOutPorts(t, pup, orl);
- break;
}
QAction* n = pup->exec(QCursor::pos());
if (n != 0) {
@@ -968,14 +837,6 @@ void AudioStrip::controllerChanged(int id)
break;
case AC_MUTE:
break;
- case AC_AUX...AC_AUX+NUM_AUX:
- {
- int idx = id - AC_AUX;
- auxKnob[idx]->setValue(val);
- auxLabel[idx]->setValue(val);
- auxValue[idx] = val;
- }
- break;
default:
break;
}
@@ -997,13 +858,6 @@ void AudioStrip::autoChanged()
bool ec = !ar || (ar && aw);
slider->setEnabled(ec);
sl->setEnabled(ec);
- if (((AudioTrack*)track)->hasAuxSend()) {
- int auxsSize = song->auxs()->size();
- for (int idx = 0; idx < auxsSize; ++idx) {
- auxKnob[idx]->setEnabled(ec);
- auxLabel[idx]->setEnabled(ec);
- }
- }
pan->setEnabled(ec);
panl->setEnabled(ec);
}
diff --git a/muse/muse/mixer/astrip.h b/muse/muse/mixer/astrip.h
index a1ded865..d69f8ac8 100644
--- a/muse/muse/mixer/astrip.h
+++ b/muse/muse/mixer/astrip.h
@@ -32,7 +32,8 @@ class AudioStrip : public Strip {
Q_OBJECT
int channel;
- EffectRack* rack;
+ EffectRack* rack1;
+ EffectRack* rack2;
Awl::MeterSlider* slider;
Awl::VolEntry* sl;
@@ -42,14 +43,9 @@ class AudioStrip : public Strip {
Awl::PanEntry* panl;
double panVal;
- std::vector<Awl::VolKnob*> auxKnob;
- std::vector<Awl::VolEntry*> auxLabel;
- std::vector<double> auxValue;
-
QToolButton* stereo;
QToolButton* pre;
- Awl::VolKnob* addAuxKnob(int, Awl::VolEntry**);
Awl::PanKnob* addPanKnob(Awl::PanEntry**);
QToolButton* iR;
@@ -65,7 +61,6 @@ class AudioStrip : public Strip {
void offToggled(bool);
void iRoutePressed();
void oRoutePressed();
- void auxChanged(double, int);
void volumeChanged(double);
void volumePressed();
void volumeReleased();
@@ -73,9 +68,6 @@ class AudioStrip : public Strip {
void setPan(double);
void panPressed();
void panReleased();
- void setAux(double, int);
- void auxPressed(int);
- void auxReleased(int);
void muteToggled(bool);
void soloToggled(bool);
void recordToggled(bool);
diff --git a/muse/muse/mixer/mixer.cpp b/muse/muse/mixer/mixer.cpp
index dea62c5d..8424f817 100644
--- a/muse/muse/mixer/mixer.cpp
+++ b/muse/muse/mixer/mixer.cpp
@@ -28,7 +28,6 @@ Mixer::Mixer(QWidget* parent, MixerConfig* c)
{
mustUpdateMixer = false;
cfg = c;
- oldAuxsSize = 0;
routingDialog = 0;
setWindowTitle(tr("MusE: Mixer"));
setWindowIcon(*museIcon);
@@ -51,7 +50,6 @@ Mixer::Mixer(QWidget* parent, MixerConfig* c)
showOutputTracksId = menuView->addAction(tr("Show Output Tracks"));
showGroupTracksId = menuView->addAction(tr("Show Group Tracks"));
showInputTracksId = menuView->addAction(tr("Show Input Tracks"));
- showAuxTracksId = menuView->addAction(tr("Show Aux Tracks"));
showSyntiTracksId = menuView->addAction(tr("Show Synthesizer"));
connect(menuView, SIGNAL(triggered(QAction*)), SLOT(showTracksChanged(QAction*)));
@@ -63,7 +61,6 @@ Mixer::Mixer(QWidget* parent, MixerConfig* c)
showOutputTracksId->setCheckable(true);
showGroupTracksId->setCheckable(true);
showInputTracksId->setCheckable(true);
- showAuxTracksId->setCheckable(true);
showSyntiTracksId->setCheckable(true);
QScrollArea* view = new QScrollArea;
@@ -148,7 +145,6 @@ void Mixer::clear()
delete i;
}
stripList.clear();
- oldAuxsSize = -1;
}
//---------------------------------------------------------
@@ -165,11 +161,9 @@ void Mixer::updateMixer(int action)
showOutputTracksId->setChecked(cfg->showOutputTracks);
showGroupTracksId->setChecked(cfg->showGroupTracks);
showInputTracksId->setChecked(cfg->showInputTracks);
- showAuxTracksId->setChecked(cfg->showAuxTracks);
showSyntiTracksId->setChecked(cfg->showSyntiTracks);
- int auxsSize = song->auxs()->size();
- if (action == STRIP_REMOVED && auxsSize == oldAuxsSize) {
+ if (action == STRIP_REMOVED) {
StripList::iterator si = stripList.begin();
for (; si != stripList.end();) {
Track* track = (*si)->getTrack();
@@ -190,7 +184,6 @@ void Mixer::updateMixer(int action)
}
clear();
- oldAuxsSize = auxsSize;
int idx = 0;
//---------------------------------------------------
@@ -273,16 +266,6 @@ void Mixer::updateMixer(int action)
}
//---------------------------------------------------
- // Aux
- //---------------------------------------------------
-
- if (cfg->showAuxTracks) {
- AuxList* al = song->auxs();
- for (iAudioAux i = al->begin(); i != al->end(); ++i)
- addStrip(*i, idx++);
- }
-
- //---------------------------------------------------
// Master
//---------------------------------------------------
@@ -377,8 +360,6 @@ void Mixer::showTracksChanged(QAction* id)
cfg->showGroupTracks = val;
else if (id == showInputTracksId)
cfg->showInputTracks = val;
- else if (id == showAuxTracksId)
- cfg->showAuxTracks = val;
else if (id == showSyntiTracksId)
cfg->showSyntiTracks = val;
else if (id == showMidiInPortId)
@@ -403,7 +384,6 @@ void Mixer::write(Xml& xml, const char* name)
xml.intTag("showWaveTracks", cfg->showWaveTracks);
xml.intTag("showGroupTracks", cfg->showGroupTracks);
xml.intTag("showInputTracks", cfg->showInputTracks);
- xml.intTag("showAuxTracks", cfg->showAuxTracks);
xml.intTag("showSyntiTracks", cfg->showSyntiTracks);
xml.intTag("showMidiInPorts", cfg->showMidiInPorts);
xml.intTag("showMidiOutPorts", cfg->showMidiOutPorts);
diff --git a/muse/muse/mixer/mixer.h b/muse/muse/mixer/mixer.h
index 3d063bba..df86dad5 100644
--- a/muse/muse/mixer/mixer.h
+++ b/muse/muse/mixer/mixer.h
@@ -46,10 +46,8 @@ class Mixer : public QMainWindow {
QAction* showWaveTracksId;
QAction* showGroupTracksId;
QAction* showInputTracksId;
- QAction* showAuxTracksId;
QAction* showSyntiTracksId;
- int oldAuxsSize;
bool mustUpdateMixer;
virtual void closeEvent(QCloseEvent*);
diff --git a/muse/muse/mixer/mstrip.cpp b/muse/muse/mixer/mstrip.cpp
index 20b12a5e..8e37816b 100644
--- a/muse/muse/mixer/mstrip.cpp
+++ b/muse/muse/mixer/mstrip.cpp
@@ -97,10 +97,6 @@ MidiChannelStrip::MidiChannelStrip(Mixer* m, MidiChannel* t, bool align)
addKnob(CTRL_REVERB_SEND, KNOB_REV_SEND, tr("ReverbSend"), tr("Rev"), SLOT(ctrlChanged(double,int)), true);
addKnob(CTRL_CHORUS_SEND, KNOB_CHOR_SEND, tr("ChorusSend"), tr("Cho"), SLOT(ctrlChanged(double,int)), true);
- int auxsSize = song->auxs()->size();
- if (auxsSize)
- layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize);
-
//---------------------------------------------------
// slider, label, meter
//---------------------------------------------------
@@ -399,9 +395,8 @@ void MidiChannelStrip::iRoutePressed()
MidiStrip::MidiStrip(Mixer* m, MidiTrack* t, bool align)
: Strip(m, t, align)
{
- int auxsSize = song->auxs()->size();
if (_align)
- layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2 * 3);
+ layout->addSpacing(STRIP_WIDTH/2 * 3);
//---------------------------------------------------
// slider, label, meter
@@ -692,10 +687,8 @@ MidiOutPortStrip::MidiOutPortStrip(Mixer* m, MidiOutPort* t, bool align)
rack->setFixedSize(STRIP_WIDTH, rack->sizeHint().height()+2);
layout->addWidget(rack);
- int auxsSize = song->auxs()->size();
if (_align)
-// layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2 * 3);
- layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2);
+ layout->addSpacing(STRIP_WIDTH/2);
volumeTouched = false;
@@ -1045,10 +1038,6 @@ MidiInPortStrip::MidiInPortStrip(Mixer* m, MidiInPort* t, bool align)
// layout->addSpacing(STRIP_WIDTH/2);
layout->addSpacing(LABEL_HEIGHT);
- int auxsSize = song->auxs()->size();
- if (_align && auxsSize)
- layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize);
-
//---------------------------------------------------
// slider, label, meter
//---------------------------------------------------
@@ -1345,9 +1334,8 @@ void MidiInPortStrip::iRoutePressed()
MidiSyntiStrip::MidiSyntiStrip(Mixer* m, MidiSynti* t, bool align)
: Strip(m, t, align)
{
- int auxsSize = song->auxs()->size();
if (_align)
- layout->addSpacing((STRIP_WIDTH/2 + 1) * auxsSize + STRIP_WIDTH/2 * 3);
+ layout->addSpacing(STRIP_WIDTH/2 * 3);
volumeTouched = false;
diff --git a/muse/muse/mixer/rack.cpp b/muse/muse/mixer/rack.cpp
index 46f9332c..44d49922 100644
--- a/muse/muse/mixer/rack.cpp
+++ b/muse/muse/mixer/rack.cpp
@@ -11,7 +11,8 @@
#include "audio.h"
#include "icons.h"
#include "gconfig.h"
-#include "plugin.h"
+#include "pipeline.h"
+#include "auxplugin.h"
#include "plugingui.h"
#include "widgets/filedialog.h"
#include "muse.h"
@@ -22,9 +23,10 @@ static const int PipelineDepth = 4;
// EffectRack
//---------------------------------------------------------
-EffectRack::EffectRack(QWidget* parent, AudioTrack* t)
+EffectRack::EffectRack(QWidget* parent, AudioTrack* t, bool flag)
: QListWidget(parent)
{
+ prefader = flag;
setAttribute(Qt::WA_DeleteOnClose, true);
verticalScrollBar()->setStyle(smallStyle);
@@ -63,23 +65,15 @@ void EffectRack::songChanged(int typ)
return;
clear();
- int i = 0;
- foreach (PluginI* plugin, *(track->efxPipe())) {
- QListWidgetItem* item = new QListWidgetItem(this, EFFECT_TYPE + i);
- ++i;
+ Pipeline* pipe = prefader ? track->prePipe() : track->postPipe();
+ foreach (PluginI* plugin, *pipe) {
+ QListWidgetItem* item = new QListWidgetItem(this);
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);
}
- //
- // debug: dummy
- //
- QListWidgetItem* item = new QListWidgetItem(this, SEND_TYPE);
- item->setText("Aux 1");
- item->setToolTip("Auxiliary Send 1");
- item->setBackgroundColor(Qt::white);
}
//---------------------------------------------------------
@@ -93,7 +87,7 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
int idx = -1;
QString name;
- Pipeline* pipe = track->efxPipe();
+ Pipeline* pipe = prefader ? track->prePipe() : track->postPipe();
QMenu* menu = new QMenu;
QAction* upAction = menu->addAction(QIcon(*upIcon), tr("move up"));
@@ -123,21 +117,14 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
idx = row(item);
upAction->setEnabled(idx != 0);
downAction->setEnabled(idx < pipe->size()-1);
- if (item->type() < SEND_TYPE) {
- idx = item->type();
- showCustomAction->setEnabled(pipe->hasNativeGui(idx));
- bypassAction->setEnabled(true);
- showAction->setEnabled(true);
-
- bypassAction->setChecked(!pipe->isOn(idx));
- showAction->setChecked(pipe->guiVisible(idx));
- showCustomAction->setChecked(pipe->nativeGuiVisible(idx));
- }
- else {
- showCustomAction->setEnabled(false);
- bypassAction->setEnabled(false);
- showAction->setEnabled(false);
- }
+ idx = item->type();
+ showCustomAction->setEnabled(pipe->hasNativeGui(idx));
+ bypassAction->setEnabled(true);
+ showAction->setEnabled(true);
+
+ bypassAction->setChecked(!pipe->isOn(idx));
+ showAction->setChecked(pipe->guiVisible(idx));
+ showCustomAction->setChecked(pipe->nativeGuiVisible(idx));
}
QAction* sel = menu->exec(mapToGlobal(pt), newAction);
@@ -150,7 +137,7 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
return;
}
if (sel == removeAction) {
- audio->msgAddPlugin(track, idx, 0);
+ audio->msgAddPlugin(track, idx, 0, prefader);
}
else if (sel == bypassAction) {
bool flag = !pipe->isOn(idx);
@@ -176,10 +163,8 @@ void EffectRack::contextMenuEvent(QContextMenuEvent* ev)
pipe->move(idx, false);
}
}
- else if (sel == auxAction) {
- printf("add new aux send: not implemented\n");
- }
-
+ else if (sel == auxAction)
+ addPlugin(auxPlugin);
song->update(SC_RACK);
}
@@ -193,7 +178,7 @@ void EffectRack::doubleClicked(QListWidgetItem* it)
if (track == 0)
return;
int idx = row(it);
- Pipeline* pipe = track->efxPipe();
+ Pipeline* pipe = prefader ? track->prePipe() : track->postPipe();
bool flag = !pipe->guiVisible(idx);
pipe->showGui(idx, flag);
}
@@ -207,14 +192,14 @@ void EffectRack::startDrag(int idx)
QString buffer;
AL::Xml xml(NULL);
xml.setString(&buffer);
- Pipeline* pipe = track->efxPipe();
+ Pipeline* pipe = prefader ? track->prePipe() : track->postPipe();
if (pipe) {
if ((*pipe)[idx] != NULL) {
PluginI *plug = (*pipe)[idx];
xml.header();
xml.tag("muse version=\"1.0\"");
// header info
- plug->writeConfiguration1(xml); // wC1 does not append endtag
+ plug->writeConfiguration1(xml, prefader); // wC1 does not append endtag
// parameters
int noParams = plug->plugin()->parameter();
for (int i=0;i<noParams;i++) {
@@ -245,7 +230,7 @@ void EffectRack::startDrag(int idx)
QMimeData *mime = new QMimeData();
mime->setData("text/x-muse-plugin", xmldump);
drag->setMimeData(mime);
- Qt::DropAction dropAction = drag->start();
+/* Qt::DropAction dropAction =*/ drag->start();
}
//---------------------------------------------------------
@@ -261,14 +246,14 @@ void EffectRack::dropEvent(QDropEvent *event)
if (i)
idx = row(i);
- Pipeline* pipe = track->efxPipe();
+ Pipeline* pipe = prefader ? track->prePipe() : track->postPipe();
if (pipe) {
if (i) {
if(!QMessageBox::question(this, tr("Replace effect"),tr("Do you really want to replace the effect %1?").arg(pipe->name(idx)),
tr("&Yes"), tr("&No"),
QString::null, 0, 1 ))
{
- audio->msgAddPlugin(track, idx, 0);
+ audio->msgAddPlugin(track, idx, 0, prefader);
song->update(SC_RACK);
}
else {
@@ -378,7 +363,7 @@ void EffectRack::initPlugin(QDomNode &node, int idx)
delete plugi;
}
else {
- audio->msgAddPlugin(track, idx, plugi);
+ audio->msgAddPlugin(track, idx, plugi, prefader);
song->update(SC_RACK);
int i = 0;
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
@@ -419,17 +404,25 @@ void EffectRack::mouseDoubleClickEvent(QMouseEvent* event)
void EffectRack::selectNew()
{
Plugin* plugin = PluginDialog::getPlugin(this);
- if (plugin) {
- PluginI* plugi = new PluginI(track);
- if (plugi->initPluginInstance(plugin, track->channels())) {
- printf("cannot instantiate plugin <%s>\n",
- plugin->name().toLatin1().data());
- delete plugi;
- }
- else
- audio->msgAddPlugin(track, -1, plugi);
- }
+ addPlugin(plugin);
song->update(SC_RACK);
}
+//---------------------------------------------------------
+// addPlugin
+//---------------------------------------------------------
+
+void EffectRack::addPlugin(Plugin* plugin)
+ {
+ if (plugin == 0)
+ return;
+ PluginI* plugi = new PluginI(track);
+ if (plugi->initPluginInstance(plugin, track->channels())) {
+ printf("cannot instantiate plugin <%s>\n",
+ plugin->name().toLatin1().data());
+ delete plugi;
+ }
+ else
+ audio->msgAddPlugin(track, -1, plugi, prefader);
+ }
diff --git a/muse/muse/mixer/rack.h b/muse/muse/mixer/rack.h
index f8718f8c..bdd4a243 100644
--- a/muse/muse/mixer/rack.h
+++ b/muse/muse/mixer/rack.h
@@ -12,24 +12,19 @@
#include <al/xml.h>
class AudioTrack;
-
-//
-// EffectRack can contain effect plugins and aux send's:
-//
-static const int EFFECT_TYPE = 0;
-static const int SEND_TYPE = 32000; // this is the implicit maximal number
- // of possible effect plugins in the rack
+class Plugin;
//---------------------------------------------------------
// EffectRack
//---------------------------------------------------------
class EffectRack : public QListWidget {
+ Q_OBJECT
+
+ bool prefader;
AudioTrack* track;
QPoint dragPos;
- Q_OBJECT
-
virtual void contextMenuEvent(QContextMenuEvent*);
virtual void mouseDoubleClickEvent(QMouseEvent*);
@@ -37,6 +32,7 @@ class EffectRack : public QListWidget {
void startDrag(int idx);
void initPlugin(QDomNode &node, int idx);
+ void addPlugin(Plugin* plugin);
private slots:
void doubleClicked(QListWidgetItem*);
@@ -50,7 +46,7 @@ class EffectRack : public QListWidget {
void dragMoveEvent(QDragMoveEvent *event);
public:
- EffectRack(QWidget*, AudioTrack* t);
+ EffectRack(QWidget*, AudioTrack*, bool);
QSize sizeHint() const;
};
diff --git a/muse/muse/mixer/routedialog.cpp b/muse/muse/mixer/routedialog.cpp
index 261df8eb..364e69e3 100644
--- a/muse/muse/mixer/routedialog.cpp
+++ b/muse/muse/mixer/routedialog.cpp
@@ -58,7 +58,7 @@ void RouteDialog::routingChanged()
new QListWidgetItem(routeList, r->name(), dst.name());
}
}
- else if (track->type() != Track::AUDIO_AUX)
+ else
newDstList->insertItem(Route(track, -1).name());
if (track->type() == Track::AUDIO_OUTPUT) {
for (int channel = 0; channel < track->channels(); ++channel) {
diff --git a/muse/muse/muse.cpp b/muse/muse/muse.cpp
index 91884d59..782954bc 100644
--- a/muse/muse/muse.cpp
+++ b/muse/muse/muse.cpp
@@ -391,8 +391,6 @@ void populateAddTrack(QMenu* m)
a->setData(Track::AUDIO_GROUP);
a = m->addAction(QIcon(*addtrack_audioinputIcon), QT_TR_NOOP("Add Audio Input"));
a->setData(Track::AUDIO_INPUT);
- a = m->addAction(QIcon(*addtrack_auxsendIcon), QT_TR_NOOP("Add Aux Send"));
- a->setData(Track::AUDIO_AUX);
ps = m->addMenu(QMenu::tr("Add Soft Synth..."));
@@ -1054,7 +1052,7 @@ void MusE::setRaster(int val)
void MusE::initRaster(int val)
{
- for (int i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); ++i) {
+ for (unsigned i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); ++i) {
if (rasterTable[i].val == val) {
_raster = val;
rasterCombo->setCurrentIndex(i);
@@ -2603,7 +2601,6 @@ void MusE::updateConfiguration()
addTrack->setShortcut(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key, Track::AUDIO_OUTPUT);
addTrack->setShortcut(shortcuts[SHRT_ADD_AUDIO_GROUP].key, Track::AUDIO_GROUP);
addTrack->setShortcut(shortcuts[SHRT_ADD_AUDIO_INPUT].key, Track::AUDIO_INPUT);
- addTrack->setShortcut(shortcuts[SHRT_ADD_AUDIO_AUX].key, Track::AUDIO_AUX);
#endif
}
diff --git a/muse/muse/pipeline.cpp b/muse/muse/pipeline.cpp
new file mode 100644
index 00000000..ff078ced
--- /dev/null
+++ b/muse/muse/pipeline.cpp
@@ -0,0 +1,199 @@
+//=============================================================================
+// 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 "pipeline.h"
+#include "plugin.h"
+#include "plugingui.h"
+
+//---------------------------------------------------------
+// setChannels
+//---------------------------------------------------------
+
+void Pipeline::setChannels(int n)
+ {
+ foreach(PluginI* plugin, *this)
+ plugin->setChannels(n);
+ }
+
+//---------------------------------------------------------
+// isOn
+//---------------------------------------------------------
+
+bool Pipeline::isOn(int idx) const
+ {
+ PluginI* p = value(idx);
+ if (p)
+ return p->on();
+ return false;
+ }
+
+//---------------------------------------------------------
+// setOn
+//---------------------------------------------------------
+
+void Pipeline::setOn(int idx, bool flag)
+ {
+ PluginI* p = value(idx);
+ if (p) {
+ p->setOn(flag);
+ if (p->gui())
+ p->gui()->setOn(flag);
+ }
+ }
+
+//---------------------------------------------------------
+// label
+//---------------------------------------------------------
+
+QString Pipeline::label(int idx) const
+ {
+ PluginI* p = value(idx);
+ if (p)
+ return p->label();
+ return QString("");
+ }
+
+//---------------------------------------------------------
+// name
+//---------------------------------------------------------
+
+QString Pipeline::name(int idx) const
+ {
+ PluginI* p = value(idx);
+ if (p)
+ return p->name();
+ return QString("empty");
+ }
+
+//---------------------------------------------------------
+// hasNativeGui
+//---------------------------------------------------------
+
+bool Pipeline::hasNativeGui(int idx) const
+ {
+ PluginI* p = value(idx);
+ if (p)
+ return p->hasNativeGui();
+ return false;
+ }
+
+//---------------------------------------------------------
+// move
+//---------------------------------------------------------
+
+void Pipeline::move(int idx, bool up)
+ {
+ PluginI* p1 = (*this)[idx];
+ if (up) {
+ (*this)[idx] = (*this)[idx-1];
+ (*this)[idx-1] = p1;
+ }
+ else {
+ (*this)[idx] = (*this)[idx+1];
+ (*this)[idx+1] = p1;
+ }
+ }
+
+//---------------------------------------------------------
+// showGui
+//---------------------------------------------------------
+
+void Pipeline::showGui(int idx, bool flag)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ p->showGui(flag);
+ }
+
+//---------------------------------------------------------
+// showNativeGui
+//---------------------------------------------------------
+
+void Pipeline::showNativeGui(int idx, bool flag)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ p->showNativeGui(flag);
+ }
+
+//---------------------------------------------------------
+// guiVisible
+//---------------------------------------------------------
+
+bool Pipeline::guiVisible(int idx)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->guiVisible();
+ return false;
+ }
+
+//---------------------------------------------------------
+// nativeGuiVisible
+//---------------------------------------------------------
+
+bool Pipeline::nativeGuiVisible(int idx)
+ {
+ PluginI* p = (*this)[idx];
+ if (p)
+ return p->nativeGuiVisible();
+ return false;
+ }
+
+//---------------------------------------------------------
+// apply
+//---------------------------------------------------------
+
+void Pipeline::apply(int ports, unsigned long nframes, float** buffer1)
+ {
+ // prepare a second set of buffers in case a plugin is not
+ // capable of inPlace processing
+
+ float* buffer2[ports];
+ float data[nframes * ports];
+ for (int i = 0; i < ports; ++i)
+ buffer2[i] = data + i * nframes;
+
+ bool swap = false;
+
+ foreach (PluginI* p, *this) {
+ if (p->on()) {
+ if (p->inPlaceCapable()) {
+ if (swap)
+ p->apply(nframes, ports, buffer2, buffer2);
+ else
+ p->apply(nframes, ports, buffer1, buffer1);
+ }
+ else {
+ if (swap)
+ p->apply(nframes, ports, buffer2, buffer1);
+ else
+ p->apply(nframes, ports, buffer1, buffer2);
+ swap = !swap;
+ }
+ }
+ }
+ if (swap) {
+ for (int i = 0; i < ports; ++i)
+ memcpy(buffer1[i], buffer2[i], sizeof(float) * nframes);
+ }
+ }
+
+
diff --git a/muse/muse/plugin.cpp b/muse/muse/plugin.cpp
index 7f6459c1..6cd28e62 100644
--- a/muse/muse/plugin.cpp
+++ b/muse/muse/plugin.cpp
@@ -22,6 +22,8 @@
#include "al/al.h"
#include "plugin.h"
+#include "ladspaplugin.h"
+#include "auxplugin.h"
#include "plugingui.h"
#include "al/xml.h"
#include "fastlog.h"
@@ -30,55 +32,6 @@
PluginList plugins;
//---------------------------------------------------------
-// defaultValue
-//---------------------------------------------------------
-
-float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k)
- {
- LADSPA_PortRangeHint range = plugin->PortRangeHints[k];
- LADSPA_PortRangeHintDescriptor rh = range.HintDescriptor;
-// bool isLog = LADSPA_IS_HINT_LOGARITHMIC(rh);
- double val = 1.0;
- float m = (rh & LADSPA_HINT_SAMPLE_RATE) ? float(AL::sampleRate) : 1.0f;
- if (LADSPA_IS_HINT_DEFAULT_MINIMUM(rh)) {
- val = range.LowerBound * m;
- }
- else if (LADSPA_IS_HINT_DEFAULT_LOW(rh)) {
- if (LADSPA_IS_HINT_LOGARITHMIC(rh))
- val = exp(fast_log10(range.LowerBound * m) * .75 +
- log(range.UpperBound * m) * .25);
- else
- val = range.LowerBound*.75*m + range.UpperBound*.25*m;
- }
- else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(rh)) {
- if (LADSPA_IS_HINT_LOGARITHMIC(rh))
- val = exp(log(range.LowerBound * m) * .5 +
- log10(range.UpperBound * m) * .5);
- else
- val = range.LowerBound*.5*m + range.UpperBound*.5*m;
- }
- else if (LADSPA_IS_HINT_DEFAULT_HIGH(rh)) {
- if (LADSPA_IS_HINT_LOGARITHMIC(rh))
- val = exp(log(range.LowerBound * m) * .25 +
- log(range.UpperBound * m) * .75);
- else
- val = range.LowerBound*.25*m + range.UpperBound*.75*m;
- }
- else if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(rh)) {
- val = range.UpperBound*m;
- }
- else if (LADSPA_IS_HINT_DEFAULT_0(rh))
- val = 0.0;
- else if (LADSPA_IS_HINT_DEFAULT_1(rh))
- val = 1.0;
- else if (LADSPA_IS_HINT_DEFAULT_100(rh))
- val = 100.0;
- else if (LADSPA_IS_HINT_DEFAULT_440(rh))
- val = 440.0;
- return val;
- }
-
-//---------------------------------------------------------
// Plugin
//---------------------------------------------------------
@@ -89,49 +42,6 @@ Plugin::Plugin(const QFileInfo* f)
}
//---------------------------------------------------------
-// LadpsaPlugin
-//---------------------------------------------------------
-
-LadspaPlugin::LadspaPlugin(const QFileInfo* f,
- const LADSPA_Descriptor_Function ldf,
- const LADSPA_Descriptor* d)
- : Plugin(f), ladspa(ldf), plugin(d)
- {
- _inports = 0;
- _outports = 0;
- _parameter = 0;
- for (unsigned k = 0; k < plugin->PortCount; ++k) {
- LADSPA_PortDescriptor pd = d->PortDescriptors[k];
- static const int CI = LADSPA_PORT_CONTROL | LADSPA_PORT_INPUT;
- if ((pd & CI) == CI) {
- ++_parameter;
- pIdx.push_back(k);
- }
- else if (pd & LADSPA_PORT_INPUT) {
- ++_inports;
- iIdx.push_back(k);
- }
- else if (pd & LADSPA_PORT_OUTPUT) {
- ++_outports;
- oIdx.push_back(k);
- }
- }
- LADSPA_Properties properties = plugin->Properties;
- _inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(properties);
- if (_inports != _outports)
- _inPlaceCapable = false;
- }
-
-//---------------------------------------------------------
-// instantiate
-//---------------------------------------------------------
-
-void* LadspaPlugin::instantiate()
- {
- return plugin->instantiate(plugin, AL::sampleRate);
- }
-
-//---------------------------------------------------------
// loadPluginLib
//---------------------------------------------------------
@@ -219,6 +129,7 @@ void initPlugins()
if (*p == ':')
p++;
}
+ auxPlugin = new AuxPlugin;
}
//---------------------------------------------------------
@@ -236,181 +147,6 @@ Plugin* PluginList::find(const QString& file, const QString& name)
}
//---------------------------------------------------------
-// setChannels
-//---------------------------------------------------------
-
-void Pipeline::setChannels(int n)
- {
- foreach(PluginI* plugin, *this)
- plugin->setChannels(n);
- }
-
-//---------------------------------------------------------
-// isOn
-//---------------------------------------------------------
-
-bool Pipeline::isOn(int idx) const
- {
- PluginI* p = value(idx);
- if (p)
- return p->on();
- return false;
- }
-
-//---------------------------------------------------------
-// setOn
-//---------------------------------------------------------
-
-void Pipeline::setOn(int idx, bool flag)
- {
- PluginI* p = value(idx);
- if (p) {
- p->setOn(flag);
- if (p->gui())
- p->gui()->setOn(flag);
- }
- }
-
-//---------------------------------------------------------
-// label
-//---------------------------------------------------------
-
-QString Pipeline::label(int idx) const
- {
- PluginI* p = value(idx);
- if (p)
- return p->label();
- return QString("");
- }
-
-//---------------------------------------------------------
-// name
-//---------------------------------------------------------
-
-QString Pipeline::name(int idx) const
- {
- PluginI* p = value(idx);
- if (p)
- return p->name();
- return QString("empty");
- }
-
-//---------------------------------------------------------
-// hasNativeGui
-//---------------------------------------------------------
-
-bool Pipeline::hasNativeGui(int idx) const
- {
- PluginI* p = value(idx);
- if (p)
- return p->hasNativeGui();
- return false;
- }
-
-//---------------------------------------------------------
-// move
-//---------------------------------------------------------
-
-void Pipeline::move(int idx, bool up)
- {
- PluginI* p1 = (*this)[idx];
- if (up) {
- (*this)[idx] = (*this)[idx-1];
- (*this)[idx-1] = p1;
- }
- else {
- (*this)[idx] = (*this)[idx+1];
- (*this)[idx+1] = p1;
- }
- }
-
-//---------------------------------------------------------
-// showGui
-//---------------------------------------------------------
-
-void Pipeline::showGui(int idx, bool flag)
- {
- PluginI* p = (*this)[idx];
- if (p)
- p->showGui(flag);
- }
-
-//---------------------------------------------------------
-// showNativeGui
-//---------------------------------------------------------
-
-void Pipeline::showNativeGui(int idx, bool flag)
- {
- PluginI* p = (*this)[idx];
- if (p)
- p->showNativeGui(flag);
- }
-
-//---------------------------------------------------------
-// guiVisible
-//---------------------------------------------------------
-
-bool Pipeline::guiVisible(int idx)
- {
- PluginI* p = (*this)[idx];
- if (p)
- return p->guiVisible();
- return false;
- }
-
-//---------------------------------------------------------
-// nativeGuiVisible
-//---------------------------------------------------------
-
-bool Pipeline::nativeGuiVisible(int idx)
- {
- PluginI* p = (*this)[idx];
- if (p)
- return p->nativeGuiVisible();
- return false;
- }
-
-//---------------------------------------------------------
-// apply
-//---------------------------------------------------------
-
-void Pipeline::apply(int ports, unsigned long nframes, float** buffer1)
- {
- // prepare a second set of buffers in case a plugin is not
- // capable of inPlace processing
-
- float* buffer2[ports];
- float data[nframes * ports];
- for (int i = 0; i < ports; ++i)
- buffer2[i] = data + i * nframes;
-
- bool swap = false;
-
- for (iPluginI ip = begin(); ip != end(); ++ip) {
- PluginI* p = *ip;
- if (p && p->on()) {
- if (p->inPlaceCapable()) {
- if (swap)
- p->apply(nframes, ports, buffer2, buffer2);
- else
- p->apply(nframes, ports, buffer1, buffer1);
- }
- else {
- if (swap)
- p->apply(nframes, ports, buffer2, buffer1);
- else
- p->apply(nframes, ports, buffer1, buffer2);
- swap = !swap;
- }
- }
- }
- if (swap) {
- for (int i = 0; i < ports; ++i)
- memcpy(buffer1[i], buffer2[i], sizeof(float) * nframes);
- }
- }
-
-//---------------------------------------------------------
// PluginI
//---------------------------------------------------------
@@ -444,75 +180,6 @@ PluginI::~PluginI()
}
//---------------------------------------------------------
-// range
-//---------------------------------------------------------
-
-void LadspaPlugin::range(int i, double* min, double* max) const
- {
- i = pIdx[i];
- LADSPA_PortRangeHint range = plugin->PortRangeHints[i];
- LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
- if (desc & LADSPA_HINT_TOGGLED) {
- *min = 0.0;
- *max = 1.0;
- return;
- }
- double m = (desc & LADSPA_HINT_SAMPLE_RATE) ? float(AL::sampleRate) : 1.0f;
-
- if (desc & LADSPA_HINT_BOUNDED_BELOW)
- *min = range.LowerBound * m;
- else
- *min = 0.0;
- if (desc & LADSPA_HINT_BOUNDED_ABOVE)
- *max = range.UpperBound * m;
- else
- *max = 1.0;
- }
-
-//---------------------------------------------------------
-// createPIF
-//---------------------------------------------------------
-
-PluginIF* LadspaPlugin::createPIF(PluginI* pi)
- {
- LadspaPluginIF* pif = new LadspaPluginIF(pi);
- pif->init(pi->plugin());
- return pif;
- }
-
-//---------------------------------------------------------
-// LadspaPluginIF
-//---------------------------------------------------------
-
-LadspaPluginIF::LadspaPluginIF(PluginI* pi)
- : PluginIF(pi)
- {
- descr = 0;
- plugin = (LadspaPlugin*)(pi->plugin());
- }
-
-//---------------------------------------------------------
-// init
-// return true on error
-//---------------------------------------------------------
-
-bool LadspaPluginIF::init(Plugin* pl)
- {
- handle = (LADSPA_Descriptor*) ((LadspaPlugin*)pl)->instantiate();
- plugin = (LadspaPlugin*)pl;
- descr = plugin->ladspaDescriptor();
-
- int controlPorts = plugin->parameter();
- controls = new LadspaPort[controlPorts];
-
- for (int k = 0; k < controlPorts; ++k) {
- controls[k].val = plugin->defaultValue(k);
- descr->connect_port(handle, plugin->pIdx[k], &controls[k].val);
- }
- return handle == 0;
- }
-
-//---------------------------------------------------------
// apply
//---------------------------------------------------------
@@ -539,46 +206,20 @@ void PluginI::apply(unsigned nframes, int ports, float** src, float** dst)
}
//---------------------------------------------------------
-// apply
-//---------------------------------------------------------
-
-void LadspaPluginIF::apply(unsigned nframes, float** src, float** dst)
- {
- int iports = plugin->inports();
- int oports = plugin->outports();
- int cports = plugin->parameter();
-
- //
- // update parameter
- //
- for (int i = 0; i < cports; ++i)
- controls[i].val = pluginI->controllerList[i]->curVal().f;
- //
- // set connections
- //
- for (int k = 0; k < iports; ++k)
- descr->connect_port(handle, plugin->iIdx[k], src[k]);
- for (int k = 0; k < oports; ++k)
- descr->connect_port(handle, plugin->oIdx[k], dst[k]);
-
- descr->run(handle, nframes);
- }
-
-//---------------------------------------------------------
// setChannel
//---------------------------------------------------------
void PluginI::setChannels(int c)
{
- if (channel == c)
+ if (_channel == c)
return;
int ni = c / _plugin->outports();
if (ni == 0)
ni = 1;
- channel = c;
+ _channel = c;
if (ni == instances)
return;
- channel = c;
+ _channel = c;
// remove old instances:
deactivate();
@@ -597,16 +238,6 @@ void PluginI::setChannels(int c)
}
//---------------------------------------------------------
-// defaultValue
-//---------------------------------------------------------
-
-double LadspaPlugin::defaultValue(int k) const
- {
- k = pIdx[k];
- return ladspaDefaultValue(plugin, k);
- }
-
-//---------------------------------------------------------
// initPluginInstance
// return true on error
//---------------------------------------------------------
@@ -617,14 +248,14 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
printf("initPluginInstance: zero plugin\n");
return true;
}
- channel = c;
+ _channel = c;
_plugin = plug;
_plugin->incInstances(1);
QString inst("-" + QString::number(_plugin->instances()));
_name = _plugin->name() + inst;
_label = _plugin->label() + inst;
- instances = channel / plug->outports();
+ instances = _channel / plug->outports();
if (instances < 1)
instances = 1;
pif = new PluginIF*[instances];
@@ -663,9 +294,9 @@ bool PluginI::setParameter(const QString& s, double val)
// saveConfiguration
//---------------------------------------------------------
-void PluginI::writeConfiguration(Xml& xml)
+void PluginI::writeConfiguration(Xml& xml, bool prefader)
{
- writeConfiguration1(xml);
+ writeConfiguration1(xml, prefader);
xml.etag("plugin"); // append endtag
}
@@ -673,10 +304,14 @@ void PluginI::writeConfiguration(Xml& xml)
// saveConfiguration
//---------------------------------------------------------
-void PluginI::writeConfiguration1(Xml& xml)
+void PluginI::writeConfiguration1(Xml& xml, bool prefader)
{
- xml.tag("plugin file=\"%s\" label=\"%s\" channel=\"%d\"",
- _plugin->lib().toLatin1().data(), _plugin->label().toLatin1().data(), instances * _plugin->inports());
+ xml.tag("plugin pre=\"%d\" file=\"%s\" label=\"%s\" channel=\"%d\"",
+ prefader,
+ _plugin->lib().toLatin1().data(),
+ _plugin->label().toLatin1().data(),
+ _channel);
+// instances * _plugin->inports());
if (_on == false)
xml.intTag("on", _on);
if (guiVisible()) {
@@ -692,18 +327,23 @@ void PluginI::writeConfiguration1(Xml& xml)
// return true on error
//---------------------------------------------------------
-bool PluginI::readConfiguration(QDomNode node)
+bool PluginI::readConfiguration(QDomNode node, bool* prefader)
{
QDomElement e = node.toElement();
QString file = e.attribute("file");
QString label = e.attribute("label");
- channel = e.attribute("channel").toInt();
+ _channel = e.attribute("channel").toInt();
+ *prefader = e.attribute("pre", "1").toInt();
if (_plugin == 0) {
- _plugin = plugins.find(file, label);
+ // special case: internal plugin Aux
+ if (file.isEmpty() && label == "Aux")
+ _plugin = auxPlugin;
+ else
+ _plugin = plugins.find(file, label);
if (_plugin == 0)
return true;
- if (initPluginInstance(_plugin, channel))
+ if (initPluginInstance(_plugin, _channel))
return true;
}
node = node.firstChild();
@@ -822,26 +462,3 @@ void PluginI::activate()
pif[i]->activate();
}
-//---------------------------------------------------------
-// activate
-//---------------------------------------------------------
-
-void LadspaPluginIF::activate()
- {
- //
- // TODO: init values?
- //
- if (descr->activate)
- descr->activate(handle);
- }
-#if 0
-//---------------------------------------------------------
-// controllerId
-//---------------------------------------------------------
-
-int PluginI::controllerId(int idx) const
- {
- return controllerList[idx]->id();
- }
-#endif
-
diff --git a/muse/muse/plugin.h b/muse/muse/plugin.h
index 1f7a6a98..dbffa686 100644
--- a/muse/muse/plugin.h
+++ b/muse/muse/plugin.h
@@ -85,62 +85,6 @@ class Plugin {
};
//---------------------------------------------------------
-// LadspaPlugin
-//---------------------------------------------------------
-
-class LadspaPlugin : public Plugin {
- LADSPA_Descriptor_Function ladspa;
- const LADSPA_Descriptor* plugin;
-
- protected:
- int _parameter;
- std::vector<int> pIdx;
-
- int _inports;
- std::vector<int> iIdx;
-
- int _outports;
- std::vector<int> oIdx;
-
- bool _inPlaceCapable;
- friend class LadspaPluginIF;
-
- public:
- LadspaPlugin(const QFileInfo* f,
- const LADSPA_Descriptor_Function,
- const LADSPA_Descriptor* d);
-
- virtual QString label() const { return QString(plugin->Label); }
- virtual QString name() const { return QString(plugin->Name); }
- virtual unsigned long id() const { return plugin->UniqueID; }
- virtual QString maker() const { return QString(plugin->Maker); }
- virtual QString copyright() const { return QString(plugin->Copyright); }
-
- void* instantiate();
- virtual void range(int i, double*, double*) const;
- virtual int parameter() const { return _parameter; }
- virtual int inports() const { return _inports; }
- virtual int outports() const { return _outports; }
-
- virtual bool inPlaceCapable() const { return _inPlaceCapable; }
- virtual PluginIF* createPIF(PluginI*);
- const LADSPA_Descriptor* ladspaDescriptor() const { return plugin; }
-
- virtual bool isLog(int k) const {
- LADSPA_PortRangeHint r = plugin->PortRangeHints[pIdx[k]];
- return LADSPA_IS_HINT_LOGARITHMIC(r.HintDescriptor);
- }
- virtual bool isBool(int k) const {
- return LADSPA_IS_HINT_TOGGLED(plugin->PortRangeHints[pIdx[k]].HintDescriptor);
- }
- virtual bool isInt(int k) const {
- LADSPA_PortRangeHint r = plugin->PortRangeHints[pIdx[k]];
- return LADSPA_IS_HINT_INTEGER(r.HintDescriptor);
- }
- virtual double defaultValue(int) const;
- };
-
-//---------------------------------------------------------
// PluginList
//---------------------------------------------------------
@@ -153,14 +97,6 @@ class PluginList : public std::list<Plugin*> {
};
//---------------------------------------------------------
-// LadspaPort
-//---------------------------------------------------------
-
-struct LadspaPort {
- float val;
- };
-
-//---------------------------------------------------------
// PluginIF
// plugin instance interface
//---------------------------------------------------------
@@ -190,38 +126,6 @@ class PluginIF {
};
//---------------------------------------------------------
-// LadspaPluginIF
-//---------------------------------------------------------
-
-class LadspaPluginIF : public PluginIF {
- const LADSPA_Descriptor* descr;
- LADSPA_Handle handle; // per instance
- LadspaPlugin* plugin;
-
- LadspaPort* controls;
-
- public:
- LadspaPluginIF(PluginI* pi);
-
- virtual void apply(unsigned nframes, float** src, float** dst);
- virtual void activate();
- virtual void deactivate() {
- if (descr->deactivate)
- descr->deactivate(handle);
- }
- virtual void cleanup() {
- if (descr->cleanup)
- descr->cleanup(handle);
- }
- virtual const char* getParameterName(int i) const {
- return plugin->plugin->PortNames[plugin->pIdx[i]];
- }
- virtual void setParam(int i, double val) { controls[i].val = val; }
- virtual float param(int i) const { return controls[i].val; }
- bool init(Plugin*);
- };
-
-//---------------------------------------------------------
// PluginI
// plugin instance
//---------------------------------------------------------
@@ -233,7 +137,7 @@ class PluginI {
int instances;
PluginIF** pif;
- int channel;
+ int _channel;
PluginGui* _gui;
bool _on;
@@ -260,6 +164,7 @@ class PluginI {
bool initPluginInstance(Plugin*, int channels);
void setChannels(int);
+ int channel() const { return _channel; }
void apply(unsigned nframes, int ports, float** b1, float** b2);
void activate();
@@ -270,9 +175,9 @@ class PluginI {
AudioTrack* track() const { return _track; }
- void writeConfiguration(Xml& xml);
- void writeConfiguration1(Xml& xml); // without end tag!
- bool readConfiguration(QDomNode);
+ void writeConfiguration(Xml&, bool);
+ void writeConfiguration1(Xml&, bool); // without end tag!
+ bool readConfiguration(QDomNode, bool*);
void showGui();
void showGui(bool);
@@ -296,44 +201,15 @@ class PluginI {
_plugin->range(i, min, max);
}
double defaultValue(int i) const { return _plugin->defaultValue(i); }
- bool inPlaceCapable() const { return _plugin->inPlaceCapable(); }
-
- bool isLog(int k) const { return _plugin->isLog(k); }
- bool isBool(int k) const { return _plugin->isBool(k); }
- bool isInt(int k) const { return _plugin->isInt(k); }
- };
-
-//---------------------------------------------------------
-// Pipeline
-// chain of connected efx inserts
-//---------------------------------------------------------
-
-// const int PipelineDepth = 4;
+ bool inPlaceCapable() const { return _plugin->inPlaceCapable(); }
-class Pipeline : public QList<PluginI*> {
- public:
- Pipeline() {}
- bool isOn(int idx) const;
- void setOn(int, bool);
- QString label(int idx) const;
- QString name(int idx) const;
- bool hasNativeGui(int idx) const;
- void showGui(int, bool);
- bool guiVisible(int);
- bool nativeGuiVisible(int);
- void showNativeGui(int, bool);
- void apply(int ports, unsigned long nframes, float** buffer);
- void move(int idx, bool up);
- void setChannels(int);
- PluginI* plugin(int idx) { return value(idx); }
+ bool isLog(int k) const { return _plugin->isLog(k); }
+ bool isBool(int k) const { return _plugin->isBool(k); }
+ bool isInt(int k) const { return _plugin->isInt(k); }
};
-typedef Pipeline::iterator iPluginI;
-typedef Pipeline::const_iterator ciPluginI;
-
extern void initPlugins();
extern PluginList plugins;
-extern float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k);
#endif
diff --git a/muse/muse/plugingui.cpp b/muse/muse/plugingui.cpp
index d5605749..e6988db3 100644
--- a/muse/muse/plugingui.cpp
+++ b/muse/muse/plugingui.cpp
@@ -601,8 +601,9 @@ void PluginGui::load()
node = node.firstChild();
while (!node.isNull()) {
QDomElement e = node.toElement();
+ bool prefader;
if (e.tagName() == "plugin")
- plugin->readConfiguration(node.firstChild());
+ plugin->readConfiguration(node.firstChild(), &prefader);
else
printf("MusE:PluginGui: unknown tag %s\n", e.tagName().toLatin1().data());
node = node.nextSibling();
@@ -640,7 +641,7 @@ void PluginGui::save()
Xml xml(f);
xml.header();
xml.tag("muse version=\"1.0\"");
- plugin->writeConfiguration(xml);
+ plugin->writeConfiguration(xml, true);
xml.etag("muse");
f->close();
delete f;
diff --git a/muse/muse/preferences.cpp b/muse/muse/preferences.cpp
index ad9cc576..1807e88b 100644
--- a/muse/muse/preferences.cpp
+++ b/muse/muse/preferences.cpp
@@ -156,7 +156,6 @@ PreferencesDialog::PreferencesDialog(Arranger* a, QWidget* parent)
id = twi(aid, "Track List", 0);
twi(id, "Audio Output", 0x500 + Track::AUDIO_OUTPUT);
twi(id, "Audio Group", 0x500 + Track::AUDIO_GROUP);
- twi(id, "Audio Aux", 0x500 + Track::AUDIO_AUX);
twi(id, "Wave Track", 0x500 + Track::WAVE);
twi(id, "Audio Input", 0x500 + Track::AUDIO_INPUT);
twi(id, "Synthesizer", 0x500 + Track::AUDIO_SOFTSYNTH);
diff --git a/muse/muse/route.cpp b/muse/muse/route.cpp
index c98b15cf..5e474695 100644
--- a/muse/muse/route.cpp
+++ b/muse/muse/route.cpp
@@ -43,8 +43,7 @@ static Route name2route(const QString& rn, Route::RouteType t)
};
printf("!!!!!!!!!!!!!!!!!!!!!! empty route!!!!!!!!!!!!!!name2route: %s: <%s> not found\n", names[t], rn.toLatin1().data());
return Route((Track*) 0, channel, Route::TRACK);
-
- }
+ }
QString s(rn);
if (rn[0].isNumber() && rn[1]==':') {
@@ -213,13 +212,7 @@ bool addRoute(Route src, Route dst)
}
outRoutes->push_back(dst);
RouteList* inRoutes = dst.track->inRoutes();
- //
- // make sure AUDIO_AUX is processed last
- //
- if (src.track->type() == Track::AUDIO_AUX)
- inRoutes->push_back(src);
- else
- inRoutes->insert(inRoutes->begin(), src);
+ inRoutes->insert(inRoutes->begin(), src);
}
return true;
}
@@ -303,9 +296,7 @@ error:
static QString track2name(const Track* n)
{
- if (n == 0)
- return QWidget::tr("None");
- return n->name();
+ return n ? n->name() : "None";
}
//---------------------------------------------------------
@@ -315,21 +306,15 @@ static QString track2name(const Track* n)
QString Route::name() const
{
- QString s;
- if (type == TRACK || type == SYNTIPORT) {
- if (channel != -1) {
- QString c;
- c.setNum(channel+1);
- s = c + ":";
- }
- return s + track2name(track);
- }
- if (type == AUDIOPORT) {
- s = audioDriver->portName(port);
+ switch (type) {
+ case TRACK:
+ case SYNTIPORT:
+ return track2name(track);
+ case AUDIOPORT:
+ return audioDriver->portName(port);
+ case MIDIPORT:
+ return midiDriver->portName(port);
}
- else if (type == MIDIPORT)
- s = midiDriver->portName(port);
- return s;
}
//---------------------------------------------------------
@@ -339,53 +324,6 @@ QString Route::name() const
bool checkRoute(const QString& /*s*/, const QString& /*d*/)
{
-#if 0 // TODO1
- Route src(s, false, -1);
- Route dst(d, true, -1);
-
- if (!(src.isValid() && dst.isValid()) || (src == dst))
- return false;
- if (src.type == Route::AUDIOPORT || src.type == Route::MIDIPORT) {
- if (dst.type != Route::TRACK) {
- return false;
- }
- if (dst.track->type() != Track::AUDIO_INPUT) {
- return false;
- }
- src.channel = dst.channel;
- RouteList* inRoutes = dst.track->inRoutes();
- for (iRoute i = inRoutes->begin(); i != inRoutes->end(); ++i) {
- if (*i == src) { // route already there
- return false;
- }
- }
- }
- else if (dst.type == Route::AUDIOPORT || dst.type == Route::MIDIPORT) {
- if (src.type != Route::TRACK) {
- return false;
- }
- if (src.track->type() != Track::AUDIO_OUTPUT
- && src.track->type() != Track::MIDI_OUT
- && src.track->type() != Track::MIDI_IN) {
- return false;
- }
- RouteList* outRoutes = src.track->outRoutes();
- dst.channel = src.channel;
- for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i) {
- if (*i == dst) { // route already there
- return false;
- }
- }
- }
- else {
- RouteList* outRoutes = src.track->outRoutes();
- for (iRoute i = outRoutes->begin(); i != outRoutes->end(); ++i) {
- if (*i == dst) { // route already there
- return false;
- }
- }
- }
-#endif
return true;
}
@@ -516,3 +454,13 @@ const char* Route::tname() const
return tname(type);
}
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void Route::write(Xml& xml, const char* name)
+ {
+ xml.put("<%s type=\"%s\" channel=\"%d\" stream=\"%d\" name=\"%s\"\>",
+ name, tname(), channel + 1, stream, name().toUtf8().data());
+ }
+
diff --git a/muse/muse/route.h b/muse/muse/route.h
index d5014f8d..37f0ea05 100644
--- a/muse/muse/route.h
+++ b/muse/muse/route.h
@@ -35,20 +35,20 @@ struct Route {
Track* track;
Port port;
};
- int channel;
+ int channel; // route to/from JACK can specify a channel to connect to
+ int stream; // 0 - main, 1-n - aux send
RouteType type;
+ Route();
Route(const QString&, int ch, RouteType);
Route(Port, RouteType);
+ Route(Track*);
Route(Track*, RouteType);
Route(Track*, int, RouteType);
- Route();
- Route(const Route& r) {
- track = r.track;
- channel = r.channel;
- type = r.type;
- }
QString name() const;
+ void read(QDomNode node);
+ void write(Xml&, const char* name);
+
bool operator==(const Route& a) const;
bool isValid() const { return track != 0; }
void dump() const;
diff --git a/muse/muse/seqmsg.cpp b/muse/muse/seqmsg.cpp
index 5e9c187d..356745d1 100644
--- a/muse/muse/seqmsg.cpp
+++ b/muse/muse/seqmsg.cpp
@@ -148,14 +148,14 @@ void Audio::msgAddRoute1(Route src, Route dst)
// msgAddMidiPlugin
//---------------------------------------------------------
-void Audio::msgAddMidiPlugin(MidiTrackBase* node, int idx, MidiPluginI* plugin)
+void Audio::msgAddMidiPlugin(MidiTrackBase* track, int idx, MidiPluginI* plugin)
{
AudioMsg msg;
- msg.id = AUDIO_ADDMIDIPLUGIN;
- msg.track = node;
- msg.ival = idx;
+ msg.id = AUDIO_ADDMIDIPLUGIN;
+ msg.track = track;
+ msg.ival = idx;
msg.mplugin = plugin;
- MidiPluginI* oldPlugin = node->plugin(idx);
+ MidiPluginI* oldPlugin = track->plugin(idx);
sendMsg(&msg);
if (oldPlugin) {
delete oldPlugin;
@@ -166,12 +166,14 @@ void Audio::msgAddMidiPlugin(MidiTrackBase* node, int idx, MidiPluginI* plugin)
// msgAddPlugin
//---------------------------------------------------------
-void Audio::msgAddPlugin(AudioTrack* node, int idx, PluginI* plugin)
+void Audio::msgAddPlugin(AudioTrack* track, int idx, PluginI* plugin,
+ bool prefader)
{
AudioMsg msg;
msg.id = AUDIO_ADDPLUGIN;
- msg.track = node;
+ msg.track = track;
msg.ival = idx;
+ msg.iival = prefader;
msg.plugin = plugin;
sendMsg(&msg);
}
diff --git a/muse/muse/shortcuts.cpp b/muse/muse/shortcuts.cpp
index 2f8359e3..c9f2e551 100644
--- a/muse/muse/shortcuts.cpp
+++ b/muse/muse/shortcuts.cpp
@@ -262,7 +262,6 @@ void initShortCuts()
defShrt(SHRT_ADD_AUDIO_OUTPUT, 0, 34, ARRANG_SHRT, "add_audio_output");
defShrt(SHRT_ADD_AUDIO_GROUP, 0, 35, ARRANG_SHRT, "add_audio_group");
defShrt(SHRT_ADD_AUDIO_INPUT, 0, 36, ARRANG_SHRT, "add_audio_input");
- defShrt(SHRT_ADD_AUDIO_AUX , 0, 37, ARRANG_SHRT, "add_audio_aux");
defShrt(SHRT_GLOBAL_CUT, 0, 38, ARRANG_SHRT, "global_cut");
defShrt(SHRT_GLOBAL_INSERT, 0, 39, ARRANG_SHRT, "global_insert");
diff --git a/muse/muse/shortcuts.h b/muse/muse/shortcuts.h
index 40aff914..4285cd8e 100644
--- a/muse/muse/shortcuts.h
+++ b/muse/muse/shortcuts.h
@@ -193,7 +193,6 @@ enum {
SHRT_ADD_AUDIO_OUTPUT, //Default: undefined
SHRT_ADD_AUDIO_GROUP, //Default: undefined
SHRT_ADD_AUDIO_INPUT, //Default: undefined
- SHRT_ADD_AUDIO_AUX, //Default: undefined
SHRT_RESET_MIDI, //Ctrl+Alt+Z
SHRT_OPEN_HELP, //F1
diff --git a/muse/muse/song.cpp b/muse/muse/song.cpp
index 41eff98a..88ee902e 100644
--- a/muse/muse/song.cpp
+++ b/muse/muse/song.cpp
@@ -35,6 +35,7 @@
#include "al/tempo.h"
#include "midi.h"
#include "plugin.h"
+#include "pipeline.h"
#include "synth.h"
#include "midiplugin.h"
#include "midirc.h"
@@ -1178,7 +1179,6 @@ void Song::clear(bool signal)
_inputs.clearDelete(); // audio input ports
_outputs.clearDelete(); // audio output ports
_groups.clearDelete(); // mixer groups
- _auxs.clearDelete(); // aux sends
_synthIs.clearDelete();
_midiSyntis.clearDelete();
@@ -1538,7 +1538,6 @@ printf("set instance name <%s>\n", instanceName.toLatin1().data());
track = si;
}
else {
- int lastAuxIdx = _auxs.size();
switch (type) {
case Track::MIDI:
track = new MidiTrack();
@@ -1552,21 +1551,15 @@ printf("set instance name <%s>\n", instanceName.toLatin1().data());
break;
case Track::WAVE:
track = new WaveTrack();
- ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
break;
case Track::AUDIO_OUTPUT:
track = new AudioOutput();
break;
case Track::AUDIO_GROUP:
track = new AudioGroup();
- ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
- break;
- case Track::AUDIO_AUX:
- track = new AudioAux();
break;
case Track::AUDIO_INPUT:
track = new AudioInput();
- ((AudioTrack*)track)->addAuxSend(lastAuxIdx);
break;
case Track::AUDIO_SOFTSYNTH:
case Track::TRACK_TYPES:
@@ -1640,10 +1633,6 @@ void Song::insertTrack(Track* track, int idx)
case Track::WAVE:
case Track::AUDIO_GROUP:
- case Track::AUDIO_AUX:
- if (ao)
- track->outRoutes()->push_back(Route(ao, -1, Route::TRACK));
- break;
case Track::AUDIO_INPUT:
{
// connect first input channel to first available jack output
@@ -1765,9 +1754,6 @@ void Song::insertTrack2(Track* track)
case Track::AUDIO_GROUP:
_groups.push_back((AudioGroup*)track);
break;
- case Track::AUDIO_AUX:
- _auxs.push_back((AudioAux*)track);
- break;
case Track::AUDIO_INPUT:
_inputs.push_back((AudioInput*)track);
break;
@@ -1785,22 +1771,6 @@ void Song::insertTrack2(Track* track)
}
//
- // initialize missing aux send
- //
-
- int n = _auxs.size();
- if (n) {
- for (iTrack i = _tracks.begin(); i != _tracks.end(); ++i) {
- if ((*i)->isMidiTrack())
- continue;
- WaveTrack* wt = (WaveTrack*)*i;
- if (wt->hasAuxSend()) {
- wt->addAuxSend(n);
- }
- }
- }
-
- //
// connect routes
//
@@ -1900,9 +1870,6 @@ void Song::removeTrack2(Track* track)
case Track::AUDIO_GROUP:
_groups.erase(track);
break;
- case Track::AUDIO_AUX:
- _auxs.erase(track);
- break;
case Track::AUDIO_SOFTSYNTH:
{
SynthI* s = (SynthI*) track;
@@ -2307,11 +2274,13 @@ void Song::setControllerVal(Track* t, Ctrl* c, CVal val)
}
else {
c->setCurVal(val);
- if (c->id() & 0xf000) {
+ if (c->id() & 0x3ffff000) {
// plugin controller
- Pipeline* pipe = ((AudioTrack*)t)->efxPipe();
- int pluginIndex = (c->id() & 0xf000) / 0x1000 - 1;
- int ctrlIndex = c->id() & 0xfff;
+ AudioTrack* track = (AudioTrack*) t;
+ bool prefader;
+ int pluginIndex, ctrlIndex;
+ getCtrlPlugin(c->id(), &prefader, &pluginIndex, &ctrlIndex);
+ Pipeline* pipe = prefader ? track->prePipe() : track->postPipe();
pipe->plugin(pluginIndex)->setParam(ctrlIndex, val.f);
}
}
diff --git a/muse/muse/song.h b/muse/muse/song.h
index 65e1262f..33df68c5 100644
--- a/muse/muse/song.h
+++ b/muse/muse/song.h
@@ -26,7 +26,6 @@
#include "wavetrack.h"
#include "audioinput.h"
#include "audiooutput.h"
-#include "audioaux.h"
#include "audiogroup.h"
#include "midisynti.h"
#include "synth.h"
@@ -104,7 +103,6 @@ class Song : public QObject {
InputList _inputs; // audio input ports
OutputList _outputs; // audio output ports
GroupList _groups; // mixer groups
- AuxList _auxs; // aux sends
SynthIList _synthIs;
MidiSyntiList _midiSyntis;
MidiOutPortList _midiOutPorts;
@@ -307,7 +305,6 @@ class Song : public QObject {
InputList* inputs() { return &_inputs; }
OutputList* outputs() { return &_outputs; }
GroupList* groups() { return &_groups; }
- AuxList* auxs() { return &_auxs; }
SynthIList* syntis() { return &_synthIs; }
MidiOutPortList* midiOutPorts() { return &_midiOutPorts; }
MidiOutPort* midiOutPort(int idx) { return _midiOutPorts.index(idx); }
diff --git a/muse/muse/songfile.cpp b/muse/muse/songfile.cpp
index c719ceb3..e7b96182 100644
--- a/muse/muse/songfile.cpp
+++ b/muse/muse/songfile.cpp
@@ -199,11 +199,6 @@ void Song::read(QDomNode node)
track->read(node.firstChild());
insertTrack0(track,-1);
}
- else if (tag == "AudioAux") {
- AudioAux* track = new AudioAux();
- track->read(node.firstChild());
- insertTrack0(track, -1);
- }
else if (tag == "SynthI") {
SynthI* track = new SynthI();
track->read(node.firstChild());
diff --git a/muse/muse/track.cpp b/muse/muse/track.cpp
index 5ed7fc87..aebb851d 100644
--- a/muse/muse/track.cpp
+++ b/muse/muse/track.cpp
@@ -74,7 +74,6 @@ QPixmap* Track::pixmap(TrackType t)
switch(t) {
case AUDIO_OUTPUT: return addtrack_audiooutputIcon;
case AUDIO_GROUP: return addtrack_audiogroupIcon;
- case AUDIO_AUX: return addtrack_auxsendIcon;
case WAVE: return addtrack_wavetrackIcon;
case AUDIO_INPUT: return addtrack_audioinputIcon;
case AUDIO_SOFTSYNTH: return addtrack_audioinputIcon; // DEBUG
@@ -168,9 +167,6 @@ void Track::setDefaultName()
case AUDIO_GROUP:
base = QString("Group");
break;
- case AUDIO_AUX:
- base = QString("Aux");
- break;
case AUDIO_INPUT:
base = QString("AudioIn");
break;
@@ -673,34 +669,18 @@ void Track::writeRouting(Xml& xml) const
for (ciRoute r = rl->begin(); r != rl->end(); ++r) {
Route dst(name(), r->channel, Route::TRACK);
xml.tag("Route");
- xml.put("<srcNode type=\"%s\">%s</srcNode>",
+ xml.put("<src type=\"%s\" name=\"%s\"\>",
Route::tname(rt), r->name().toLatin1().data());
- xml.put("<dstNode type=\"TRACK\">%s</dstNode>", dst.name().toLatin1().data());
+ xml.put("<dst type=\"TRACK\" name=\"%s\"\>",
+ dst.name().toLatin1().data());
xml.etag("Route");
}
}
for (ciRoute r = _outRoutes.begin(); r != _outRoutes.end(); ++r) {
xml.tag("Route");
- const char* tname = type() == AUDIO_SOFTSYNTH ? "SYNTIPORT" : "TRACK";
- if (r->channel != -1)
- xml.put("<srcNode type=\"%s\">%d:%s</srcNode>", tname, r->channel + 1, name().toLatin1().data());
- else
- xml.put("<srcNode type=\"%s\">%s</srcNode>", tname, name().toLatin1().data());
-
- switch(r->type) {
- case Route::AUDIOPORT:
- xml.put("<dstNode type=\"AUDIOPORT\">%s</dstNode>", r->name().toLatin1().data());
- break;
- case Route::MIDIPORT:
- xml.put("<dstNode type=\"MIDIPORT\">%s</dstNode>", r->name().toLatin1().data());
- break;
- case Route::SYNTIPORT:
- xml.put("<dstNode type=\"SYNTIPORT\">%s</dstNode>", r->name().toLatin1().data());
- break;
- case Route::TRACK:
- xml.put("<dstNode type=\"TRACK\">%s</dstNode>", r->name().toLatin1().data());
- break;
- }
+ Route src(this);
+ src->write(xml, "src");
+ r->write(xml, "dst");
xml.etag("Route");
}
}
diff --git a/muse/muse/track.h b/muse/muse/track.h
index 78d445fe..ff383f4e 100644
--- a/muse/muse/track.h
+++ b/muse/muse/track.h
@@ -84,7 +84,6 @@ class Track : public QObject {
enum TrackType {
AUDIO_OUTPUT,
AUDIO_GROUP,
- AUDIO_AUX,
WAVE,
AUDIO_INPUT,
AUDIO_SOFTSYNTH,
@@ -98,7 +97,6 @@ class Track : public QObject {
enum {
M_AUDIO_OUTPUT = 1 << AUDIO_OUTPUT,
M_AUDIO_GROUP = 1 << AUDIO_GROUP,
- M_AUDIO_AUX = 1 << AUDIO_AUX,
M_WAVE = 1 << WAVE,
M_AUDIO_INPUT = 1 << AUDIO_INPUT,
M_AUDIO_SOFTSYNTH = 1 << AUDIO_SOFTSYNTH,