(Commenting on my own reply. Just thinking too much as usual. :-)
/*
* create: instantiate the plugin
Maybe better to stiuck to LADSPA nomenclature? It might not be
perfect, but it would avoid confusion.
Here's another idea (from Audiality):
typedef enum
{
FX_STATE_CLOSED = 0,
FX_STATE_OPEN,
FX_STATE_READY,
FX_STATE_PAUSED,
FX_STATE_RUNNING,
FX_STATE_SILENT,
FX_STATE_RESTING
} a_fxstates_t;
typedef struct a_plugin_t
{
...
/* Plugin state management */
int (*state)(struct a_plugin_t *p, a_fxstates_t new_state);
...
} a_plugin_t;
Maybe I should point out that a_plugin_t is the *instance* type for
an Audiality plugin. Currently, I use a single entry to instantiate a
plugin. Example:
void delay_init(struct a_plugin_t *p)
{
p->state = delay_state;
p->control = delay_control;
p->process = delay_process;
p->process_r = delay_process_r;
}
I suppose one could add a state FX_STATE_VOID (or something) below
FX_STATE_CLOSED, and move instantiation and destruction (which is a
NOP as of now, as the host manages the a_plugin_t structs) into the
state() callback. Then just export the state() call, instead of an
extra init func. (Or use a "fake" state() call if desired, which
installs the real one in the provided a_plugin_t struct - coder's
choice.)
However, one should probably have some more arguments for the init
calls, to support multiple plugins, variants and stuff in a single
.so - so I guess it's better kept the way it is... :-)
//David Olofson - Programmer, Composer, Open Source Advocate
.- Coming soon from VaporWare Inc...------------------------.
| The Return of Audiality! Real, working software. Really! |
| Real time and off-line synthesis, scripting, MIDI, LGPL...|
`-----------------------------------> (Public Release RSN) -'
.- M A I A -------------------------------------------------.
| The Multimedia Application Integration Architecture |
`---------------------------->
http://www.linuxdj.com/maia -'
---
http://olofson.net ---
http://www.reologica.se ---