Allow sub plugins for instruments aswell

* Move m_key member of Effect into Plugin
* Pass key to Instrument ctors and instantiaters
* Add pluginKeys to all plugin selector widgets, and let them pass the keys
  when instantiating the instruments; or, if the keys must be passed over
  threads, pass the keys to the Engine using `Engine::setDndPluginKey()`
* As instrument plugin libraries now also need to get their key passed, their
  second argument, which was always the same as the first, is now used to pass
  the sub plugin keys. This affects *all* instrument plugins.
* Plugin.h: Add more virtuals to `SubPluginFeatures` in order to draw logos
  and images into instrument selector widgets
* LadspaSubPluginFeatures: Implement the `displayName` virtual because the
  new behaviour to resolve displayNames is to first look at the
  SubPluginFeatures, which, without override, returns the superior plugin's
  name (Plugin.cpp)

Additional:

* PluginFactory.h: Allow setting up search paths without discovering plugins
  yet
* Plugin.h: Add full documentation (should be checked)
This commit is contained in:
Johannes Lorenz
2018-12-27 18:43:13 +01:00
parent 05128b9a33
commit a1b355828e
47 changed files with 612 additions and 245 deletions

View File

@@ -728,10 +728,10 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new FreeBoyInstrument(
static_cast<InstrumentTrack *>( _data ) ) );
static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -1390,9 +1390,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return new GigInstrument( static_cast<InstrumentTrack *>( _data ) );
return new GigInstrument( static_cast<InstrumentTrack *>( m ) );
}
}

View File

@@ -44,6 +44,16 @@ LadspaSubPluginFeatures::LadspaSubPluginFeatures( Plugin::PluginTypes _type ) :
const char *LadspaSubPluginFeatures::displayName(const Plugin::Descriptor::SubPluginFeatures::Key &k) const
{
const ladspa_key_t & lkey = subPluginKeyToLadspaKey(&k);
Ladspa2LMMS * lm = Engine::getLADSPAManager();
return lm->getName(lkey).toUtf8().data();
}
void LadspaSubPluginFeatures::fillDescriptionWidget( QWidget * _parent,
const Key * _key ) const
{

View File

@@ -25,8 +25,8 @@
*
*/
#ifndef _LADSPA_SUBPLUGIN_FEATURES_H
#define _LADSPA_SUBPLUGIN_FEATURES_H
#ifndef LADSPA_SUBPLUGIN_FEATURES_H
#define LADSPA_SUBPLUGIN_FEATURES_H
#include "LadspaManager.h"
#include "Plugin.h"
@@ -37,11 +37,13 @@ class LadspaSubPluginFeatures : public Plugin::Descriptor::SubPluginFeatures
public:
LadspaSubPluginFeatures( Plugin::PluginTypes _type );
virtual void fillDescriptionWidget( QWidget * _parent,
const Key * _key ) const;
const char* displayName(const Key& k) const override;
void fillDescriptionWidget( QWidget * _parent,
const Key * _key ) const override;
virtual void listSubPluginKeys( const Plugin::Descriptor * _desc,
KeyList & _kl ) const;
KeyList & _kl ) const override;
static ladspa_key_t subPluginKeyToLadspaKey( const Key * _key );

View File

@@ -79,9 +79,9 @@ Plugin::Descriptor PLUGIN_EXPORT opulenz_plugin_descriptor =
};
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new OpulenzInstrument( static_cast<InstrumentTrack *>( _data ) ) );
return( new OpulenzInstrument( static_cast<InstrumentTrack *>( m ) ) );
}
}

View File

@@ -877,8 +877,8 @@ void XpressiveView::helpClicked() {
extern "C" {
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main(Model *, void * _data) {
return (new Xpressive(static_cast<InstrumentTrack *>(_data)));
PLUGIN_EXPORT Plugin * lmms_plugin_main(Model *m, void *) {
return (new Xpressive(static_cast<InstrumentTrack *>(m)));
}
}

View File

@@ -1277,10 +1277,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main(Model * model, void *)
{
return new audioFileProcessor(
static_cast<InstrumentTrack *>( _data ) );
return new audioFileProcessor(static_cast<InstrumentTrack *>(model));
}

View File

@@ -584,9 +584,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new bitInvader( static_cast<InstrumentTrack *>( _data ) ) );
return( new bitInvader( static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -43,9 +43,9 @@ Plugin::Descriptor PLUGIN_EXPORT carlapatchbay_plugin_descriptor =
NULL
} ;
PLUGIN_EXPORT Plugin* lmms_plugin_main(Model*, void* data)
PLUGIN_EXPORT Plugin* lmms_plugin_main(Model* m, void*)
{
return new CarlaInstrument(static_cast<InstrumentTrack*>(data), &carlapatchbay_plugin_descriptor, true);
return new CarlaInstrument(static_cast<InstrumentTrack*>(m), &carlapatchbay_plugin_descriptor, true);
}
}

View File

@@ -43,9 +43,9 @@ Plugin::Descriptor PLUGIN_EXPORT carlarack_plugin_descriptor =
NULL
} ;
PLUGIN_EXPORT Plugin* lmms_plugin_main(Model*, void* data)
PLUGIN_EXPORT Plugin* lmms_plugin_main(Model* m, void*)
{
return new CarlaInstrument(static_cast<InstrumentTrack*>(data), &carlarack_plugin_descriptor, false);
return new CarlaInstrument(static_cast<InstrumentTrack*>(m), &carlarack_plugin_descriptor, false);
}
}

View File

@@ -367,9 +367,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * m, void * )
{
return new kickerInstrument( static_cast<InstrumentTrack *>( _data ) );
return new kickerInstrument( static_cast<InstrumentTrack *>( m ) );
}

View File

@@ -1029,11 +1029,11 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * m, void * )
{
return( new lb302Synth(
static_cast<InstrumentTrack *>( _data ) ) );
static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -1828,9 +1828,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return new MonstroInstrument( static_cast<InstrumentTrack *>( _data ) );
return new MonstroInstrument( static_cast<InstrumentTrack *>( m ) );
}

View File

@@ -918,9 +918,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * _data )
{
return( new NesInstrument( static_cast<InstrumentTrack *>( _data ) ) );
return( new NesInstrument( static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -636,9 +636,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new organicInstrument( static_cast<InstrumentTrack *>( _data ) ) );
return( new organicInstrument( static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -66,9 +66,9 @@ Plugin::Descriptor PLUGIN_EXPORT patman_plugin_descriptor =
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return new patmanInstrument( static_cast<InstrumentTrack *>( _data ) );
return new patmanInstrument( static_cast<InstrumentTrack *>( m ) );
}
}

View File

@@ -1150,9 +1150,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return new sf2Instrument( static_cast<InstrumentTrack *>( _data ) );
return new sf2Instrument( static_cast<InstrumentTrack *>( m ) );
}

View File

@@ -1122,9 +1122,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model*, void* data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* m, void* )
{
return new sfxrInstrument( static_cast<InstrumentTrack *>( data ) );
return new sfxrInstrument( static_cast<InstrumentTrack *>( m ) );
}

View File

@@ -792,10 +792,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new sidInstrument(
static_cast<InstrumentTrack *>( _data ) ) );
return( new sidInstrument( static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -756,9 +756,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model * m, void * )
{
return new malletsInstrument( static_cast<InstrumentTrack *>( _data ) );
return new malletsInstrument( static_cast<InstrumentTrack *>( m ) );
}

View File

@@ -723,9 +723,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model* model, void * )
{
return new TripleOscillator( static_cast<InstrumentTrack *>( _data ) );
return new TripleOscillator( static_cast<InstrumentTrack *>( model ) );
}
}

View File

@@ -1167,9 +1167,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
Q_DECL_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
Q_DECL_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return new vestigeInstrument( static_cast<InstrumentTrack *>( _data ) );
return new vestigeInstrument( static_cast<InstrumentTrack *>( m ) );
}

View File

@@ -682,9 +682,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new vibed( static_cast<InstrumentTrack *>( _data ) ) );
return( new vibed( static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -1279,9 +1279,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *m, void * )
{
return( new WatsynInstrument( static_cast<InstrumentTrack *>( _data ) ) );
return( new WatsynInstrument( static_cast<InstrumentTrack *>( m ) ) );
}

View File

@@ -652,10 +652,9 @@ extern "C"
{
// necessary for getting instance out of shared lib
PLUGIN_EXPORT Plugin * lmms_plugin_main( Model *, void * _data )
PLUGIN_EXPORT Plugin * lmms_plugin_main(Model * m, void *)
{
return new ZynAddSubFxInstrument( static_cast<InstrumentTrack *>( _data ) );
return new ZynAddSubFxInstrument(static_cast<InstrumentTrack *>(m));
}