diff options
-rw-r--r-- | muse2/ChangeLog | 2 | ||||
-rw-r--r-- | muse2/muse/dssihost.cpp | 1 | ||||
-rw-r--r-- | muse2/muse/dssihost.h | 1 | ||||
-rw-r--r-- | muse2/muse/osc.cpp | 21 | ||||
-rw-r--r-- | muse2/muse/plugin.cpp | 64 | ||||
-rw-r--r-- | muse2/muse/plugin.h | 3 | ||||
-rw-r--r-- | muse2/muse/synth.h | 1 |
7 files changed, 71 insertions, 22 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 2d42c0d0..60efd357 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,5 @@ +1.04.2011: + - Fixed custom LADSPA DSSI GUI support. Tested OK with FLAM. Thanks to Luis Garrido for help. (Tim) 31.03.2011: * Feature: Support for custom LADSPA DSSI GUIs, such as those generated by FLAM. (p4.0.19 Tim) - Initial support. TODO: Refine how a particular UI file is chosen - uses first one found for now. diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp index 2f434972..ca867bd4 100644 --- a/muse2/muse/dssihost.cpp +++ b/muse2/muse/dssihost.cpp @@ -2969,6 +2969,7 @@ QString DssiSynthIF::pluginLabel() const { return (synth && QString DssiSynthIF::name() const { return synti->name(); } QString DssiSynthIF::lib() const { return synth ? synth->completeBaseName() : QString(); } QString DssiSynthIF::dirPath() const { return synth ? synth->absolutePath() : QString(); } +QString DssiSynthIF::fileName() const { return synth ? synth->fileName() : QString(); } AudioTrack* DssiSynthIF::track() { return (AudioTrack*)synti; } void DssiSynthIF::enableController(int i, bool v) { controls[i].enCtrl = v; } bool DssiSynthIF::controllerEnabled(int i) const { return controls[i].enCtrl; } diff --git a/muse2/muse/dssihost.h b/muse2/muse/dssihost.h index eab561a5..a8607ce0 100644 --- a/muse2/muse/dssihost.h +++ b/muse2/muse/dssihost.h @@ -235,6 +235,7 @@ class DssiSynthIF : public SynthIF, public PluginIBase QString name() const; QString lib() const; QString dirPath() const; + QString fileName() const; AudioTrack* track(); void enableController(int /*i*/, bool v = true); bool controllerEnabled(int /*i*/) const; diff --git a/muse2/muse/osc.cpp b/muse2/muse/osc.cpp index 8bfdfd68..8b125a6c 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -934,6 +934,23 @@ bool OscIF::oscInitGui(const QString& typ, const QString& baseName, const QStrin << name << QString("channel-1"); + /* + fprintf(stderr, "OscIF::oscInitGui %s %s %s %s\n", + //fi.filePath().toAscii().data(), + //fi.fileName().toAscii().data(), + guiPath.toLatin1().constData(), + //fi.fileName().ascii(), + + oscUrl.toLatin1().constData(), + + //synth->info.filePath().ascii(), + filePath.toLatin1().constData(), + + //name().toAscii().data(), + //synth->name().ascii()); + name.toLatin1().constData()); + */ + /* Leave out Qt3 stuff for reference - Orcan: // Don't forget this, he he... _oscGuiQProc->clearArguments(); @@ -1279,7 +1296,7 @@ bool OscDssiIF::oscInitGui() return OscIF::oscInitGui(QT_TRANSLATE_NOOP("@default", "dssi_synth"), _oscSynthIF->dssiSynth()->baseName(), _oscSynthIF->dssiSynth()->name(), _oscSynthIF->dssiSynthI()->name(), //_oscSynthIF->dssiSynth()->filePath(), _oscSynthIF->dssiSynth()->path()); - _oscSynthIF->dssiSynth()->filePath(), _oscSynthIF->dssi_ui_filename()); // p4.0.19 + _oscSynthIF->dssiSynth()->fileName(), _oscSynthIF->dssi_ui_filename()); // p4.0.19 } #endif // DSSI_SUPPORT @@ -1366,7 +1383,7 @@ bool OscEffectIF::oscInitGui() return OscIF::oscInitGui(QT_TRANSLATE_NOOP("@default", "ladspa_efx"), _oscPluginI->plugin()->lib(false), _oscPluginI->plugin()->label(), _oscPluginI->label(), //_oscPluginI->plugin()->filePath(), _oscPluginI->plugin()->dirPath(false)); - _oscPluginI->plugin()->filePath(), _oscPluginI->dssi_ui_filename()); // p4.0.19 + _oscPluginI->plugin()->fileName(), _oscPluginI->dssi_ui_filename()); // p4.0.19 } diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index 88f73784..7866bd39 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -1466,14 +1466,13 @@ void Pipeline::apply(int ports, unsigned long nframes, float** buffer1) QString PluginIBase::dssi_ui_filename() const { - //QString guiPath(info.path() + "/" + info.baseName()); - //QString guiPath(synth->info.dirPath() + "/" + synth->info.baseName()); - if(dirPath().isEmpty() || lib().isEmpty()) + QString libr(lib()); + if(dirPath().isEmpty() || libr.isEmpty()) return QString(); - QString guiPath(dirPath() + "/" + lib()); + QString guiPath(dirPath() + "/" + libr); - //fprintf(stderr, "PluginIBase::dssi_ui_filename :%s\n", guiPath.toLatin1().constData()); + //fprintf(stderr, "PluginIBase::dssi_ui_filename guiPath:%s\n", guiPath.toLatin1().constData()); QDir guiDir(guiPath, "*", QDir::Unsorted, QDir::Files); if(!guiDir.exists()) @@ -1481,33 +1480,58 @@ QString PluginIBase::dssi_ui_filename() const QStringList list = guiDir.entryList(); + QString plug(pluginLabel()); + QString lib_qt_ui; + QString lib_any_ui; + QString plug_qt_ui; + QString plug_any_ui; + for(int i = 0; i < list.count(); ++i) { QFileInfo fi(guiPath + QString("/") + list[i]); QString gui(fi.filePath()); - if (gui.contains('_') == 0) - continue; struct stat buf; - if(stat(gui.toLatin1().constData(), &buf)) - { - - //perror("stat failed"); - //fprintf(stderr, "PluginIBase::dssi_ui_filename stat failed\n"); continue; - } - - if (!((S_ISREG(buf.st_mode) || S_ISLNK(buf.st_mode)) && + if(!((S_ISREG(buf.st_mode) || S_ISLNK(buf.st_mode)) && (buf.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))) - { - //perror("stat failed"); - //fprintf(stderr, "PluginIBase::dssi_ui_filename File stat mode is wrong\n"); continue; - } - return gui; + // FIXME: Qt::CaseInsensitive - a quick and dirty way to accept any suffix. Should be case sensitive... + if(!libr.isEmpty()) + { + if(lib_qt_ui.isEmpty() && list[i].contains(libr + QString("_qt"), Qt::CaseInsensitive)) + lib_qt_ui = gui; + if(lib_any_ui.isEmpty() && list[i].contains(libr + QString('_') /*, Qt::CaseInsensitive*/)) + lib_any_ui = gui; + } + if(!plug.isEmpty()) + { + if(plug_qt_ui.isEmpty() && list[i].contains(plug + QString("_qt"), Qt::CaseInsensitive)) + plug_qt_ui = gui; + if(plug_any_ui.isEmpty() && list[i].contains(plug + QString('_') /*, Qt::CaseInsensitive*/)) + plug_any_ui = gui; + } } + //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; + // Prefer any plugin ui + if(!plug_any_ui.isEmpty()) + return plug_any_ui; + // Prefer qt lib ui + if(!lib_qt_ui.isEmpty()) + return lib_qt_ui; + // Prefer any lib ui + if(!lib_any_ui.isEmpty()) + return lib_any_ui; + + // No suitable UI file found return QString(); }; diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index 8f31e573..f138737c 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -106,6 +106,7 @@ class Plugin { QString lib(bool complete = true) /*const*/ { return complete ? fi.completeBaseName() : fi.baseName(); } // ddskrjo const QString dirPath(bool complete = true) const { return complete ? fi.absolutePath() : fi.path(); } QString filePath() const { return fi.filePath(); } + QString fileName() const { return fi.fileName(); } int references() const { return _references; } int incReferences(int); int instNo() { return _instNo++; } @@ -290,6 +291,7 @@ class PluginIBase virtual QString name() const = 0; virtual QString lib() const = 0; virtual QString dirPath() const = 0; + virtual QString fileName() const = 0; virtual AudioTrack* track() = 0; @@ -434,6 +436,7 @@ class PluginI : public PluginIBase { CtrlValueType valueType() const; QString lib() const { return _plugin->lib(); } QString dirPath() const { return _plugin->dirPath(); } + QString fileName() const { return _plugin->fileName(); } #ifdef OSC_SUPPORT OscEffectIF& oscIF() { return _oscif; } diff --git a/muse2/muse/synth.h b/muse2/muse/synth.h index 648a42f8..f7d5d193 100644 --- a/muse2/muse/synth.h +++ b/muse2/muse/synth.h @@ -63,6 +63,7 @@ class Synth { QString absolutePath() const { return info.absolutePath(); } QString path() const { return info.path(); } QString filePath() const { return info.filePath(); } + QString fileName() const { return info.fileName(); } QString description() const { return _description; } QString version() const { return _version; } //QString maker() const { return _version; } ?? |