565
579
//---------------------------------------------------------
567
Plugin::Plugin(QFileInfo* f,
568
LADSPA_Descriptor_Function df, const LADSPA_Descriptor* d, bool ip)
569
: fi(*f), ladspa(df), plugin(d)
571
_inPlaceCapable = ip;
581
Plugin::Plugin(QFileInfo* f, const LADSPA_Descriptor* d, bool isDssi)
594
_label = QString(d->Label);
595
_name = QString(d->Name);
596
_uniqueID = d->UniqueID;
597
_maker = QString(d->Maker);
598
_copyright = QString(d->Copyright);
600
_portCount = d->PortCount;
601
//_portDescriptors = 0;
603
// _portDescriptors = new LADSPA_PortDescriptor[_portCount];
609
_controlOutPorts = 0;
610
for(unsigned long k = 0; k < _portCount; ++k)
612
LADSPA_PortDescriptor pd = d->PortDescriptors[k];
613
//_portDescriptors[k] = pd;
614
if(pd & LADSPA_PORT_AUDIO)
616
if(pd & LADSPA_PORT_INPUT)
619
if(pd & LADSPA_PORT_OUTPUT)
623
if(pd & LADSPA_PORT_CONTROL)
625
if(pd & LADSPA_PORT_INPUT)
628
if(pd & LADSPA_PORT_OUTPUT)
633
_inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(d->Properties);
635
// By T356. Blacklist vst plugins in-place configurable for now. At one point they
636
// were working with in-place here, but not now, and RJ also reported they weren't working.
637
// Fixes problem with vst plugins not working or feeding back loudly.
638
// I can only think of two things that made them stop working:
639
// 1): I switched back from Jack-2 to Jack-1
640
// 2): I changed winecfg audio to use Jack instead of ALSA.
641
// Will test later...
642
// Possibly the first one because under Mandriva2007.1 (Jack-1), no matter how hard I tried,
643
// the same problem existed. It may have been when using Jack-2 with Mandriva2009 that they worked.
644
// Apparently the plugins are lying about their in-place capability.
646
/* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
647
may cease to work correctly if the host elects to use the same data
648
location for both input and output (see connect_port()). This
649
should be avoided as enabling this flag makes it impossible for
650
hosts to use the plugin to process audio `in-place.' */
651
// Examination of all my ladspa and vst synths and effects plugins showed only one -
652
// EnsembleLite (EnsLite VST) has the flag set, but it is a vst synth and is not involved here!
653
// Yet many (all?) ladspa vst effect plugins exhibit this problem.
654
// Changed by Tim. p3.3.14
655
if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
656
_inPlaceCapable = false;
661
//if(_portDescriptors)
662
// delete[] _portDescriptors;
665
//---------------------------------------------------------
667
//---------------------------------------------------------
669
int Plugin::incReferences(int val)
671
#ifdef PLUGIN_DEBUGIN
672
fprintf(stderr, "Plugin::incReferences _references:%d val:%d\n", _references, val);
675
int newref = _references + val;
682
#ifdef PLUGIN_DEBUGIN
683
fprintf(stderr, "Plugin::incReferences no more instances, closing library\n");
701
//if(_references == 0)
705
_handle = dlopen(fi.filePath().latin1(), RTLD_NOW);
706
//handle = dlopen(fi.absFilePath().latin1(), RTLD_NOW);
710
fprintf(stderr, "Plugin::incReferences dlopen(%s) failed: %s\n",
711
fi.filePath().latin1(), dlerror());
712
//fi.absFilePath().latin1(), dlerror());
717
DSSI_Descriptor_Function dssi = (DSSI_Descriptor_Function)dlsym(_handle, "dssi_descriptor");
720
const DSSI_Descriptor* descr;
727
QString label(descr->LADSPA_Plugin->Label);
728
// Listing effect plugins only while excluding synths:
729
// Do exactly what dssi-vst.cpp does for listing ladspa plugins.
730
//if(label == _name &&
731
if(label == _label &&
733
!descr->run_synth_adding &&
734
!descr->run_multiple_synths &&
735
!descr->run_multiple_synths_adding)
740
plugin = descr->LADSPA_Plugin;
746
#endif // DSSI_SUPPORT
748
LADSPA_Descriptor_Function ladspadf = (LADSPA_Descriptor_Function)dlsym(_handle, "ladspa_descriptor");
751
const LADSPA_Descriptor* descr;
758
QString label(descr->Label);
779
_name = QString(plugin->Name);
780
_uniqueID = plugin->UniqueID;
781
_maker = QString(plugin->Maker);
782
_copyright = QString(plugin->Copyright);
784
//if(_portDescriptors)
785
// delete[] _portDescriptors;
786
//_portDescriptors = 0;
787
_portCount = plugin->PortCount;
789
// _portDescriptors = new LADSPA_PortDescriptor[_portCount];
574
for (unsigned k = 0; k < d->PortCount; ++k) {
575
LADSPA_PortDescriptor pd = d->PortDescriptors[k];
576
if (pd & LADSPA_PORT_CONTROL)
578
if (pd & LADSPA_PORT_INPUT)
584
// By T356. Blacklist vst plugins in-place configurable for now. At one point they
585
// were working with in-place here, but not now, and RJ also reported they weren't working.
586
// Fixes problem with vst plugins not working or feeding back loudly.
587
// I can only think of two things that made them stop working:
588
// 1): I switched back from Jack-2 to Jack-1
589
// 2): I changed winecfg audio to use Jack instead of ALSA.
590
// Will test later...
591
// Possibly the first one because under Mandriva2007.1 (Jack-1), no matter how hard I tried,
592
// the same problem existed. It may have been when using Jack-2 with Mandriva2009 that they worked.
593
// Apparently the plugins are lying about their in-place capability.
595
/* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
596
may cease to work correctly if the host elects to use the same data
597
location for both input and output (see connect_port()). This
598
should be avoided as enabling this flag makes it impossible for
599
hosts to use the plugin to process audio `in-place.' */
600
// Examination of all my ladspa and vst synths and effects plugins showed only one -
601
// EnsembleLite (EnsLite VST) has the flag set, but it is a vst synth and is not involved here!
602
// Yet many (all?) ladspa vst effect plugins exhibit this problem.
603
// Changed by Tim. p3.3.14
604
if ((_inports != _outports) || (f->baseName(true) == QString("dssi-vst") && !config.vstInPlace))
794
_controlOutPorts = 0;
795
for(unsigned long k = 0; k < _portCount; ++k)
797
LADSPA_PortDescriptor pd = plugin->PortDescriptors[k];
798
//_portDescriptors[k] = pd;
799
if(pd & LADSPA_PORT_AUDIO)
801
if(pd & LADSPA_PORT_INPUT)
804
if(pd & LADSPA_PORT_OUTPUT)
807
rpIdx.push_back((unsigned long)-1);
810
if(pd & LADSPA_PORT_CONTROL)
812
if(pd & LADSPA_PORT_INPUT)
814
rpIdx.push_back(_controlInPorts);
818
if(pd & LADSPA_PORT_OUTPUT)
820
rpIdx.push_back((unsigned long)-1);
826
_inPlaceCapable = !LADSPA_IS_INPLACE_BROKEN(plugin->Properties);
828
// Blacklist vst plugins in-place configurable for now.
829
if ((_inports != _outports) || (fi.baseName(true) == QString("dssi-vst") && !config.vstInPlace))
605
830
_inPlaceCapable = false;
839
fprintf(stderr, "Plugin::incReferences Error: %s no plugin!\n", fi.filePath().latin1());
843
_references = newref;
845
//QString guiPath(info.dirPath() + "/" + info.baseName());
846
//QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files);
847
//_hasGui = guiDir.exists();
611
852
//---------------------------------------------------------
613
854
//---------------------------------------------------------
615
void Plugin::range(int i, float* min, float* max) const
856
void Plugin::range(unsigned long i, float* min, float* max) const
617
858
LADSPA_PortRangeHint range = plugin->PortRangeHints[i];
618
859
LADSPA_PortRangeHintDescriptor desc = range.HintDescriptor;
686
927
//---------------------------------------------------------
688
929
static void loadPluginLib(QFileInfo* fi)
690
void* handle = dlopen(fi->filePath().ascii(), RTLD_NOW);
692
fprintf(stderr, "dlopen(%s) failed: %s\n",
693
fi->filePath().ascii(), dlerror());
696
LADSPA_Descriptor_Function ladspa = (LADSPA_Descriptor_Function)dlsym(handle, "ladspa_descriptor");
931
void* handle = dlopen(fi->filePath().ascii(), RTLD_NOW);
933
fprintf(stderr, "dlopen(%s) failed: %s\n",
934
fi->filePath().ascii(), dlerror());
699
const char *txt = dlerror();
702
"Unable to find ladspa_descriptor() function in plugin "
703
"library file \"%s\": %s.\n"
704
"Are you sure this is a LADSPA plugin file?\n",
705
fi->filePath().ascii(),
711
const LADSPA_Descriptor* descr;
712
for (int i = 0;; ++i) {
717
// Make sure it doesn't already exist.
718
if(plugins.find(fi->baseName(true), QString(descr->Label)) != 0)
721
LADSPA_Properties properties = descr->Properties;
724
for (unsigned k = 0; k < descr->PortCount; ++k) {
725
LADSPA_PortDescriptor pd = descr->PortDescriptors[k];
726
if (pd & LADSPA_PORT_CONTROL)
728
if (pd & LADSPA_PORT_INPUT)
733
bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
735
plugins.add(fi, ladspa, descr, !inPlaceBroken);
939
DSSI_Descriptor_Function dssi = (DSSI_Descriptor_Function)dlsym(handle, "dssi_descriptor");
942
const DSSI_Descriptor* descr;
943
for (int i = 0;; ++i)
949
// Listing effect plugins only while excluding synths:
950
// Do exactly what dssi-vst.cpp does for listing ladspa plugins.
951
if(!descr->run_synth &&
952
!descr->run_synth_adding &&
953
!descr->run_multiple_synths &&
954
!descr->run_multiple_synths_adding)
956
// Make sure it doesn't already exist.
957
if(plugins.find(fi->baseName(true), QString(descr->LADSPA_Plugin->Label)) != 0)
960
#ifdef PLUGIN_DEBUGIN
961
fprintf(stderr, "loadPluginLib: dssi effect name:%s inPlaceBroken:%d\n", descr->LADSPA_Plugin->Name, LADSPA_IS_INPLACE_BROKEN(descr->LADSPA_Plugin->Properties));
964
//LADSPA_Properties properties = descr->LADSPA_Plugin->Properties;
965
//bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
966
//plugins.add(fi, descr, !inPlaceBroken);
967
plugins.add(fi, descr->LADSPA_Plugin, true);
974
LADSPA_Descriptor_Function ladspa = (LADSPA_Descriptor_Function)dlsym(handle, "ladspa_descriptor");
977
const char *txt = dlerror();
981
"Unable to find ladspa_descriptor() function in plugin "
982
"library file \"%s\": %s.\n"
983
"Are you sure this is a LADSPA plugin file?\n",
984
fi->filePath().ascii(),
991
const LADSPA_Descriptor* descr;
992
for (int i = 0;; ++i)
998
// Make sure it doesn't already exist.
999
if(plugins.find(fi->baseName(true), QString(descr->Label)) != 0)
1002
#ifdef PLUGIN_DEBUGIN
1003
fprintf(stderr, "loadPluginLib: ladspa effect name:%s inPlaceBroken:%d\n", descr->Name, LADSPA_IS_INPLACE_BROKEN(descr->Properties));
1006
//LADSPA_Properties properties = descr->Properties;
1007
//bool inPlaceBroken = LADSPA_IS_INPLACE_BROKEN(properties);
1008
//plugins.add(fi, ladspa, descr, !inPlaceBroken);
1009
plugins.add(fi, descr);
739
1016
//---------------------------------------------------------
740
1017
// loadPluginDir
1200
1630
bool PluginI::initPluginInstance(Plugin* plug, int c)
1204
printf("initPluginInstance: zero plugin\n");
1635
printf("initPluginInstance: zero plugin\n");
1207
1638
_plugin = plug;
1208
1640
_plugin->incReferences(1);
1643
_oscif.oscSetPluginI(this);
1210
1646
QString inst("-" + QString::number(_plugin->instNo()));
1211
1647
_name = _plugin->name() + inst;
1212
1648
_label = _plugin->label() + inst;
1214
instances = channel/plug->outports();
1650
//instances = channel/plug->outports();
1651
// p3.3.41 Some plugins have zero out ports, causing exception with the above line.
1652
// Also, pick the least number of ins or outs, and base the number of instances on that.
1653
unsigned long ins = plug->inports();
1654
unsigned long outs = plug->outports();
1656
unsigned long minports = ~0ul;
1657
if(outs && outs < minports)
1659
if(ins && ins < minports)
1661
if(minports == ~0ul)
1663
instances = channel / minports;
1669
instances = channel / outs;
1676
instances = channel / ins;
1217
1683
handle = new LADSPA_Handle[instances];
1218
for (int i = 0; i < instances; ++i) {
1219
handle[i] = _plugin->instantiate();
1684
for(int i = 0; i < instances; ++i)
1686
#ifdef PLUGIN_DEBUGIN
1687
fprintf(stderr, "PluginI::initPluginInstance instance:%d\n", i);
1690
handle[i] = _plugin->instantiate();
1691
//if (handle[i] == 0)
1692
if(handle[i] == NULL)
1696
unsigned long ports = _plugin->ports();
1224
1698
controlPorts = 0;
1225
int ports = _plugin->ports();
1227
for (int k = 0; k < ports; ++k) {
1228
LADSPA_PortDescriptor pd = _plugin->portd(k);
1229
if (pd & LADSPA_PORT_CONTROL)
1232
controls = new Port[controlPorts];
1234
for (int k = 0; k < ports; ++k) {
1235
LADSPA_PortDescriptor pd = _plugin->portd(k);
1236
if (pd & LADSPA_PORT_CONTROL) {
1237
double val = _plugin->defaultValue(k);
1238
controls[i].val = val;
1239
controls[i].tmpVal = val;
1240
controls[i].enCtrl = true;
1241
controls[i].en2Ctrl = true;
1246
for (int k = 0; k < ports; ++k) {
1247
LADSPA_PortDescriptor pd = _plugin->portd(k);
1248
if (pd & LADSPA_PORT_CONTROL) {
1249
for (int i = 0; i < instances; ++i)
1250
_plugin->connectPort(handle[i], k, &controls[curPort].val);
1251
controls[curPort].idx = k;
1699
controlOutPorts = 0;
1701
for(unsigned long k = 0; k < ports; ++k)
1703
LADSPA_PortDescriptor pd = _plugin->portd(k);
1704
if(pd & LADSPA_PORT_CONTROL)
1706
if(pd & LADSPA_PORT_INPUT)
1709
if(pd & LADSPA_PORT_OUTPUT)
1714
controls = new Port[controlPorts];
1715
controlsOut = new Port[controlOutPorts];
1719
for(unsigned long k = 0; k < ports; ++k)
1721
LADSPA_PortDescriptor pd = _plugin->portd(k);
1722
if(pd & LADSPA_PORT_CONTROL)
1724
if(pd & LADSPA_PORT_INPUT)
1726
double val = _plugin->defaultValue(k);
1727
controls[i].val = val;
1728
controls[i].tmpVal = val;
1729
controls[i].enCtrl = true;
1730
controls[i].en2Ctrl = true;
1734
if(pd & LADSPA_PORT_OUTPUT)
1736
//double val = _plugin->defaultValue(k);
1737
controlsOut[ii].val = 0.0;
1738
controlsOut[ii].tmpVal = 0.0;
1739
controlsOut[ii].enCtrl = false;
1740
controlsOut[ii].en2Ctrl = false;
1745
unsigned long curPort = 0;
1746
unsigned long curOutPort = 0;
1747
for(unsigned long k = 0; k < ports; ++k)
1749
LADSPA_PortDescriptor pd = _plugin->portd(k);
1750
if(pd & LADSPA_PORT_CONTROL)
1752
if(pd & LADSPA_PORT_INPUT)
1754
for(int i = 0; i < instances; ++i)
1755
_plugin->connectPort(handle[i], k, &controls[curPort].val);
1756
controls[curPort].idx = k;
1760
if(pd & LADSPA_PORT_OUTPUT)
1762
for(int i = 0; i < instances; ++i)
1763
_plugin->connectPort(handle[i], k, &controlsOut[curOutPort].val);
1764
controlsOut[curOutPort].idx = k;
1548
2166
//---------------------------------------------------------
1550
2168
void PluginI::apply(int n)
1552
if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1)
1554
for(int i = 0; i < controlPorts; ++i)
1556
if( controls[i].enCtrl && controls[i].en2Ctrl )
1557
controls[i].tmpVal = _track->pluginCtrlVal(genACnum(_id, i));
1561
for (int i = 0; i < controlPorts; ++i)
1562
controls[i].val = controls[i].tmpVal;
2170
// Process control value changes.
2171
//if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1)
2173
// for(int i = 0; i < controlPorts; ++i)
2175
// if( controls[i].enCtrl && controls[i].en2Ctrl )
2176
// controls[i].tmpVal = _track->pluginCtrlVal(genACnum(_id, i));
2180
unsigned long ctls = controlPorts;
2181
for(unsigned long k = 0; k < ctls; ++k)
2183
// First, update the temporary value if needed...
2186
// Process OSC gui input control fifo events.
2187
// It is probably more important that these are processed so that they take precedence over all other
2188
// events because OSC + DSSI/DSSI-VST are fussy about receiving feedback via these control ports, from GUI changes.
2190
OscControlFifo* cfifo = _oscif.oscFifo(k);
2194
// If there are 'events' in the fifo, get exactly one 'event' per control per process cycle...
2195
//if(!cfifo->isEmpty())
2196
if(cfifo && !cfifo->isEmpty())
2198
OscControlValue v = cfifo->get();
2200
#ifdef PLUGIN_DEBUGIN
2201
fprintf(stderr, "PluginI::apply OscControlFifo event input control number:%ld value:%f\n", k, v.value);
2204
// Set the ladspa control port value.
2205
controls[k].tmpVal = v.value;
2207
// Need to update the automation value, otherwise it overwrites later with the last automation value.
2208
if(_track && _id != -1)
2210
// Since we are now in the audio thread context, there's no need to send a message,
2211
// just modify directly.
2212
//audio->msgSetPluginCtrlVal(this, genACnum(_id, k), controls[k].val);
2214
//audio->msgSetPluginCtrlVal(_track, genACnum(_id, k), controls[k].val);
2215
_track->setPluginCtrlVal(genACnum(_id, k), v.value);
2217
// Record automation.
2218
// NO! Take care of this immediately in the OSC control handler, because we don't want
2219
// the silly delay associated with processing the fifo one-at-a-time here.
2221
//AutomationType at = _track->automationType();
2222
// TODO: Taken from our native gui control handlers.
2223
// This may need modification or may cause problems -
2224
// we don't have the luxury of access to the dssi gui controls !
2225
//if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
2226
// enableController(k, false);
2227
//_track->recordAutomation(id, v.value);
2231
#endif // OSC_SUPPORT
2233
// Process automation control value.
2234
if(automation && _track && _track->automationType() != AUTO_OFF && _id != -1)
2236
if(controls[k].enCtrl && controls[k].en2Ctrl )
2237
controls[k].tmpVal = _track->pluginCtrlVal(genACnum(_id, k));
2241
// Now update the actual value from the temporary value...
2242
controls[k].val = controls[k].tmpVal;
2245
//for (int i = 0; i < controlPorts; ++i)
2246
// controls[i].val = controls[i].tmpVal;
1563
2248
for (int i = 0; i < instances; ++i)
2251
//fprintf(stderr, "PluginI::apply handle %d\n", i);
1564
2252
_plugin->apply(handle[i], n);
2256
//---------------------------------------------------------
2258
//---------------------------------------------------------
2261
int Plugin::oscConfigure(LADSPA_Handle handle, const char* key, const char* value)
2263
#ifdef PLUGIN_DEBUGIN
2264
printf("Plugin::oscConfigure effect plugin label:%s key:%s value:%s\n", plugin->Label, key, value);
2268
if(!dssi_descr || !dssi_descr->configure)
2271
if (!strncmp(key, DSSI_RESERVED_CONFIGURE_PREFIX,
2272
strlen(DSSI_RESERVED_CONFIGURE_PREFIX))) {
2273
fprintf(stderr, "Plugin::oscConfigure OSC: UI for plugin '%s' attempted to use reserved configure key \"%s\", ignoring\n",
2274
plugin->Label, key);
2279
char* message = dssi_descr->configure(handle, key, value);
2281
printf("Plugin::oscConfigure on configure '%s' '%s', plugin '%s' returned error '%s'\n",
2282
//key, value, synti->name().toAscii().data(), message);
2283
key, value, plugin->Label, message);
2288
// also call back on UIs for plugins other than the one
2289
// that requested this:
2290
// if (n != instance->number && instances[n].uiTarget) {
2291
// lo_send(instances[n].uiTarget,
2292
// instances[n].ui_osc_configure_path, "ss", key, value);
2295
// configure invalidates bank and program information, so
2296
// we should do this again now:
2299
#endif // DSSI_SUPPORT
2304
//---------------------------------------------------------
2306
//---------------------------------------------------------
2308
int PluginI::oscConfigure(const char *key, const char *value)
2313
// This is pretty much the simplest legal implementation of
2314
// configure in a DSSI host.
2316
// The host has the option to remember the set of (key,value)
2317
// pairs associated with a particular instance, so that if it
2318
// wants to restore the "same" instance on another occasion it can
2319
// just call configure() on it for each of those pairs and so
2320
// restore state without any input from a GUI. Any real-world GUI
2321
// host will probably want to do that. This host doesn't have any
2322
// concept of restoring an instance from one run to the next, so
2323
// we don't bother remembering these at all.
2325
//const char *key = (const char *)&argv[0]->s;
2326
//const char *value = (const char *)&argv[1]->s;
2328
#ifdef PLUGIN_DEBUGIN
2329
printf("PluginI::oscConfigure effect plugin name:%s label:%s key:%s value:%s\n", _name.latin1(), _label.latin1(), key, value);
2333
// FIXME: Don't think this is right, should probably do as example shows below.
2334
for(int i = 0; i < instances; ++i)
2335
_plugin->oscConfigure(handle[i], key, value);
2337
// also call back on UIs for plugins other than the one
2338
// that requested this:
2339
// if (n != instance->number && instances[n].uiTarget) {
2340
// lo_send(instances[n].uiTarget,
2341
// instances[n].ui_osc_configure_path, "ss", key, value);
2344
// configure invalidates bank and program information, so
2345
// we should do this again now:
2347
#endif // DSSI_SUPPORT
2352
//---------------------------------------------------------
2354
//---------------------------------------------------------
2356
int PluginI::oscUpdate()
2359
// Send project directory.
2360
_oscif.oscSendConfigure(DSSI_PROJECT_DIRECTORY_KEY, museProject.latin1()); // song->projectPath()
2364
// Send current string configuration parameters.
2365
StringParamMap& map = synti->stringParameters();
2367
for(ciStringParamMap r = map.begin(); r != map.end(); ++r)
2369
_oscIF.oscSendConfigure(r->first.c_str(), r->second.c_str());
2370
// Avoid overloading the GUI if there are lots and lots of params.
2376
// Send current bank and program.
2377
unsigned long bank, prog;
2378
synti->currentProg(&prog, &bank, 0);
2379
_oscIF.oscSendProgram(prog, bank);
2381
// Send current control values.
2382
unsigned long ports = synth->_controlInPorts;
2383
for(unsigned long i = 0; i < ports; ++i)
2385
unsigned long k = synth->pIdx(i);
2386
_oscIF.oscSendControl(k, controls[i]);
2387
// Avoid overloading the GUI if there are lots and lots of ports.
2397
//---------------------------------------------------------
2399
//---------------------------------------------------------
2401
int PluginI::oscControl(unsigned long port, float value)
2403
//int port = argv[0]->i;
2404
//LADSPA_Data value = argv[1]->f;
2406
#ifdef PLUGIN_DEBUGIN
2407
printf("PluginI::oscControl received oscControl port:%ld val:%f\n", port, value);
2410
//int controlPorts = synth->_controller;
2412
//if(port >= controlPorts)
2413
//if(port < 0 || port >= _plugin->rpIdx.size())
2415
//fprintf(stderr, "DssiSynthIF::oscControl: port number:%d is out of range of number of ports:%d\n", port, controlPorts);
2416
// fprintf(stderr, "PluginI::oscControl: port number:%d is out of range of index list size:%d\n", port, _plugin->rpIdx.size());
2420
// Convert from DSSI port number to control input port index.
2421
//unsigned long cport = _plugin->rpIdx[port];
2422
unsigned long cport = _plugin->port2InCtrl(port);
2424
if((int)cport == -1)
2426
fprintf(stderr, "PluginI::oscControl: port number:%ld is not a control input\n", port);
2430
// (From DSSI module).
2431
// p3.3.39 Set the DSSI control input port's value.
2432
// Observations: With a native DSSI synth like LessTrivialSynth, the native GUI's controls do not change the sound at all
2433
// ie. they don't update the DSSI control port values themselves.
2434
// Hence in response to the call to this oscControl, sent by the native GUI, it is required to that here.
2435
/// controls[cport].val = value;
2436
// DSSI-VST synths however, unlike DSSI synths, DO change their OWN sound in response to their gui controls.
2437
// AND this function is called !
2438
// Despite the descrepency we are STILL required to update the DSSI control port values here
2439
// because dssi-vst is WAITING FOR A RESPONSE! (A CHANGE in the control port value).
2440
// It will output something like "...4 events expected..." and count that number down as 4 actual control port value CHANGES
2441
// are done here in response. Normally it says "...0 events expected..." when MusE is the one doing the DSSI control changes.
2442
// TODO: May need FIFOs on each control(!) so that the control changes get sent one per process cycle!
2443
// Observed countdown not actually going to zero upon string of changes.
2445
OscControlFifo* cfifo = _oscif.oscFifo(cport);
2453
fprintf(stderr, "PluginI::oscControl: fifo overflow: in control number:%ld\n", cport);
2457
// Record automation:
2458
// Take care of this immediately, because we don't want the silly delay associated with
2459
// processing the fifo one-at-a-time in the apply().
2460
// NOTE: Ahh crap! We don't receive control events until the user RELEASES a control !
2461
// So the events all arrive at once when the user releases a control.
2462
// That makes this pretty useless... But what the heck...
2463
if(_track && _id != -1)
2465
int id = genACnum(_id, cport);
2466
AutomationType at = _track->automationType();
2468
// TODO: Taken from our native gui control handlers.
2469
// This may need modification or may cause problems -
2470
// we don't have the luxury of access to the dssi gui controls !
2471
if(at == AUTO_WRITE || (audio->isPlaying() && at == AUTO_TOUCH))
2472
enableController(cport, false);
2474
_track->recordAutomation(id, value);
2478
const DSSI_Descriptor* dssi = synth->dssi;
2479
const LADSPA_Descriptor* ld = dssi->LADSPA_Plugin;
2481
ciMidiCtl2LadspaPort ip = synth->port2MidiCtlMap.find(cport);
2482
if(ip != synth->port2MidiCtlMap.end())
2484
// TODO: TODO: Update midi MusE's midi controller knobs, sliders, boxes etc with a call to the midi port's setHwCtrlState() etc.
2485
// But first we need a ladspa2MidiValue() function! ...
2488
//float val = ladspa2MidiValue(ld, i, ?, ?);
2494
int port = argv[0]->i;
2495
LADSPA_Data value = argv[1]->f;
2497
if (port < 0 || port > instance->plugin->descriptor->LADSPA_Plugin->PortCount) {
2498
fprintf(stderr, "MusE: OSC: %s port number (%d) is out of range\n",
2499
instance->friendly_name, port);
2502
if (instance->pluginPortControlInNumbers[port] == -1) {
2503
fprintf(stderr, "MusE: OSC: %s port %d is not a control in\n",
2504
instance->friendly_name, port);
2507
pluginControlIns[instance->pluginPortControlInNumbers[port]] = value;
2509
printf("MusE: OSC: %s port %d = %f\n",
2510
instance->friendly_name, port, value);
2516
#endif // OSC_SUPPORT
1567
2519
//---------------------------------------------------------
1568
2520
// PluginDialog
1692
2644
//---------------------------------------------------------
1694
2646
void PluginDialog::fillPlugs(int nbr)
1697
for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) {
1702
for (int k = 0; k < i->ports(); ++k) {
1703
LADSPA_PortDescriptor pd = i->portd(k);
1704
if (pd & LADSPA_PORT_CONTROL) {
1705
if (pd & LADSPA_PORT_INPUT)
1711
if (pd & LADSPA_PORT_INPUT)
2649
for(iPlugin i = plugins.begin(); i != plugins.end(); ++i)
2656
for(unsigned long k = 0; k < i->ports(); ++k)
2658
LADSPA_PortDescriptor pd = i->portd(k);
2659
if(pd & LADSPA_PORT_CONTROL)
2661
if(pd & LADSPA_PORT_INPUT)
2664
if(pd & LADSPA_PORT_OUTPUT)
2668
if(pd & LADSPA_PORT_AUDIO)
2670
if(pd & LADSPA_PORT_INPUT)
2673
if(pd & LADSPA_PORT_OUTPUT)
2678
int ai = i->inports();
2679
int ao = i->outports();
2680
int ci = i->controlInPorts();
2681
int co = i->controlOutPorts();
1718
bool addFlag = false;
1721
case 0: // stereo & mono
1722
if ((ai == 1 || ai == 2) && (ao == 1 || ao ==2))
1728
if ((ai == 1 || ai == 2) && ao ==2)
1734
if (ai == 1 && ao == 1)
1745
QListViewItem* item = new QListViewItem(pList,
1749
QString().setNum(ai),
1750
QString().setNum(ao),
1751
QString().setNum(ci),
1752
QString().setNum(co),
1753
QString().setNum(i->inPlaceCapable())
1755
item->setText(8, QString().setNum(i->id()));
1756
item->setText(9, i->maker());
1757
item->setText(10, i->copyright());
1760
selectedPlugType = nbr;
2683
bool addFlag = false;
2686
case 0: // stereo & mono
2687
if ((ai == 1 || ai == 2) && (ao == 1 || ao ==2))
2693
if ((ai == 1 || ai == 2) && ao ==2)
2699
if (ai == 1 && ao == 1)
2710
QListViewItem* item = new QListViewItem(pList,
2714
QString().setNum(ai),
2715
QString().setNum(ao),
2716
QString().setNum(ci),
2717
QString().setNum(co),
2718
QString().setNum(i->inPlaceCapable())
2720
item->setText(8, QString().setNum(i->id()));
2721
item->setText(9, i->maker());
2722
item->setText(10, i->copyright());
2725
selectedPlugType = nbr;
1763
2728
void PluginDialog::fillPlugs(const QString &sortValue)
1766
for (iPlugin i = plugins.begin(); i != plugins.end(); ++i) {
1771
for (int k = 0; k < i->ports(); ++k) {
1772
LADSPA_PortDescriptor pd = i->portd(k);
1773
if (pd & LADSPA_PORT_CONTROL) {
1774
if (pd & LADSPA_PORT_INPUT)
1780
if (pd & LADSPA_PORT_INPUT)
1787
bool addFlag = false;
1789
if (i->label().lower().contains(sortValue.lower()))
1791
else if (i->name().lower().contains(sortValue.lower()))
1795
QListViewItem* item = new QListViewItem(pList,
1799
QString().setNum(ai),
1800
QString().setNum(ao),
1801
QString().setNum(ci),
1802
QString().setNum(co),
1803
QString().setNum(i->inPlaceCapable())
1805
item->setText(8, QString().setNum(i->id()));
1806
item->setText(9, i->maker());
1807
item->setText(10, i->copyright());
2731
for(iPlugin i = plugins.begin(); i != plugins.end(); ++i)
2738
for(unsigned long k = 0; k < i->ports(); ++k)
2740
LADSPA_PortDescriptor pd = i->portd(k);
2741
if(pd & LADSPA_PORT_CONTROL)
2743
if(pd & LADSPA_PORT_INPUT)
2746
if(pd & LADSPA_PORT_OUTPUT)
2750
if(pd & LADSPA_PORT_AUDIO)
2752
if(pd & LADSPA_PORT_INPUT)
2755
if(pd & LADSPA_PORT_OUTPUT)
2760
int ai = i->inports();
2761
int ao = i->outports();
2762
int ci = i->controlInPorts();
2763
int co = i->controlOutPorts();
2765
bool addFlag = false;
2767
if(i->label().lower().contains(sortValue.lower()))
2770
if(i->name().lower().contains(sortValue.lower()))
2774
QListViewItem* item = new QListViewItem(pList,
2778
QString().setNum(ai),
2779
QString().setNum(ao),
2780
QString().setNum(ci),
2781
QString().setNum(co),
2782
QString().setNum(i->inPlaceCapable())
2784
item->setText(8, QString().setNum(i->id()));
2785
item->setText(9, i->maker());
2786
item->setText(10, i->copyright());
1812
2791
//---------------------------------------------------------