summaryrefslogtreecommitdiff
path: root/muse2/muse/plugin.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2012-03-15 18:21:23 +0000
committerFlorian Jung <flo@windfisch.org>2012-03-15 18:21:23 +0000
commit27b7bf6815cda7abb67026c37b3e44daee1803cb (patch)
tree0b9d1c0bc84ac7ff8032e707f2b5fb4e0aaabb5c /muse2/muse/plugin.cpp
parent2d6f113a10eb485694e20a78500f650776d701e3 (diff)
merged with trunk
Diffstat (limited to 'muse2/muse/plugin.cpp')
-rw-r--r--muse2/muse/plugin.cpp629
1 files changed, 92 insertions, 537 deletions
diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp
index ed3a8655..9b3879b9 100644
--- a/muse2/muse/plugin.cpp
+++ b/muse2/muse/plugin.cpp
@@ -82,22 +82,6 @@ namespace MusEGlobal {
MusECore::PluginList plugins;
}
-/*
-static const char* MusEGlobal::preset_file_pattern[] = {
- QT_TRANSLATE_NOOP("@default", "Presets (*.pre *.pre.gz *.pre.bz2)"),
- QT_TRANSLATE_NOOP("@default", "All Files (*)"),
- 0
- };
-
-static const char* MusEGlobal::preset_file_save_pattern[] = {
- QT_TRANSLATE_NOOP("@default", "Presets (*.pre)"),
- QT_TRANSLATE_NOOP("@default", "gzip compressed presets (*.pre.gz)"),
- QT_TRANSLATE_NOOP("@default", "bzip2 compressed presets (*.pre.bz2)"),
- QT_TRANSLATE_NOOP("@default", "All Files (*)"),
- 0
- };
-*/
-
namespace MusEGui {
int PluginDialog::selectedPlugType = 0;
QStringList PluginDialog::sortItems = QStringList();
@@ -113,7 +97,6 @@ namespace MusECore {
// ladspa2MidiControlValues
//---------------------------------------------------------
-//bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, int port, int ctlnum, int* min, int* max, int* def)
bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int* min, int* max, int* def)
{
LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
@@ -122,12 +105,8 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
float fmin, fmax, fdef;
int imin, imax;
float frng;
- //int idef;
-
- //ladspaControlRange(plugin, port, &fmin, &fmax);
bool hasdef = ladspaDefaultValue(plugin, port, &fdef);
- //bool isint = desc & LADSPA_HINT_INTEGER;
MidiController::ControllerType t = midiControllerType(ctlnum);
#ifdef PLUGIN_DEBUGIN
@@ -181,7 +160,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
frng = fmax - fmin;
imin = lrint(fmin);
imax = lrint(fmax);
- //irng = imax - imin;
int ctlmn = 0;
int ctlmx = 127;
@@ -190,7 +168,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
printf("ladspa2MidiControlValues: port min:%f max:%f \n", fmin, fmax);
#endif
- //bool isneg = (fmin < 0.0);
bool isneg = (imin < 0);
int bias = 0;
switch(t)
@@ -227,7 +204,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
break;
case MidiController::Program:
ctlmn = 0;
- //ctlmx = 0xffffff;
ctlmx = 0x3fff; // FIXME: Really should not happen or be allowed. What to do here...
break;
case MidiController::Pitch:
@@ -238,7 +214,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
default:
break;
}
- //int ctlrng = ctlmx - ctlmn;
float fctlrng = float(ctlmx - ctlmn);
// Is it an integer control?
@@ -248,17 +223,7 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
printf("ladspa2MidiControlValues: has LADSPA_HINT_INTEGER\n");
#endif
- // If the upper or lower limit is beyond the controller limits, just scale the whole range to fit.
- // We could get fancy by scaling only the negative or positive domain, or each one separately, but no...
- //if((imin < ctlmn) || (imax > ctlmx))
- //{
- // float scl = float(irng) / float(fctlrng);
- // if((ctlmn - imin) > (ctlmx - imax))
- // scl = float(ctlmn - imin);
- // else
- // scl = float(ctlmx - imax);
- //}
- // No, instead just clip the limits. ie fit the range into clipped space.
+ // just clip the limits instead of scaling the whole range. ie fit the range into clipped space.
if(imin < ctlmn)
imin = ctlmn;
if(imax > ctlmx)
@@ -267,13 +232,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
*min = imin;
*max = imax;
- //int idef = (int)lrint(fdef);
- //if(idef < ctlmn)
- // idef = ctlmn;
- //if(idef > ctlmx)
- // idef = ctlmx;
- //*def = idef;
-
*def = (int)lrint(fdef);
return hasdef;
@@ -283,9 +241,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
*min = ctlmn;
*max = ctlmx;
- // Orcan: commented out next 2 lines to suppress compiler warning:
- //float fbias = (fmin + fmax) / 2.0;
- //float normbias = fbias / frng;
float normdef = fdef / frng;
fdef = normdef * fctlrng;
@@ -304,7 +259,6 @@ bool ladspa2MidiControlValues(const LADSPA_Descriptor* plugin, unsigned long por
// midi2LadspaValue
//---------------------------------------------------------
-//float midi2LadspaValue(const LADSPA_Descriptor* plugin, int port, int ctlnum, int val)
float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum, int val)
{
LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
@@ -312,14 +266,8 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int
float fmin, fmax;
int imin;
- //int imax;
float frng;
- //int idef;
-
- //ladspaControlRange(plugin, port, &fmin, &fmax);
- //bool hasdef = ladspaDefaultValue(plugin, port, &fdef);
- //bool isint = desc & LADSPA_HINT_INTEGER;
MidiController::ControllerType t = midiControllerType(ctlnum);
#ifdef PLUGIN_DEBUGIN
@@ -360,8 +308,6 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int
frng = fmax - fmin;
imin = lrint(fmin);
- //imax = lrint(fmax);
- //irng = imax - imin;
if(desc & LADSPA_HINT_TOGGLED)
{
@@ -382,7 +328,6 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int
printf("midi2LadspaValue: port min:%f max:%f \n", fmin, fmax);
#endif
- //bool isneg = (fmin < 0.0);
bool isneg = (imin < 0);
int bval = val;
int cval = val;
@@ -458,11 +403,6 @@ float midi2LadspaValue(const LADSPA_Descriptor* plugin, unsigned long port, int
// It's a floating point control, just use wide open maximum range.
float normval = float(bval) / fctlrng;
- //float fbias = (fmin + fmax) / 2.0;
- //float normfbias = fbias / frng;
- //float ret = (normdef + normbias) * fctlrng;
- //float normdef = fdef / frng;
-
float ret = normval * frng + fmin;
#ifdef PLUGIN_DEBUGIN
@@ -510,13 +450,13 @@ CtrlList::Mode ladspaCtrlMode(const LADSPA_Descriptor* plugin, int port)
return CtrlList::INTERPOLATE;
}
+// DELETETHIS 20
// Works but not needed.
/*
//---------------------------------------------------------
// ladspa2MidiController
//---------------------------------------------------------
-//MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, int port, int ctlnum)
MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned long port, int ctlnum)
{
int min, max, def;
@@ -535,16 +475,12 @@ MidiController* ladspa2MidiController(const LADSPA_Descriptor* plugin, unsigned
// If no default ladspa value found, still sets *def to 1.0, but returns false.
//---------------------------------------------------------------------------------
-//float ladspaDefaultValue(const LADSPA_Descriptor* plugin, int k)
-//bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, int port, float* val)
bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, float* val)
{
if(port < plugin->PortCount)
{
LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
LADSPA_PortRangeHintDescriptor rh = range.HintDescriptor;
- // bool isLog = LADSPA_IS_HINT_LOGARITHMIC(rh);
- //double val = 1.0;
float m = (rh & LADSPA_HINT_SAMPLE_RATE) ? float(MusEGlobal::sampleRate) : 1.0f;
if (LADSPA_IS_HINT_DEFAULT_MINIMUM(rh))
{
@@ -555,9 +491,6 @@ bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, flo
{
if (LADSPA_IS_HINT_LOGARITHMIC(rh))
{
- //*val = exp(fast_log10(range.LowerBound * m) * .75 +
- // log(range.UpperBound * m) * .25);
- // p4.0.21 And below...
*val = expf(fast_log10(range.LowerBound * m) * .75 + // Why fast_log10?
logf(range.UpperBound * m) * .25);
return true;
@@ -572,8 +505,6 @@ bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, flo
{
if (LADSPA_IS_HINT_LOGARITHMIC(rh))
{
- //*val = exp(log(range.LowerBound * m) * .5 +
- // log10(range.UpperBound * m) * .5);
*val = expf(logf(range.LowerBound * m) * .5 +
log10f(range.UpperBound * m) * .5); // Why log10?
return true;
@@ -588,8 +519,6 @@ bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, flo
{
if (LADSPA_IS_HINT_LOGARITHMIC(rh))
{
- //*val = exp(log(range.LowerBound * m) * .25 +
- // log(range.UpperBound * m) * .75);
*val = expf(logf(range.LowerBound * m) * .25 +
logf(range.UpperBound * m) * .75);
return true;
@@ -636,7 +565,6 @@ bool ladspaDefaultValue(const LADSPA_Descriptor* plugin, unsigned long port, flo
// ladspaControlRange
//---------------------------------------------------------
-//void ladspaControlRange(const LADSPA_Descriptor* plugin, int i, float* min, float* max)
void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, float* min, float* max)
{
LADSPA_PortRangeHint range = plugin->PortRangeHints[port];
@@ -660,6 +588,7 @@ void ladspaControlRange(const LADSPA_Descriptor* plugin, unsigned long port, flo
*max = 1.0;
}
+// DELETETHIS 35
/*
//---------------------------------------------------------
// PluginBase
@@ -717,10 +646,6 @@ Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi)
_copyright = QString(d->Copyright);
_portCount = d->PortCount;
- //_portDescriptors = 0;
- //if(_portCount)
- // _portDescriptors = new LADSPA_PortDescriptor[_portCount];
-
_inports = 0;
_outports = 0;
@@ -729,7 +654,6 @@ Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi)
for(unsigned long k = 0; k < _portCount; ++k)
{
LADSPA_PortDescriptor pd = d->PortDescriptors[k];
- //_portDescriptors[k] = pd;
if(pd & LADSPA_PORT_AUDIO)
{
if(pd & LADSPA_PORT_INPUT)
@@ -780,8 +704,6 @@ Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi)
Plugin::~Plugin()
{
- //if(_portDescriptors)
- // delete[] _portDescriptors;
if(plugin)
delete plugin;
}
@@ -822,18 +744,14 @@ int Plugin::incReferences(int val)
return 0;
}
- //if(_references == 0)
if(_handle == 0)
{
- //_references = 0;
_handle = dlopen(fi.filePath().toLatin1().constData(), RTLD_NOW);
- //handle = dlopen(fi.absFilePath().toLatin1().constData(), RTLD_NOW);
if(_handle == 0)
{
fprintf(stderr, "Plugin::incReferences dlopen(%s) failed: %s\n",
fi.filePath().toLatin1().constData(), dlerror());
- //fi.absFilePath().toLatin1().constData(), dlerror());
return 0;
}
@@ -852,7 +770,6 @@ int Plugin::incReferences(int val)
QString label(descr->LADSPA_Plugin->Label);
// Listing effect plugins only while excluding synths:
// Do exactly what dssi-vst.cpp does for listing ladspa plugins.
- //if(label == _name &&
if(label == _label &&
!descr->run_synth &&
!descr->run_synth_adding &&
@@ -865,8 +782,6 @@ int Plugin::incReferences(int val)
plugin = descr->LADSPA_Plugin;
break;
}
- //else
- // delete descr;
}
}
else
@@ -876,7 +791,6 @@ int Plugin::incReferences(int val)
if(ladspadf)
{
const LADSPA_Descriptor* descr;
- //for(int i = 0;; ++i)
for(unsigned long i = 0;; ++i) // p4.0.21
{
descr = ladspadf(i);
@@ -884,7 +798,6 @@ int Plugin::incReferences(int val)
break;
QString label(descr->Label);
- //if(label == _name)
if(label == _label)
{
_isDssi = false;
@@ -897,26 +810,18 @@ int Plugin::incReferences(int val)
break;
}
- //else
- // delete descr;
}
}
}
if(plugin != NULL)
{
- //_instNo = 0;
_name = QString(plugin->Name);
_uniqueID = plugin->UniqueID;
_maker = QString(plugin->Maker);
_copyright = QString(plugin->Copyright);
- //if(_portDescriptors)
- // delete[] _portDescriptors;
- //_portDescriptors = 0;
_portCount = plugin->PortCount;
- //if(_portCount)
- // _portDescriptors = new LADSPA_PortDescriptor[_portCount];
_inports = 0;
_outports = 0;
@@ -925,7 +830,6 @@ int Plugin::incReferences(int val)
for(unsigned long k = 0; k < _portCount; ++k)
{
LADSPA_PortDescriptor pd = plugin->PortDescriptors[k];
- //_portDescriptors[k] = pd;
if(pd & LADSPA_PORT_AUDIO)
{
if(pd & LADSPA_PORT_INPUT)
@@ -974,10 +878,6 @@ int Plugin::incReferences(int val)
_references = newref;
- //QString guiPath(info.dirPath() + "/" + info.baseName());
- //QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
- //_hasGui = guiDir.exists();
-
return _references;
}
@@ -987,27 +887,6 @@ int Plugin::incReferences(int val)
void Plugin::range(unsigned long i, float* min, float* max) const
{
- /*
- LADSPA_PortRangeHint range = plugin->PortRangeHints[i];
- LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
- if (desc & LADSPA_HINT_TOGGLED) {
- *min = 0.0;
- *max = 1.0;
- return;
- }
- float m = 1.0;
- if (desc & LADSPA_HINT_SAMPLE_RATE)
- m = float(MusEGlobal::sampleRate);
-
- 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;
- */
ladspaControlRange(plugin, i, min, max); // p4.0.20
}
@@ -1015,7 +894,6 @@ void Plugin::range(unsigned long i, float* min, float* max) const
// defaultValue
//---------------------------------------------------------
-//double Plugin::defaultValue(unsigned long port) const
float Plugin::defaultValue(unsigned long port) const
{
// p4.0.21
@@ -1023,6 +901,7 @@ float Plugin::defaultValue(unsigned long port) const
ladspaDefaultValue(plugin, port, &val);
return val;
+ // DELETETHIS 50
/*
if(port >= plugin->PortCount)
return 0.0;
@@ -1108,7 +987,6 @@ static void loadPluginLib(QFileInfo* fi)
if(dssi)
{
const DSSI_Descriptor* descr;
- //for (int i = 0;; ++i)
for (unsigned long i = 0;; ++i) // p4.0.21
{
descr = dssi(i);
@@ -1124,24 +1002,17 @@ static void loadPluginLib(QFileInfo* fi)
{
// Make sure it doesn't already exist.
if(MusEGlobal::plugins.find(fi->completeBaseName(), QString(descr->LADSPA_Plugin->Label)) != 0)
- {
- //delete descr;
continue;
- }
+
#ifdef PLUGIN_DEBUGIN
fprintf(stderr, "loadPluginLib: dssi effect name:%s inPlaceBroken:%d\n", descr->LADSPA_Plugin->Name, LADSPA_IS_INPLACE_BROKEN(descr->LADSPA_Plugin->Properties));
#endif
- //LADSPA_Properties properties = descr->LADSPA_Plugin->Properties;
- //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
- //MusEGlobal::plugins.add(fi, descr, !inPlaceBroken);
if(MusEGlobal::debugMsg)
fprintf(stderr, "loadPluginLib: adding dssi effect plugin:%s name:%s label:%s\n", fi->filePath().toLatin1().constData(), descr->LADSPA_Plugin->Name, descr->LADSPA_Plugin->Label);
MusEGlobal::plugins.add(fi, descr->LADSPA_Plugin, true);
}
- //else
- // delete descr;
}
}
else
@@ -1165,7 +1036,6 @@ static void loadPluginLib(QFileInfo* fi)
}
const LADSPA_Descriptor* descr;
- //for (int i = 0;; ++i)
for (unsigned long i = 0;; ++i) // p4.0.21
{
descr = ladspa(i);
@@ -1174,17 +1044,12 @@ static void loadPluginLib(QFileInfo* fi)
// Make sure it doesn't already exist.
if(MusEGlobal::plugins.find(fi->completeBaseName(), QString(descr->Label)) != 0)
- {
- //delete descr;
continue;
- }
+
#ifdef PLUGIN_DEBUGIN
fprintf(stderr, "loadPluginLib: ladspa effect name:%s inPlaceBroken:%d\n", descr->Name, LADSPA_IS_INPLACE_BROKEN(descr->Properties));
#endif
- //LADSPA_Properties properties = descr->Properties;
- //bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
- //MusEGlobal::plugins.add(fi, ladspa, descr, !inPlaceBroken);
if(MusEGlobal::debugMsg)
fprintf(stderr, "loadPluginLib: adding ladspa plugin:%s name:%s label:%s\n", fi->filePath().toLatin1().constData(), descr->Name, descr->Label);
MusEGlobal::plugins.add(fi, descr);
@@ -1289,7 +1154,7 @@ Plugin* PluginList::find(const QString& file, const QString& name)
if ((file == i->lib()) && (name == i->label()))
return &*i;
}
- //printf("Plugin <%s> not found\n", name.ascii());
+
return 0;
}
@@ -1492,21 +1357,6 @@ bool Pipeline::isDssiPlugin(int idx) const
return false;
}
-/*
-//---------------------------------------------------------
-// dssi_ui_filename
-//---------------------------------------------------------
-
-QString dssi_ui_filename(int idx) const
-{
- PluginI* p = (*this)[idx];
- if(p)
- return p->dssi_ui_filename();
-
- return QString();
-}
-*/
-
//---------------------------------------------------------
// has_dssi_ui
//---------------------------------------------------------
@@ -1597,15 +1447,6 @@ bool Pipeline::nativeGuiVisible(int idx)
void Pipeline::apply(unsigned long 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;
-
- //fprintf(stderr, "Pipeline::apply data: nframes:%lu %e %e %e %e\n", nframes, buffer1[0][0], buffer1[0][1], buffer1[0][2], buffer1[0][3]);
-
bool swap = false;
for (iPluginI ip = begin(); ip != end(); ++ip) {
@@ -1613,10 +1454,8 @@ void Pipeline::apply(unsigned long ports, unsigned long nframes, float** buffer1
if(p)
{
- //if (p && p->on()) {
if (p->on())
{
- //fprintf(stderr, "Pipeline::apply PluginI:%p on:%d\n", p, p->on());
if (p->inPlaceCapable())
{
if (swap)
@@ -1642,8 +1481,6 @@ void Pipeline::apply(unsigned long ports, unsigned long nframes, float** buffer1
if (ports != 0 && swap)
{
for (unsigned long i = 0; i < ports; ++i)
- //memcpy(buffer1[i], buffer2[i], sizeof(float) * nframes);
- //memcpy(buffer1[i], buffer[i], sizeof(float) * nframes);
AL::dsp->cpy(buffer1[i], buffer[i], nframes);
}
}
@@ -1671,8 +1508,6 @@ QString PluginIBase::dssi_ui_filename() const
QString guiPath(dirPath() + "/" + libr);
- //fprintf(stderr, "PluginIBase::dssi_ui_filename guiPath:%s\n", guiPath.toLatin1().constData());
-
QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
if(!guiDir.exists())
return QString();
@@ -1713,10 +1548,6 @@ QString PluginIBase::dssi_ui_filename() const
}
}
- //fprintf(stderr, "PluginIBase::dssi_ui_filename plug_qt_ui:%s plug_any_ui:%s lib_qt_ui:%s lib_any_ui:%s\n",
- // plug_qt_ui.toLatin1().constData(), plug_any_ui.toLatin1().constData(),
- // lib_qt_ui.toLatin1().constData(), lib_any_ui.toLatin1().constData());
-
// Prefer qt plugin ui
if(!plug_qt_ui.isEmpty())
return plug_qt_ui;
@@ -1771,8 +1602,6 @@ PluginI::~PluginI()
deactivate();
_plugin->incReferences(-1);
}
- //if (_gui)
- // delete _gui;
if (controlsOut)
delete[] controlsOut;
if (controls)
@@ -1799,12 +1628,7 @@ void PluginI::updateControllers()
if(!_track)
return;
- //for(int i = 0; i < controlPorts; ++i)
for(unsigned long i = 0; i < controlPorts; ++i)
- //MusEGlobal::audio->msgSetPluginCtrlVal(this, genACnum(_id, i), controls[i].val);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(_track, genACnum(_id, i), controls[i].val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
_track->setPluginCtrlVal(genACnum(_id, i), controls[i].val); // TODO A faster bulk message
MusEGlobal::song->controllerChange(_track);
@@ -1816,30 +1640,10 @@ void PluginI::updateControllers()
void PluginI::setChannels(int c)
{
- // p3.3.41 Removed
- //if (channel == c)
- // return;
-
- // p3.3.41
channel = c;
- //int ni = c / _plugin->outports();
- //if (ni == 0)
- // ni = 1;
- // p3.3.41 Some plugins have zero out ports, causing exception with the above line.
- // Also, pick the least number of ins or outs, and base the number of instances on that.
unsigned long ins = _plugin->inports();
unsigned long outs = _plugin->outports();
- /*
- unsigned long minports = ~0ul;
- if(outs && outs < minports)
- minports = outs;
- if(ins && ins < minports)
- minports = ins;
- if(minports == ~0ul)
- minports = 1;
- int ni = c / minports;
- */
int ni = 1;
if(outs)
ni = c / outs;
@@ -1853,9 +1657,6 @@ void PluginI::setChannels(int c)
if (ni == instances)
return;
- // p3.3.41 Moved above.
- //channel = c;
-
// remove old instances:
deactivate();
delete[] handle;
@@ -1869,8 +1670,6 @@ void PluginI::setChannels(int c)
}
}
- //int curPort = 0;
- //int curOutPort = 0;
unsigned long curPort = 0; // p4.0.21
unsigned long curOutPort = 0;
unsigned long ports = _plugin->ports();
@@ -1906,11 +1705,7 @@ void PluginI::setChannels(int c)
void PluginI::setParam(unsigned long i, float val)
{
- //controls[i].tmpVal = val;
-
- // p4.0.21
if(i >= _plugin->_controlInPorts)
- //if(i >= controlPorts)
{
printf("PluginI::setParameter param number %lu out of range of ports:%lu\n", i, _plugin->_controlInPorts);
return;
@@ -1932,7 +1727,7 @@ void PluginI::setParam(unsigned long i, float val)
fprintf(stderr, "PluginI::setParameter: fifo overflow: in control number:%lu\n", i);
}
- // Notify that changes are to be sent upon heartbeat.
+ // Notify that changes are to be sent upon heartbeat. DELETETHIS 4
// TODO: No, at least not for now. So far, setParameter is only called during loading of stored params,
// and we don't want this interfering with oscUpdate which also sends the values.
//synti->_guiUpdateControls[n] = true;
@@ -1942,7 +1737,6 @@ void PluginI::setParam(unsigned long i, float val)
// defaultValue
//---------------------------------------------------------
-//double PluginI::defaultValue(unsigned int param) const
float PluginI::defaultValue(unsigned long param) const
{
if(param >= controlPorts)
@@ -1960,10 +1754,6 @@ LADSPA_Handle Plugin::instantiate()
return NULL;
}
- //QString guiPath(info.dirPath() + "/" + info.baseName());
- //QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
- //_hasGui = guiDir.exists();
-
return h;
}
@@ -1992,23 +1782,8 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
_name = _plugin->name() + inst;
_label = _plugin->label() + inst;
- //instances = channel/plug->outports();
- // p3.3.41 Some plugins have zero out ports, causing exception with the above line.
- // Also, pick the least number of ins or outs, and base the number of instances on that.
unsigned long ins = plug->inports();
unsigned long outs = plug->outports();
- /*
- unsigned long minports = ~0ul;
- if(outs && outs < minports)
- minports = outs;
- if(ins && ins < minports)
- minports = ins;
- if(minports == ~0ul)
- minports = 1;
- instances = channel / minports;
- if(instances < 1)
- instances = 1;
- */
if(outs)
{
instances = channel / outs;
@@ -2033,7 +1808,6 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
#endif
handle[i] = _plugin->instantiate();
- //if (handle[i] == 0)
if(handle[i] == NULL)
return true;
}
@@ -2059,8 +1833,6 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
controls = new Port[controlPorts];
controlsOut = new Port[controlOutPorts];
- //int i = 0;
- //int ii = 0;
unsigned long curPort = 0;
unsigned long curOutPort = 0;
for(unsigned long k = 0; k < ports; ++k)
@@ -2070,7 +1842,6 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
{
if(pd & LADSPA_PORT_INPUT)
{
- //double val = _plugin->defaultValue(k);
float val = _plugin->defaultValue(k); // p4.0.21
controls[curPort].val = val;
controls[curPort].tmpVal = val;
@@ -2081,8 +1852,6 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
else
if(pd & LADSPA_PORT_OUTPUT)
{
- //double val = _plugin->defaultValue(k);
- //float val = _plugin->defaultValue(k);
controlsOut[curOutPort].val = 0.0;
controlsOut[curOutPort].tmpVal = 0.0;
controlsOut[curOutPort].enCtrl = false;
@@ -2091,8 +1860,6 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
}
}
}
- //unsigned long curPort = 0;
- //unsigned long curOutPort = 0;
curPort = 0;
curOutPort = 0;
for(unsigned long k = 0; k < ports; ++k)
@@ -2125,15 +1892,12 @@ bool PluginI::initPluginInstance(Plugin* plug, int c)
// connect
//---------------------------------------------------------
-//void PluginI::connect(int ports, float** src, float** dst)
void PluginI::connect(unsigned long ports, unsigned long offset, float** src, float** dst)
{
- //int port = 0;
unsigned long port = 0; // p4.0.21
for (int i = 0; i < instances; ++i) {
for (unsigned long k = 0; k < _plugin->ports(); ++k) {
if (isAudioIn(k)) {
- //_plugin->connectPort(handle[i], k, src[port]);
_plugin->connectPort(handle[i], k, src[port] + offset); // p4.0.21
port = (port + 1) % ports;
}
@@ -2143,13 +1907,8 @@ void PluginI::connect(unsigned long ports, unsigned long offset, float** src, fl
for (int i = 0; i < instances; ++i) {
for (unsigned long k = 0; k < _plugin->ports(); ++k) {
if (isAudioOut(k)) {
- // _plugin->connectPort(handle[i], k, dst[port]);
_plugin->connectPort(handle[i], k, dst[port] + offset); // p4.0.21
port = (port + 1) % ports; // overwrite output?
-// ++port;
-// if (port >= ports) {
-// return;
-// }
}
}
}
@@ -2176,18 +1935,12 @@ void PluginI::activate()
for (int i = 0; i < instances; ++i)
_plugin->activate(handle[i]);
if (initControlValues) {
- //printf("PluginI::activate init:%d\n", initControlValues);
- //for (int i = 0; i < controlPorts; ++i) {
for (unsigned long i = 0; i < controlPorts; ++i) {
controls[i].val = controls[i].tmpVal;
}
}
else {
- //
// get initial control values from plugin
- //
- //printf("PluginI::activate init:%d\n", initControlValues);
- //for (int i = 0; i < controlPorts; ++i) {
for (unsigned long i = 0; i < controlPorts; ++i) {
controls[i].tmpVal = controls[i].val;
}
@@ -2199,13 +1952,10 @@ void PluginI::activate()
// set plugin instance controller value by name
//---------------------------------------------------------
-//bool PluginI::setControl(const QString& s, double val)
bool PluginI::setControl(const QString& s, float val)
{
- //for (int i = 0; i < controlPorts; ++i) {
for (unsigned long i = 0; i < controlPorts; ++i) {
if (_plugin->portName(controls[i].idx) == s) {
- //controls[i].val = controls[i].tmpVal = val;
setParam(i, val); // p4.0.21
return false;
}
@@ -2222,17 +1972,11 @@ bool PluginI::setControl(const QString& s, float val)
void PluginI::writeConfiguration(int level, Xml& xml)
{
xml.tag(level++, "plugin file=\"%s\" label=\"%s\" channel=\"%d\"",
- //_plugin->lib().toLatin1().constData(), _plugin->label().toLatin1().constData(), instances * _plugin->inports());
- // p3.3.41
- //_plugin->lib().toLatin1().constData(), _plugin->label().toLatin1().constData(), channel);
Xml::xmlString(_plugin->lib()).toLatin1().constData(), Xml::xmlString(_plugin->label()).toLatin1().constData(), channel);
- //for (int i = 0; i < controlPorts; ++i) {
- //int idx = controls[i].idx;
for (unsigned long i = 0; i < controlPorts; ++i) { // p4.0.21
- unsigned long idx = controls[i].idx; //
+ unsigned long idx = controls[i].idx;
QString s("control name=\"%1\" val=\"%2\" /");
- //xml.tag(level, s.arg(_plugin->portName(idx)).arg(controls[i].tmpVal).toLatin1().constData());
xml.tag(level, s.arg(Xml::xmlString(_plugin->portName(idx)).toLatin1().constData()).arg(controls[i].tmpVal).toLatin1().constData());
}
if (_on == false)
@@ -2241,11 +1985,9 @@ void PluginI::writeConfiguration(int level, Xml& xml)
xml.intTag(level, "gui", 1);
xml.geometryTag(level, "geometry", _gui);
}
- if (nativeGuiVisible()) {
+ if (nativeGuiVisible())
xml.intTag(level, "nativegui", 1);
- // TODO:
- //xml.geometryTag(level, "nativegeometry", ?);
- }
+
xml.tag(level--, "/plugin");
}
@@ -2258,8 +2000,7 @@ bool PluginI::loadControl(Xml& xml)
QString file;
QString label;
QString name("mops");
- //double val = 0.0;
- float val = 0.0; // p4.0.21
+ float val = 0.0;
for (;;) {
Xml::Token token = xml.parse();
@@ -2276,36 +2017,30 @@ bool PluginI::loadControl(Xml& xml)
if (tag == "name")
name = xml.s2();
else if (tag == "val")
- //val = xml.s2().toDouble();
val = xml.s2().toFloat(); // p4.0.21
break;
case Xml::TagEnd:
if (tag == "control") {
- //if (setControl(name, val))
- // return false;
- // p4.0.23 Special for loader - bypass the ring buffer and store directly,
- // so that upon the 'gui = 1' tag (show the gui), the gui has immediate
- // access to the values.
if(_plugin)
- {
- bool found = false;
- for(unsigned long i = 0; i < controlPorts; ++i)
- {
- if(_plugin->portName(controls[i].idx) == name)
- {
- controls[i].val = controls[i].tmpVal = val;
- found = true;
- }
- }
- if(!found)
- {
- printf("PluginI:loadControl(%s, %f) controller not found\n",
- name.toLatin1().constData(), val);
- return false;
- }
- initControlValues = true;
- }
+ {
+ bool found = false;
+ for(unsigned long i = 0; i < controlPorts; ++i)
+ {
+ if(_plugin->portName(controls[i].idx) == name)
+ {
+ controls[i].val = controls[i].tmpVal = val;
+ found = true;
+ }
+ }
+ if(!found)
+ {
+ printf("PluginI:loadControl(%s, %f) controller not found\n",
+ name.toLatin1().constData(), val);
+ return false;
+ }
+ initControlValues = true;
}
+ }
return true;
default:
break;
@@ -2324,8 +2059,6 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)
QString file;
QString label;
if (!readPreset)
- //instances = 1;
- // p3.3.41
channel = 1;
for (;;) {
@@ -2339,24 +2072,16 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)
if (!readPreset && _plugin == 0) {
_plugin = MusEGlobal::plugins.find(file, label);
- //if (_plugin && initPluginInstance(_plugin, instances)) {
- // p3.3.41
if (_plugin)
- {
- if(initPluginInstance(_plugin, channel)) {
+ {
+ if(initPluginInstance(_plugin, channel)) {
_plugin = 0;
xml.parse1();
printf("Error initializing plugin instance (%s, %s)\n",
file.toLatin1().constData(), label.toLatin1().constData());
- //break; // Don't break - let it read any control tags.
+ //break; // Don't break - let it read any control tags. DELETETHIS
}
- }
- else
- {
- //printf("Warning: Plugin not found (%s, %s)\n",
- // file.toLatin1().constData(), label.toLatin1().constData());
- //break; // Don't break - let it read any control tags.
- }
+ }
}
if (tag == "control")
loadControl(xml);
@@ -2407,8 +2132,6 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)
}
else if (tag == "channel") {
if (!readPreset)
- //instances = xml.s2().toInt();
- // p3.3.41
channel = xml.s2().toInt();
}
break;
@@ -2417,20 +2140,18 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)
if (!readPreset && _plugin == 0) {
_plugin = MusEGlobal::plugins.find(file, label);
if (_plugin == 0)
- {
+ {
printf("Warning: Plugin not found (%s, %s)\n",
file.toLatin1().constData(), label.toLatin1().constData());
return true;
- }
+ }
- //if (initPluginInstance(_plugin, instances))
- // p3.3.41
if (initPluginInstance(_plugin, channel))
- {
+ {
printf("Error initializing plugin instance (%s, %s)\n",
file.toLatin1().constData(), label.toLatin1().constData());
return true;
- }
+ }
}
if (_gui)
_gui->updateValues();
@@ -2531,7 +2252,6 @@ bool PluginI::nativeGuiVisible()
// makeGui
//---------------------------------------------------------
-//void PluginI::makeGui()
void PluginIBase::makeGui()
{
_gui = new MusEGui::PluginGui(this);
@@ -2540,7 +2260,6 @@ void PluginIBase::makeGui()
//---------------------------------------------------------
// deleteGui
//---------------------------------------------------------
-//void PluginI::deleteGui()
void PluginIBase::deleteGui()
{
if(_gui)
@@ -2556,7 +2275,6 @@ void PluginIBase::deleteGui()
void PluginI::enableAllControllers(bool v)
{
- //for(int i = 0; i < controlPorts; ++i)
for(unsigned long i = 0; i < controlPorts; ++i)
controls[i].enCtrl = v;
}
@@ -2567,7 +2285,6 @@ void PluginI::enableAllControllers(bool v)
void PluginI::enable2AllControllers(bool v)
{
- //for(int i = 0; i < controlPorts; ++i)
for(unsigned long i = 0; i < controlPorts; ++i)
controls[i].en2Ctrl = v;
}
@@ -2578,7 +2295,9 @@ void PluginI::enable2AllControllers(bool v)
QString PluginI::titlePrefix() const
{
- return _track->name() + QString(": ");
+ if (_track)
+ return _track->name() + QString(": ");
+ else return ":";
}
//---------------------------------------------------------
@@ -2586,6 +2305,8 @@ QString PluginI::titlePrefix() const
// If ports is 0, just process controllers only, not audio (do not 'run').
//---------------------------------------------------------
+//DELETETHIS 90
+
/*
//void PluginI::apply(int n)
void PluginI::apply(unsigned long n)
@@ -2676,11 +2397,10 @@ void PluginI::apply(unsigned long n)
}
}
*/
-
-#if 1
+
void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float** bufOut)
{
- // Process control value changes.
+ // Process control value changes. DELETETHIS 10
//if(MusEGlobal::automation && _track && _track->automationType() != AUTO_OFF && _id != -1)
//{
// for(int i = 0; i < controlPorts; ++i)
@@ -2691,7 +2411,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
//}
// Grab the control ring buffer size now.
- //const int cbsz = _controlFifo.getSize();
+ //const int cbsz = _controlFifo.getSize(); DELETETHIS 4
//unsigned endPos = pos + n;
//unsigned long frameOffset = MusEGlobal::audio->getFrameOffset();
@@ -2732,7 +2452,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
while(sample < n)
{
- //unsigned long nsamp = n;
+ //unsigned long nsamp = n; DELETETHIS 2
//unsigned long nsamp = n - sample;
unsigned long nsamp = usefixedrate ? fixedsize : n - sample;
bool found = false;
@@ -2740,18 +2460,18 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
unsigned long index = 0;
unsigned long evframe;
// Get all control ring buffer items valid for this time period...
- //for(int m = 0; m < cbsz; ++m) // Doesn't like this. Why?
+ //for(int m = 0; m < cbsz; ++m) // Doesn't like this. Why? DELETETHIS
while(!_controlFifo.isEmpty())
{
- //ControlValue v = _controlFifo.get();
+ //ControlValue v = _controlFifo.get(); DELETETHIS
ControlEvent v = _controlFifo.peek();
// The events happened in the last period or even before that. Shift into this period with + n. This will sync with audio.
// If the events happened even before current frame - n, make sure they are counted immediately as zero-frame.
- //evframe = (pos + frameOffset > v.frame + n) ? 0 : v.frame - pos - frameOffset + n;
+ //evframe = (pos + frameOffset > v.frame + n) ? 0 : v.frame - pos - frameOffset + n; DELETETHIS
evframe = (syncFrame > v.frame + n) ? 0 : v.frame - syncFrame + n;
// Process only items in this time period. Make sure to process all
// subsequent items which have the same frame.
- //printf("PluginI::apply control idx:%lu frame:%lu val:%f unique:%d evframe:%lu\n",
+ //printf("PluginI::apply control idx:%lu frame:%lu val:%f unique:%d evframe:%lu\n", DELETETHIS
// v.idx, v.frame, v.value, v.unique, evframe); // REMOVE Tim.
// Protection. Observed this condition. Why? Supposed to be linear timestamps.
if(found && evframe < frame)
@@ -2761,42 +2481,42 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
// Just make it equal to the current frame so it gets processed right away.
evframe = frame;
}
- //if(v.frame >= (endPos + frameOffset) || (found && v.frame != frame))
+ //if(v.frame >= (endPos + frameOffset) || (found && v.frame != frame)) DELETETHIS 5
//if(v.frame < sample || v.frame >= (sample + nsamp) || (found && v.frame != frame))
//if(v.frame < sample || v.frame >= (endPos + frameOffset) || (found && v.frame != frame))
//if(v.frame < sample || v.frame >= (endPos + frameOffset)
//if(v.frame < sample || v.frame >= frameOffset
if(evframe >= n
- //|| (found && v.frame != frame)
+ //|| (found && v.frame != frame) DELETETHIS 3
//|| (!usefixedrate && found && !v.unique && v.frame != frame)
//|| (found && !v.unique && evframe != frame)
// Not enough requested samples to satisfy minimum setting? Keep going.
|| (found && !v.unique && (evframe - sample >= min_per))
// Protection. Observed this condition (dummy audio so far). Why? Supposed to be linear timestamps.
- //|| (found && evframe < frame)
+ //|| (found && evframe < frame) DELETETHIS
// dssi-vst needs them serialized and accounted for, no matter what. This works with fixed rate
// because nsamp is constant. But with packets, we need to guarantee at least one-frame spacing.
// Although we likely won't be using packets with dssi-vst, so it's OK for now.
- //|| (found && v.idx == index))
+ //|| (found && v.idx == index)) DELETETHIS
//|| (usefixedrate && found && v.idx == index)) // Try this.
|| (usefixedrate && found && v.unique && v.idx == index)) //
break;
_controlFifo.remove(); // Done with the ring buffer's item. Remove it.
- //if(v.idx >= controlPorts) // Sanity check.
+ //if(v.idx >= controlPorts) // Sanity check. DELETETHIS
if(v.idx >= _plugin->_controlInPorts)
break;
found = true;
- //frame = v.frame;
+ //frame = v.frame; DELETETHIS
frame = evframe;
index = v.idx;
// Set the ladspa control port value.
- //controls[v.idx].val = v.value;
+ //controls[v.idx].val = v.value; DELETETHIS
controls[v.idx].tmpVal = v.value;
// Need to update the automation value, otherwise it overwrites later with the last MusEGlobal::automation value.
if(_track && _id != -1)
{
- // Since we are now in the audio thread context, there's no need to send a message,
+ // Since we are now in the audio thread context, there's no need to send a message, DELETETHIS 5
// just modify directly.
//MusEGlobal::audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val);
// p3.3.43
@@ -2814,7 +2534,7 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
// TODO: Taken from our native gui control handlers.
// This may need modification or may cause problems -
// we don't have the luxury of access to the dssi gui controls !
- //if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH))
+ //if(at == AUTO_WRITE || (MusEGlobal::audio->isPlaying() && at == AUTO_TOUCH)) DELETETHIS 3
// enableController(k, false);
//_track->recordAutomation(id, v.value);
}
@@ -2823,20 +2543,17 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
// Now update the actual values from the temporary values...
for(unsigned long k = 0; k < controlPorts; ++k)
{
- // printf("PluginI::apply updating port:%lu val:%f\n", k, controls[k].tmpVal);
+ // printf("PluginI::apply updating port:%lu val:%f\n", k, controls[k].tmpVal); DELETETHIS
controls[k].val = controls[k].tmpVal;
}
//if(found)
if(found && !usefixedrate)
- //nsamp = frame - sample + 1;
+ //nsamp = frame - sample + 1; DELETETHIS
nsamp = frame - sample;
if(sample + nsamp >= n) // Safety check.
nsamp = n - sample;
- //printf("PluginI::apply ports:%lu n:%lu frame:%lu sample:%lu nsamp:%lu syncFrame:%lu loopcount:%d\n",
- // ports, n, frame, sample, nsamp, syncFrame, loopcount);
-
// Don't allow zero-length runs. This could/should be checked in the control loop instead.
// Note this means it is still possible to get stuck in the top loop (at least for a while).
if(nsamp == 0)
@@ -2847,17 +2564,13 @@ void PluginI::apply(unsigned long n, unsigned long ports, float** bufIn, float**
connect(ports, sample, bufIn, bufOut);
for(int i = 0; i < instances; ++i)
- {
- //fprintf(stderr, "PluginI::apply handle %d\n", i);
_plugin->apply(handle[i], nsamp);
- }
}
sample += nsamp;
- loopcount++; // REMOVE Tim.
+ loopcount++; // REMOVE Tim. DELETETHIS then
}
}
-#endif
//---------------------------------------------------------
// oscConfigure
@@ -2885,7 +2598,6 @@ int Plugin::oscConfigure(LADSPA_Handle handle, const char* key, const char* valu
char* message = dssi_descr->configure(handle, key, value);
if (message) {
printf("Plugin::oscConfigure on configure '%s' '%s', plugin '%s' returned error '%s'\n",
- //key, value, synti->name().toAscii().data(), message);
key, value, plugin->Label, message);
free(message);
@@ -2898,10 +2610,6 @@ int Plugin::oscConfigure(LADSPA_Handle handle, const char* key, const char* valu
// instances[n].ui_osc_configure_path, "ss", key, value);
// }
- // configure invalidates bank and program information, so
- // we should do this again now:
- //queryPrograms();
-
#endif // DSSI_SUPPORT
return 0;
@@ -2928,9 +2636,6 @@ int PluginI::oscConfigure(const char *key, const char *value)
// concept of restoring an instance from one run to the next, so
// we don't bother remembering these at all.
- //const char *key = (const char *)&argv[0]->s;
- //const char *value = (const char *)&argv[1]->s;
-
#ifdef PLUGIN_DEBUGIN
printf("PluginI::oscConfigure effect plugin name:%s label:%s key:%s value:%s\n", _name.toLatin1().constData(), _label.toLatin1().constData(), key, value);
#endif
@@ -2939,17 +2644,6 @@ int PluginI::oscConfigure(const char *key, const char *value)
// FIXME: Don't think this is right, should probably do as example shows below.
for(int i = 0; i < instances; ++i)
_plugin->oscConfigure(handle[i], key, value);
-
- // also call back on UIs for plugins other than the one
- // that requested this:
- // if (n != instance->number && instances[n].uiTarget) {
- // lo_send(instances[n].uiTarget,
- // instances[n].ui_osc_configure_path, "ss", key, value);
- // }
-
- // configure invalidates bank and program information, so
- // we should do this again now:
- //queryPrograms();
#endif // DSSI_SUPPORT
return 0;
@@ -2965,7 +2659,7 @@ int PluginI::oscUpdate()
// Send project directory.
_oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, MusEGlobal::museProject.toLatin1().constData()); // MusEGlobal::song->projectPath()
- /*
+ /* DELETETHIS 20
// Send current string configuration parameters.
StringParamMap& map = synti->stringParameters();
int i = 0;
@@ -2989,11 +2683,11 @@ int PluginI::oscUpdate()
usleep(300000);
// Send current control values.
- //unsigned long ports = controlPorts;
+ //unsigned long ports = controlPorts; DELETETHIS 2
//for(int i = 0; i < controlPorts; ++i)
for(unsigned long i = 0; i < controlPorts; ++i)
{
- //unsigned long k = synth->pIdx(i);
+ //unsigned long k = synth->pIdx(i); DELETETHIS 2
//_oscIF.oscSendControl(k, controls[i]);
//printf("PluginI::oscUpdate() sending control:%lu val:%f\n", i, controls[i].val);
_oscif.oscSendControl(controls[i].idx, controls[i].val);
@@ -3012,17 +2706,10 @@ int PluginI::oscUpdate()
int PluginI::oscControl(unsigned long port, float value)
{
- //int port = argv[0]->i;
- //LADSPA_Data value = argv[1]->f;
-
#ifdef PLUGIN_DEBUGIN
printf("PluginI::oscControl received oscControl port:%lu val:%f\n", port, value);
#endif
- //int controlPorts = synth->_controller;
-
- //if(port >= controlPorts)
- //if(port < 0 || port >= _plugin->rpIdx.size())
if(port >= _plugin->rpIdx.size())
{
fprintf(stderr, "PluginI::oscControl: port number:%lu is out of range of index list size:%zd\n", port, _plugin->rpIdx.size());
@@ -3054,7 +2741,7 @@ int PluginI::oscControl(unsigned long port, float value)
// TODO: May need FIFOs on each control(!) so that the control changes get sent one per process cycle!
// Observed countdown not actually going to zero upon string of changes.
// Try this ...
- /*
+ /* DELETETHIS 20
OscControlFifo* cfifo = _oscif.oscFifo(cport);
if(cfifo)
{
@@ -3097,7 +2784,6 @@ int PluginI::oscControl(unsigned long port, float value)
// That makes this pretty useless... But what the heck...
if(_track && _id != -1)
{
- //int id = genACnum(_id, cport);
unsigned long id = genACnum(_id, cport);
AutomationType at = _track->automationType();
@@ -3110,7 +2796,7 @@ int PluginI::oscControl(unsigned long port, float value)
_track->recordAutomation(id, value);
}
- /*
+ /* DELETETHIS 12
const DSSI_Descriptor* dssi = synth->dssi;
const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
@@ -3126,6 +2812,7 @@ int PluginI::oscControl(unsigned long port, float value)
}
*/
+// DELETETHIS 20
#if 0
int port = argv[0]->i;
LADSPA_Data value = argv[1]->f;
@@ -3175,7 +2862,7 @@ PluginDialog::PluginDialog(QWidget* parent)
// "Note: In order to avoid performance issues, it is recommended that sorting
// is enabled after inserting the items into the tree. Alternatively, you could
// also insert the items into a list before inserting the items into the tree. "
- //pList->setSortingEnabled(true);
+ //pList->setSortingEnabled(true); DELETETHIS
QStringList headerLabels;
headerLabels << tr("Lib");
headerLabels << tr("Label");
@@ -3196,7 +2883,7 @@ PluginDialog::PluginDialog(QWidget* parent)
pList->setAlternatingRowColors(true);
pList->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- //fillPlugs(selectedPlugType);
+ //fillPlugs(selectedPlugType); DELETETHIS 3
//pList->setSortingEnabled(true);
//pList->sortByColumn(sortColumn, sortOrder);
@@ -3218,20 +2905,14 @@ PluginDialog::PluginDialog(QWidget* parent)
okB->setFixedWidth(80);
okB->setEnabled(false);
cancelB->setFixedWidth(80);
- //ok_lo->addStretch(4);
- //ok_lo->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Maximum));
ok_lo->addWidget(okB);
ok_lo->addSpacing(8);
ok_lo->addWidget(cancelB);
- //ok_lo->addStretch(4);
- //ok_lo->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Maximum));
QGroupBox* plugSelGroup = new QGroupBox(this);
plugSelGroup->setTitle("Show plugs:");
plugSelGroup->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
- //QHBoxLayout* psl = new QHBoxLayout;
QGridLayout* psl = new QGridLayout;
- //psl->setRowStretch(0, 0);
plugSelGroup->setLayout(psl);
QButtonGroup* plugSel = new QButtonGroup(plugSelGroup);
@@ -3239,25 +2920,21 @@ PluginDialog::PluginDialog(QWidget* parent)
onlySM->setText(tr("Mono and Stereo"));
onlySM->setCheckable(true);
plugSel->addButton(onlySM);
- //psl->addWidget(onlySM);
psl->addWidget(onlySM, 1, 0);
onlyS = new QRadioButton(this);
onlyS->setText(tr("Stereo"));
onlyS->setCheckable(true);
plugSel->addButton(onlyS);
- //psl->addWidget(onlyS);
psl->addWidget(onlyS, 0, 1);
onlyM = new QRadioButton(this);
onlyM->setText(tr("Mono"));
onlyM->setCheckable(true);
plugSel->addButton(onlyM);
- //psl->addWidget(onlyM);
psl->addWidget(onlyM, 0, 0);
allPlug = new QRadioButton(this);
allPlug->setText(tr("Show All"));
allPlug->setCheckable(true);
plugSel->addButton(allPlug);
- //psl->addWidget(allPlug);
psl->addWidget(allPlug, 1, 1);
plugSel->setExclusive(true);
@@ -3292,7 +2969,7 @@ PluginDialog::PluginDialog(QWidget* parent)
sortBox->setMinimumSize(100, 10);
srch_lo->addWidget(sortBox);
- //srch_lo->addStretch();
+ //srch_lo->addStretch(); DELETETHIS 4
// FIXME: Adding this makes the whole bottom hlayout expand. Would like some space between lineedit and bottom.
// Same thing if spacers added to group box or Ok Cancel box.
//srch_lo->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Maximum));
@@ -3303,18 +2980,12 @@ PluginDialog::PluginDialog(QWidget* parent)
if(listSave.isEmpty())
{
- //int sizes[] = { 110, 110, 0, 30, 30, 30, 30, 30, 50, 110, 110 };
int sizes[] = { 110, 110, 110, 30, 30, 30, 30, 30, 50, 110, 110 };
for (int i = 0; i < 11; ++i) {
- //if (sizes[i] == 0) {
- // pList->header()->setResizeMode(i, QHeaderView::Stretch);
- // }
- //else {
- if (sizes[i] <= 50) // hack alert!
- pList->header()->setResizeMode(i, QHeaderView::Fixed);
- pList->header()->resizeSection(i, sizes[i]);
- // }
- }
+ if (sizes[i] <= 50) // hack alert!
+ pList->header()->setResizeMode(i, QHeaderView::Fixed);
+ pList->header()->resizeSection(i, sizes[i]);
+ }
pList->sortByColumn(0, Qt::AscendingOrder);
}
else
@@ -3368,13 +3039,10 @@ void PluginDialog::saveSettings()
sortItems.push_front(sortBox->currentText());
}
- ///sortColumn = pList->sortColumn();
QHeaderView* hdr = pList->header();
if(hdr)
- {
- ///sortOrder = hdr->sortIndicatorOrder();
listSave = hdr->saveState();
- }
+
geometrySave = geometry();
}
@@ -3405,16 +3073,12 @@ void PluginDialog::reject()
void PluginDialog::fillPlugs(QAbstractButton* ab)
{
if (ab == allPlug)
- //fillPlugs(SEL_ALL);
selectedPlugType = SEL_ALL;
else if (ab == onlyM)
- //fillPlugs(SEL_M);
selectedPlugType = SEL_M;
else if (ab == onlyS)
- //fillPlugs(SEL_S);
selectedPlugType = SEL_S;
else if (ab == onlySM)
- //fillPlugs(SEL_SM);
selectedPlugType = SEL_SM;
fillPlugs();
}
@@ -3423,10 +3087,6 @@ void PluginDialog::fillPlugs()
{
pList->clear();
for (MusECore::iPlugin i = MusEGlobal::plugins.begin(); i != MusEGlobal::plugins.end(); ++i) {
- //int ai = i->inports();
- //int ao = i->outports();
- //int ci = i->controlInPorts();
- //int co = i->controlOutPorts();
unsigned long ai = i->inports(); // p4.0.21
unsigned long ao = i->outports();
unsigned long ci = i->controlInPorts();
@@ -3503,8 +3163,6 @@ const char* presetBypassText = "Click this button to bypass effect unit";
// PluginGui
//---------------------------------------------------------
-//PluginGui::PluginGui(PluginI* p)
-// p3.3.43
PluginGui::PluginGui(MusECore::PluginIBase* p)
: QMainWindow(0)
{
@@ -3512,7 +3170,6 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
params = 0;
paramsOut = 0;
plugin = p;
- //setWindowTitle(plugin->name());
setWindowTitle(plugin->titlePrefix() + plugin->name());
QToolBar* tools = addToolBar(tr("File Buttons"));
@@ -3536,7 +3193,6 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
// TODO: We need to use .qrc files to use icons in WhatsThis bubbles. See Qt
// Resource System in Qt documentation - ORCAN
- //Q3MimeSourceFactory::defaultFactory()->setPixmap(QString("fileopen"), *openIcon );
fileOpen->setWhatsThis(tr(presetOpenText));
onOff->setWhatsThis(tr(presetBypassText));
fileSave->setWhatsThis(tr(presetSaveText));
@@ -3567,10 +3223,6 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
const char* name = ba.constData();
if (*name !='P')
continue;
- //int parameter = -1;
- //sscanf(name, "P%d", &parameter);
- //if (parameter == -1)
- // continue;
unsigned long parameter; // p4.0.21
int rv = sscanf(name, "P%lu", &parameter);
if(rv != 1)
@@ -3598,10 +3250,6 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
const char* name = ba.constData();
if (*name !='P')
continue;
- //int parameter = -1;
- //sscanf(name, "P%d", &parameter);
- //if (parameter == -1)
- // continue;
unsigned long parameter; // p4.0.21
int rv = sscanf(name, "P%lu", &parameter);
if(rv != 1)
@@ -3619,7 +3267,6 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
gw[nobj].type = GuiWidgets::SLIDER;
((Slider*)obj)->setId(nobj);
((Slider*)obj)->setCursorHoming(true);
- //for(int i = 0; i < nobj; i++)
for(unsigned long i = 0; i < nobj; i++) // p4.0.21
{
if(gw[i].type == GuiWidgets::DOUBLE_LABEL && gw[i].param == parameter)
@@ -3633,7 +3280,6 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
else if (strcmp(obj->metaObject()->className(), "MusEGui::DoubleLabel") == 0) {
gw[nobj].type = GuiWidgets::DOUBLE_LABEL;
((DoubleLabel*)obj)->setId(nobj);
- //for(int i = 0; i < nobj; i++)
for(unsigned long i = 0; i < nobj; i++)
{
if(gw[i].type == GuiWidgets::SLIDER && gw[i].param == parameter)
@@ -3674,15 +3320,12 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
mw->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
- //int n = plugin->parameters();
unsigned long n = plugin->parameters(); // p4.0.21
params = new GuiParam[n];
- //int style = Slider::BgTrough | Slider::BgSlot;
QFontMetrics fm = fontMetrics();
int h = fm.height() + 4;
- //for (int i = 0; i < n; ++i) {
for (unsigned long i = 0; i < n; ++i) { // p4.0.21
QLabel* label = 0;
LADSPA_PortRangeHint range = plugin->range(i);
@@ -3698,7 +3341,7 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
if (LADSPA_IS_HINT_TOGGLED(range.HintDescriptor)) {
params[i].type = GuiParam::GUI_SWITCH;
- CheckBox* cb = new CheckBox(mw, i, "param");
+ CheckBox* cb = new CheckBox(mw, i, "param");
cb->setId(i);
cb->setText(QString(plugin->paramName(i)));
cb->setChecked(plugin->param(i) != 0.0);
@@ -3734,20 +3377,15 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
params[i].actuator = s;
params[i].label->setSlider((Slider*)params[i].actuator);
}
- //params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum));
params[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed));
if (params[i].type == GuiParam::GUI_SLIDER) {
- //label->setFixedHeight(20);
- //label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum));
label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
- //params[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum));
params[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
grid->addWidget(label, i, 0);
grid->addWidget(params[i].label, i, 1);
grid->addWidget(params[i].actuator, i, 2);
}
else if (params[i].type == GuiParam::GUI_SWITCH) {
- //grid->addMultiCellWidget(params[i].actuator, i, i, 0, 2);
grid->addWidget(params[i].actuator, i, 0, 1, 3);
}
if (params[i].type == GuiParam::GUI_SLIDER) {
@@ -3793,20 +3431,16 @@ PluginGui::PluginGui(MusECore::PluginIBase* p)
if(LADSPA_IS_HINT_INTEGER(range.HintDescriptor))
mType=Meter::DBMeter;
VerticalMeter* m = new VerticalMeter(this, mType);
- //printf("lower =%f upper=%f dlower=%f dupper=%f\n", lower, upper,dlower,dupper);
m->setRange(dlower, dupper);
m->setVal(dval);
m->setFixedHeight(h);
paramsOut[i].actuator = m;
-// paramsOut[i].label->setSlider((Slider*)params[i].actuator);
- //paramsOut[i].actuator->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
paramsOut[i].label->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
grid->addWidget(label, n+i, 0);
grid->addWidget(paramsOut[i].label, n+i, 1);
grid->addWidget(paramsOut[i].actuator, n+i, 2);
-// connect(paramsOut[i].label, SIGNAL(valueChanged(double,int)), SLOT(labelChanged(double,int)));
}
}
@@ -3897,14 +3531,8 @@ void PluginGui::ctrlPressed(int param)
plugin->setParam(param, val);
((DoubleLabel*)params[param].label)->setValue(val);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
-
if(track)
{
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
track->setPluginCtrlVal(id, val);
MusEGlobal::song->controllerChange(track);
@@ -3913,18 +3541,11 @@ void PluginGui::ctrlPressed(int param)
}
else if(params[param].type == GuiParam::GUI_SWITCH)
{
- //double val = (double)((CheckBox*)params[param].actuator)->isChecked();
float val = (float)((CheckBox*)params[param].actuator)->isChecked(); // p4.0.21
plugin->setParam(param, val);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
-
if(track)
{
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
track->setPluginCtrlVal(id, val);
MusEGlobal::song->controllerChange(track);
@@ -3964,12 +3585,6 @@ void PluginGui::ctrlReleased(int param)
val = rint(val);
track->stopAutoRecord(id, val);
}
- //else if(params[param].type == GuiParam::GUI_SWITCH)
- //{
- //double val = (double)((CheckBox*)params[param].actuator)->isChecked();
- // No concept of 'untouching' a checkbox. Remain 'touched' until stop.
- //plugin->track()->stopAutoRecord(MusECore::genACnum(plugin->id(), param), val);
- //}
}
//---------------------------------------------------------
@@ -3980,7 +3595,6 @@ void PluginGui::ctrlRightClicked(const QPoint &p, int param)
{
int id = plugin->id();
if(id != -1)
- //MusEGlobal::song->execAutomationCtlPopup((MusECore::AudioTrack*)plugin->track(), p, MusECore::genACnum(id, param));
MusEGlobal::song->execAutomationCtlPopup(plugin->track(), p, MusECore::genACnum(id, param));
}
@@ -4012,14 +3626,8 @@ void PluginGui::sliderChanged(double val, int param)
return;
id = MusECore::genACnum(id, param);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
-
if(track)
{
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
track->setPluginCtrlVal(id, val);
MusEGlobal::song->controllerChange(track);
@@ -4057,14 +3665,8 @@ void PluginGui::labelChanged(double val, int param)
id = MusECore::genACnum(id, param);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
-
if(track)
{
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
track->setPluginCtrlVal(id, val);
MusEGlobal::song->controllerChange(track);
@@ -4079,7 +3681,6 @@ void PluginGui::labelChanged(double val, int param)
void PluginGui::load()
{
QString s("presets/plugins/");
- //s += plugin->plugin()->label();
s += plugin->pluginLabel();
s += "/";
@@ -4144,11 +3745,9 @@ ende:
void PluginGui::save()
{
QString s("presets/plugins/");
- //s += plugin->plugin()->label();
s += plugin->pluginLabel();
s += "/";
- //QString fn = getSaveFileName(s, MusEGlobal::preset_file_pattern, this,
QString fn = getSaveFileName(s, MusEGlobal::preset_file_save_pattern, this,
tr("MusE: save preset"));
if (fn.isEmpty())
@@ -4199,7 +3798,6 @@ void PluginGui::setOn(bool val)
void PluginGui::updateValues()
{
if (params) {
- //for (int i = 0; i < plugin->parameters(); ++i) {
for (unsigned long i = 0; i < plugin->parameters(); ++i) { // p4.0.21
GuiParam* gp = &params[i];
if (gp->type == GuiParam::GUI_SLIDER) {
@@ -4221,12 +3819,9 @@ void PluginGui::updateValues()
}
}
else if (gw) {
- //for (int i = 0; i < nobj; ++i) {
for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21
QWidget* widget = gw[i].widget;
int type = gw[i].type;
- //int param = gw[i].param;
- //double val = plugin->param(param);
unsigned long param = gw[i].param; // p4.0.21
float val = plugin->param(param);
switch(type) {
@@ -4279,13 +3874,7 @@ void PluginGui::updateControls()
}
- //if(!MusEGlobal::automation)
- // return;
- //AutomationType at = plugin->track()->automationType();
- //if(at == AUTO_OFF)
- // return;
if (params) {
- //for (int i = 0; i < plugin->parameters(); ++i) {
for (unsigned long i = 0; i < plugin->parameters(); ++i) { // p4.0.21
GuiParam* gp = &params[i];
if (gp->type == GuiParam::GUI_SLIDER) {
@@ -4303,8 +3892,6 @@ void PluginGui::updateControls()
}
if(((Slider*)(gp->actuator))->value() != sv)
{
- //printf("PluginGui::updateControls slider\n");
-
gp->label->blockSignals(true);
((Slider*)(gp->actuator))->blockSignals(true);
((Slider*)(gp->actuator))->setValue(sv);
@@ -4321,8 +3908,6 @@ void PluginGui::updateControls()
bool v = (int)plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), i));
if(((CheckBox*)(gp->actuator))->isChecked() != v)
{
- //printf("PluginGui::updateControls switch\n");
-
((CheckBox*)(gp->actuator))->blockSignals(true);
((CheckBox*)(gp->actuator))->setChecked(v);
((CheckBox*)(gp->actuator))->blockSignals(false);
@@ -4332,11 +3917,9 @@ void PluginGui::updateControls()
}
}
else if (gw) {
- //for (int i = 0; i < nobj; ++i) {
for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21
QWidget* widget = gw[i].widget;
int type = gw[i].type;
- //int param = gw[i].param;
unsigned long param = gw[i].param; // p4.0.21
switch(type) {
case GuiWidgets::SLIDER:
@@ -4345,8 +3928,6 @@ void PluginGui::updateControls()
double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param));
if(((Slider*)widget)->value() != v)
{
- //printf("PluginGui::updateControls slider\n");
-
((Slider*)widget)->blockSignals(true);
((Slider*)widget)->setValue(v);
((Slider*)widget)->blockSignals(false);
@@ -4359,8 +3940,6 @@ void PluginGui::updateControls()
double v = plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param));
if(((DoubleLabel*)widget)->value() != v)
{
- //printf("PluginGui::updateControls label\n");
-
((DoubleLabel*)widget)->blockSignals(true);
((DoubleLabel*)widget)->setValue(v);
((DoubleLabel*)widget)->blockSignals(false);
@@ -4373,8 +3952,6 @@ void PluginGui::updateControls()
bool b = (bool) plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param));
if(((QCheckBox*)widget)->isChecked() != b)
{
- //printf("PluginGui::updateControls checkbox\n");
-
((QCheckBox*)widget)->blockSignals(true);
((QCheckBox*)widget)->setChecked(b);
((QCheckBox*)widget)->blockSignals(false);
@@ -4387,8 +3964,6 @@ void PluginGui::updateControls()
int n = (int) plugin->track()->pluginCtrlVal(MusECore::genACnum(plugin->id(), param));
if(((QComboBox*)widget)->currentIndex() != n)
{
- //printf("PluginGui::updateControls combobox\n");
-
((QComboBox*)widget)->blockSignals(true);
((QComboBox*)widget)->setCurrentIndex(n);
((QComboBox*)widget)->blockSignals(false);
@@ -4407,7 +3982,6 @@ void PluginGui::updateControls()
void PluginGui::guiParamChanged(int idx)
{
QWidget* w = gw[idx].widget;
- //int param = gw[idx].param;
unsigned long param = gw[idx].param; // p4.0.21
int type = gw[idx].type;
@@ -4435,7 +4009,6 @@ void PluginGui::guiParamChanged(int idx)
break;
}
- //for (int i = 0; i < nobj; ++i) {
for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21
QWidget* widget = gw[i].widget;
if (widget == w || param != gw[i].param)
@@ -4462,28 +4035,19 @@ void PluginGui::guiParamChanged(int idx)
{
id = MusECore::genACnum(id, param);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
+ track->setPluginCtrlVal(id, val);
+ MusEGlobal::song->controllerChange(track);
- //if(track)
- //{
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
- track->setPluginCtrlVal(id, val);
- MusEGlobal::song->controllerChange(track);
-
- switch(type)
- {
- case GuiWidgets::DOUBLE_LABEL:
- case GuiWidgets::QCHECKBOX:
- track->startAutoRecord(id, val);
- break;
- default:
- track->recordAutomation(id, val);
- break;
- }
- //}
+ switch(type)
+ {
+ case GuiWidgets::DOUBLE_LABEL:
+ case GuiWidgets::QCHECKBOX:
+ track->startAutoRecord(id, val);
+ break;
+ default:
+ track->recordAutomation(id, val);
+ break;
+ }
}
plugin->setParam(param, val);
}
@@ -4494,7 +4058,6 @@ void PluginGui::guiParamChanged(int idx)
void PluginGui::guiParamPressed(int idx)
{
- //int param = gw[idx].param;
unsigned long param = gw[idx].param; // p4.0.21
AutomationType at = AUTO_OFF;
@@ -4515,7 +4078,7 @@ void PluginGui::guiParamPressed(int idx)
// would have to be used, and changed to use CheckBox and ComboBox
// instead of QCheckBox and QComboBox, since both of those would
// need customization (Ex. QCheckBox doesn't check on click).
- /*
+ /* DELETETHIS 10 plus above
switch(type) {
case GuiWidgets::QCHECKBOX:
double val = (double)((CheckBox*)w)->isChecked();
@@ -4535,7 +4098,6 @@ void PluginGui::guiParamPressed(int idx)
void PluginGui::guiParamReleased(int idx)
{
- //int param = gw[idx].param;
unsigned long param = gw[idx].param; // p4.0.21
int type = gw[idx].type;
@@ -4561,7 +4123,7 @@ void PluginGui::guiParamReleased(int idx)
// would have to be used, and changed to use CheckBox and ComboBox
// instead of QCheckBox and QComboBox, since both of those would
// need customization (Ex. QCheckBox doesn't check on click).
- /*
+ /* DELETETHIS 10 plus above
switch(type) {
case GuiWidgets::QCHECKBOX:
double val = (double)((CheckBox*)w)->isChecked();
@@ -4581,7 +4143,6 @@ void PluginGui::guiParamReleased(int idx)
void PluginGui::guiSliderPressed(int idx)
{
- //int param = gw[idx].param;
unsigned long param = gw[idx].param; // p4.0.21
QWidget *w = gw[idx].widget;
@@ -4603,17 +4164,12 @@ void PluginGui::guiSliderPressed(int idx)
double val = ((Slider*)w)->value();
plugin->setParam(param, val);
- //MusEGlobal::audio->msgSetPluginCtrlVal(((PluginI*)plugin), id, val);
- // p3.3.43
- //MusEGlobal::audio->msgSetPluginCtrlVal(track, id, val);
- // p4.0.21 MusEGlobal::audio->msgXXX waits. Do we really need to?
track->setPluginCtrlVal(id, val);
MusEGlobal::song->controllerChange(track);
track->startAutoRecord(id, val);
// Needed so that paging a slider updates a label or other buddy control.
- //for (int i = 0; i < nobj; ++i) {
for (unsigned long i = 0; i < nobj; ++i) { // p4.0.21
QWidget* widget = gw[i].widget;
if (widget == w || param != gw[i].param)
@@ -4673,7 +4229,6 @@ void PluginGui::guiSliderRightClicked(const QPoint &p, int idx)
int param = gw[idx].param;
int id = plugin->id();
if(id != -1)
- //MusEGlobal::song->execAutomationCtlPopup((MusECore::AudioTrack*)plugin->track(), p, MusECore::genACnum(id, param));
MusEGlobal::song->execAutomationCtlPopup(plugin->track(), p, MusECore::genACnum(id, param));
}