Blame src/pcm/ladspa.h

Packit 4a16fb
/* ladspa.h
Packit 4a16fb
Packit 4a16fb
   Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
Packit 4a16fb
   Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
Packit 4a16fb
   Stefan Westerfeld.
Packit 4a16fb
   
Packit 4a16fb
   This library is free software; you can redistribute it and/or
Packit 4a16fb
   modify it under the terms of the GNU Lesser General Public License
Packit 4a16fb
   as published by the Free Software Foundation; either version 2.1 of
Packit 4a16fb
   the License, or (at your option) any later version.
Packit 4a16fb
   
Packit 4a16fb
   This library is distributed in the hope that it will be useful, but
Packit 4a16fb
   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit 4a16fb
   Lesser General Public License for more details.
Packit 4a16fb
   
Packit 4a16fb
   You should have received a copy of the GNU Lesser General Public
Packit 4a16fb
   License along with this library; if not, write to the Free Software
Packit 4a16fb
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
Packit 4a16fb
   USA. */
Packit 4a16fb
Packit 4a16fb
#ifndef LADSPA_INCLUDED
Packit 4a16fb
#define LADSPA_INCLUDED
Packit 4a16fb
Packit 4a16fb
#define LADSPA_VERSION "1.1"
Packit 4a16fb
#define LADSPA_VERSION_MAJOR 1
Packit 4a16fb
#define LADSPA_VERSION_MINOR 1
Packit 4a16fb
Packit 4a16fb
#ifdef __cplusplus
Packit 4a16fb
extern "C" {
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Overview: 
Packit 4a16fb
Packit 4a16fb
   There is a large number of synthesis packages in use or development
Packit 4a16fb
   on the Linux platform at this time. This API (`The Linux Audio
Packit 4a16fb
   Developer's Simple Plugin API') attempts to give programmers the
Packit 4a16fb
   ability to write simple `plugin' audio processors in C/C++ and link
Packit 4a16fb
   them dynamically (`plug') into a range of these packages (`hosts').
Packit 4a16fb
   It should be possible for any host and any plugin to communicate
Packit 4a16fb
   completely through this interface.
Packit 4a16fb
Packit 4a16fb
   This API is deliberately short and simple. To achieve compatibility
Packit 4a16fb
   with a range of promising Linux sound synthesis packages it
Packit 4a16fb
   attempts to find the `greatest common divisor' in their logical
Packit 4a16fb
   behaviour. Having said this, certain limiting decisions are
Packit 4a16fb
   implicit, notably the use of a fixed type (LADSPA_Data) for all
Packit 4a16fb
   data transfer and absence of a parameterised `initialisation'
Packit 4a16fb
   phase. See below for the LADSPA_Data typedef.
Packit 4a16fb
Packit 4a16fb
   Plugins are expected to distinguish between control and audio
Packit 4a16fb
   data. Plugins have `ports' that are inputs or outputs for audio or
Packit 4a16fb
   control data and each plugin is `run' for a `block' corresponding
Packit 4a16fb
   to a short time interval measured in samples. Audio data is
Packit 4a16fb
   communicated using arrays of LADSPA_Data, allowing a block of audio
Packit 4a16fb
   to be processed by the plugin in a single pass. Control data is
Packit 4a16fb
   communicated using single LADSPA_Data values. Control data has a
Packit 4a16fb
   single value at the start of a call to the `run()' or `run_adding()'
Packit 4a16fb
   function, and may be considered to remain this value for its
Packit 4a16fb
   duration. The plugin may assume that all its input and output ports
Packit 4a16fb
   have been connected to the relevant data location (see the
Packit 4a16fb
   `connect_port()' function below) before it is asked to run.
Packit 4a16fb
Packit 4a16fb
   Plugins will reside in shared object files suitable for dynamic
Packit 4a16fb
   linking by dlopen() and family. The file will provide a number of
Packit 4a16fb
   `plugin types' that can be used to instantiate actual plugins
Packit 4a16fb
   (sometimes known as `plugin instances') that can be connected
Packit 4a16fb
   together to perform tasks.
Packit 4a16fb
Packit 4a16fb
   This API contains very limited error-handling. */
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Fundamental data type passed in and out of plugin. This data type
Packit 4a16fb
   is used to communicate audio samples and control values. It is
Packit 4a16fb
   assumed that the plugin will work sensibly given any numeric input
Packit 4a16fb
   value although it may have a preferred range (see hints below). 
Packit 4a16fb
Packit 4a16fb
   For audio it is generally assumed that 1.0f is the `0dB' reference
Packit 4a16fb
   amplitude and is a `normal' signal level. */
Packit 4a16fb
Packit 4a16fb
typedef float LADSPA_Data;
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Special Plugin Properties: 
Packit 4a16fb
 
Packit 4a16fb
   Optional features of the plugin type are encapsulated in the
Packit 4a16fb
   LADSPA_Properties type. This is assembled by ORing individual
Packit 4a16fb
   properties together. */
Packit 4a16fb
Packit 4a16fb
typedef int LADSPA_Properties;
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PROPERTY_REALTIME indicates that the plugin has a
Packit 4a16fb
   real-time dependency (e.g. listens to a MIDI device) and so its
Packit 4a16fb
   output must not be cached or subject to significant latency. */
Packit 4a16fb
#define LADSPA_PROPERTY_REALTIME        0x1
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PROPERTY_INPLACE_BROKEN indicates that the plugin
Packit 4a16fb
   may cease to work correctly if the host elects to use the same data
Packit 4a16fb
   location for both input and output (see connect_port()). This
Packit 4a16fb
   should be avoided as enabling this flag makes it impossible for
Packit 4a16fb
   hosts to use the plugin to process audio `in-place.' */
Packit 4a16fb
#define LADSPA_PROPERTY_INPLACE_BROKEN  0x2
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PROPERTY_HARD_RT_CAPABLE indicates that the plugin
Packit 4a16fb
   is capable of running not only in a conventional host but also in a
Packit 4a16fb
   `hard real-time' environment. To qualify for this the plugin must
Packit 4a16fb
   satisfy all of the following:
Packit 4a16fb
Packit 4a16fb
   (1) The plugin must not use malloc(), free() or other heap memory
Packit 4a16fb
   management within its run() or run_adding() functions. All new
Packit 4a16fb
   memory used in run() must be managed via the stack. These
Packit 4a16fb
   restrictions only apply to the run() function.
Packit 4a16fb
Packit 4a16fb
   (2) The plugin will not attempt to make use of any library
Packit 4a16fb
   functions with the exceptions of functions in the ANSI standard C
Packit 4a16fb
   and C maths libraries, which the host is expected to provide.
Packit 4a16fb
Packit 4a16fb
   (3) The plugin will not access files, devices, pipes, sockets, IPC
Packit 4a16fb
   or any other mechanism that might result in process or thread
Packit 4a16fb
   blocking.
Packit 4a16fb
      
Packit 4a16fb
   (4) The plugin will take an amount of time to execute a run() or
Packit 4a16fb
   run_adding() call approximately of form (A+B*SampleCount) where A
Packit 4a16fb
   and B depend on the machine and host in use. This amount of time
Packit 4a16fb
   may not depend on input signals or plugin state. The host is left
Packit 4a16fb
   the responsibility to perform timings to estimate upper bounds for
Packit 4a16fb
   A and B. */
Packit 4a16fb
#define LADSPA_PROPERTY_HARD_RT_CAPABLE 0x4
Packit 4a16fb
Packit 4a16fb
#define LADSPA_IS_REALTIME(x)        ((x) & LADSPA_PROPERTY_REALTIME)
Packit 4a16fb
#define LADSPA_IS_INPLACE_BROKEN(x)  ((x) & LADSPA_PROPERTY_INPLACE_BROKEN)
Packit 4a16fb
#define LADSPA_IS_HARD_RT_CAPABLE(x) ((x) & LADSPA_PROPERTY_HARD_RT_CAPABLE)
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Plugin Ports: 
Packit 4a16fb
Packit 4a16fb
   Plugins have `ports' that are inputs or outputs for audio or
Packit 4a16fb
   data. Ports can communicate arrays of LADSPA_Data (for audio
Packit 4a16fb
   inputs/outputs) or single LADSPA_Data values (for control
Packit 4a16fb
   input/outputs). This information is encapsulated in the
Packit 4a16fb
   LADSPA_PortDescriptor type which is assembled by ORing individual
Packit 4a16fb
   properties together.
Packit 4a16fb
Packit 4a16fb
   Note that a port must be an input or an output port but not both
Packit 4a16fb
   and that a port must be a control or audio port but not both. */
Packit 4a16fb
Packit 4a16fb
typedef int LADSPA_PortDescriptor;
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PORT_INPUT indicates that the port is an input. */
Packit 4a16fb
#define LADSPA_PORT_INPUT   0x1
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PORT_OUTPUT indicates that the port is an output. */
Packit 4a16fb
#define LADSPA_PORT_OUTPUT  0x2
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PORT_CONTROL indicates that the port is a control
Packit 4a16fb
   port. */
Packit 4a16fb
#define LADSPA_PORT_CONTROL 0x4
Packit 4a16fb
Packit 4a16fb
/* Property LADSPA_PORT_AUDIO indicates that the port is a audio
Packit 4a16fb
   port. */
Packit 4a16fb
#define LADSPA_PORT_AUDIO   0x8
Packit 4a16fb
Packit 4a16fb
#define LADSPA_IS_PORT_INPUT(x)   ((x) & LADSPA_PORT_INPUT)
Packit 4a16fb
#define LADSPA_IS_PORT_OUTPUT(x)  ((x) & LADSPA_PORT_OUTPUT)
Packit 4a16fb
#define LADSPA_IS_PORT_CONTROL(x) ((x) & LADSPA_PORT_CONTROL)
Packit 4a16fb
#define LADSPA_IS_PORT_AUDIO(x)   ((x) & LADSPA_PORT_AUDIO)
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Plugin Port Range Hints: 
Packit 4a16fb
Packit 4a16fb
   The host may wish to provide a representation of data entering or
Packit 4a16fb
   leaving a plugin (e.g. to generate a GUI automatically). To make
Packit 4a16fb
   this more meaningful, the plugin should provide `hints' to the host
Packit 4a16fb
   describing the usual values taken by the data.
Packit 4a16fb
   
Packit 4a16fb
   Note that these are only hints. The host may ignore them and the
Packit 4a16fb
   plugin must not assume that data supplied to it is meaningful. If
Packit 4a16fb
   the plugin receives invalid input data it is expected to continue
Packit 4a16fb
   to run without failure and, where possible, produce a sensible
Packit 4a16fb
   output (e.g. a high-pass filter given a negative cutoff frequency
Packit 4a16fb
   might switch to an all-pass mode).
Packit 4a16fb
    
Packit 4a16fb
   Hints are meaningful for all input and output ports but hints for
Packit 4a16fb
   input control ports are expected to be particularly useful.
Packit 4a16fb
   
Packit 4a16fb
   More hint information is encapsulated in the
Packit 4a16fb
   LADSPA_PortRangeHintDescriptor type which is assembled by ORing
Packit 4a16fb
   individual hint types together. Hints may require further
Packit 4a16fb
   LowerBound and UpperBound information.
Packit 4a16fb
Packit 4a16fb
   All the hint information for a particular port is aggregated in the
Packit 4a16fb
   LADSPA_PortRangeHint structure. */
Packit 4a16fb
Packit 4a16fb
typedef int LADSPA_PortRangeHintDescriptor;
Packit 4a16fb
Packit 4a16fb
/* Hint LADSPA_HINT_BOUNDED_BELOW indicates that the LowerBound field
Packit 4a16fb
   of the LADSPA_PortRangeHint should be considered meaningful. The
Packit 4a16fb
   value in this field should be considered the (inclusive) lower
Packit 4a16fb
   bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
Packit 4a16fb
   specified then the value of LowerBound should be multiplied by the
Packit 4a16fb
   sample rate. */
Packit 4a16fb
#define LADSPA_HINT_BOUNDED_BELOW   0x1
Packit 4a16fb
Packit 4a16fb
/* Hint LADSPA_HINT_BOUNDED_ABOVE indicates that the UpperBound field
Packit 4a16fb
   of the LADSPA_PortRangeHint should be considered meaningful. The
Packit 4a16fb
   value in this field should be considered the (inclusive) upper
Packit 4a16fb
   bound of the valid range. If LADSPA_HINT_SAMPLE_RATE is also
Packit 4a16fb
   specified then the value of UpperBound should be multiplied by the
Packit 4a16fb
   sample rate. */
Packit 4a16fb
#define LADSPA_HINT_BOUNDED_ABOVE   0x2
Packit 4a16fb
Packit 4a16fb
/* Hint LADSPA_HINT_TOGGLED indicates that the data item should be
Packit 4a16fb
   considered a Boolean toggle. Data less than or equal to zero should
Packit 4a16fb
   be considered `off' or `false,' and data above zero should be
Packit 4a16fb
   considered `on' or `true.' LADSPA_HINT_TOGGLED may not be used in
Packit 4a16fb
   conjunction with any other hint except LADSPA_HINT_DEFAULT_0 or
Packit 4a16fb
   LADSPA_HINT_DEFAULT_1. */
Packit 4a16fb
#define LADSPA_HINT_TOGGLED         0x4
Packit 4a16fb
Packit 4a16fb
/* Hint LADSPA_HINT_SAMPLE_RATE indicates that any bounds specified
Packit 4a16fb
   should be interpreted as multiples of the sample rate. For
Packit 4a16fb
   instance, a frequency range from 0Hz to the Nyquist frequency (half
Packit 4a16fb
   the sample rate) could be requested by this hint in conjunction
Packit 4a16fb
   with LowerBound = 0 and UpperBound = 0.5. Hosts that support bounds
Packit 4a16fb
   at all must support this hint to retain meaning. */
Packit 4a16fb
#define LADSPA_HINT_SAMPLE_RATE     0x8
Packit 4a16fb
Packit 4a16fb
/* Hint LADSPA_HINT_LOGARITHMIC indicates that it is likely that the
Packit 4a16fb
   user will find it more intuitive to view values using a logarithmic
Packit 4a16fb
   scale. This is particularly useful for frequencies and gains. */
Packit 4a16fb
#define LADSPA_HINT_LOGARITHMIC     0x10
Packit 4a16fb
Packit 4a16fb
/* Hint LADSPA_HINT_INTEGER indicates that a user interface would
Packit 4a16fb
   probably wish to provide a stepped control taking only integer
Packit 4a16fb
   values. Any bounds set should be slightly wider than the actual
Packit 4a16fb
   integer range required to avoid floating point rounding errors. For
Packit 4a16fb
   instance, the integer set {0,1,2,3} might be described as [-0.1,
Packit 4a16fb
   3.1]. */
Packit 4a16fb
#define LADSPA_HINT_INTEGER         0x20
Packit 4a16fb
Packit 4a16fb
/* The various LADSPA_HINT_HAS_DEFAULT_* hints indicate a `normal'
Packit 4a16fb
   value for the port that is sensible as a default. For instance,
Packit 4a16fb
   this value is suitable for use as an initial value in a user
Packit 4a16fb
   interface or as a value the host might assign to a control port
Packit 4a16fb
   when the user has not provided one. Defaults are encoded using a
Packit 4a16fb
   mask so only one default may be specified for a port. Some of the
Packit 4a16fb
   hints make use of lower and upper bounds, in which case the
Packit 4a16fb
   relevant bound or bounds must be available and
Packit 4a16fb
   LADSPA_HINT_SAMPLE_RATE must be applied as usual. The resulting
Packit 4a16fb
   default must be rounded if LADSPA_HINT_INTEGER is present. Default
Packit 4a16fb
   values were introduced in LADSPA v1.1. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_MASK    0x3C0
Packit 4a16fb
Packit 4a16fb
/* This default values indicates that no default is provided. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_NONE    0x0
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that the suggested lower bound for the
Packit 4a16fb
   port should be used. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_MINIMUM 0x40
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that a low value between the suggested
Packit 4a16fb
   lower and upper bounds should be chosen. For ports with
Packit 4a16fb
   LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.75 +
Packit 4a16fb
   log(upper) * 0.25). Otherwise, this should be (lower * 0.75 + upper
Packit 4a16fb
   * 0.25). */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_LOW     0x80
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that a middle value between the
Packit 4a16fb
   suggested lower and upper bounds should be chosen. For ports with
Packit 4a16fb
   LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.5 +
Packit 4a16fb
   log(upper) * 0.5). Otherwise, this should be (lower * 0.5 + upper *
Packit 4a16fb
   0.5). */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_MIDDLE  0xC0
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that a high value between the suggested
Packit 4a16fb
   lower and upper bounds should be chosen. For ports with
Packit 4a16fb
   LADSPA_HINT_LOGARITHMIC, this should be exp(log(lower) * 0.25 +
Packit 4a16fb
   log(upper) * 0.75). Otherwise, this should be (lower * 0.25 + upper
Packit 4a16fb
   * 0.75). */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_HIGH    0x100
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that the suggested upper bound for the
Packit 4a16fb
   port should be used. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_MAXIMUM 0x140
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that the number 0 should be used. Note
Packit 4a16fb
   that this default may be used in conjunction with
Packit 4a16fb
   LADSPA_HINT_TOGGLED. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_0       0x200
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that the number 1 should be used. Note
Packit 4a16fb
   that this default may be used in conjunction with
Packit 4a16fb
   LADSPA_HINT_TOGGLED. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_1       0x240
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that the number 100 should be used. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_100     0x280
Packit 4a16fb
Packit 4a16fb
/* This default hint indicates that the Hz frequency of `concert A'
Packit 4a16fb
   should be used. This will be 440 unless the host uses an unusual
Packit 4a16fb
   tuning convention, in which case it may be within a few Hz. */
Packit 4a16fb
#define LADSPA_HINT_DEFAULT_440     0x2C0
Packit 4a16fb
Packit 4a16fb
#define LADSPA_IS_HINT_BOUNDED_BELOW(x)   ((x) & LADSPA_HINT_BOUNDED_BELOW)
Packit 4a16fb
#define LADSPA_IS_HINT_BOUNDED_ABOVE(x)   ((x) & LADSPA_HINT_BOUNDED_ABOVE)
Packit 4a16fb
#define LADSPA_IS_HINT_TOGGLED(x)         ((x) & LADSPA_HINT_TOGGLED)
Packit 4a16fb
#define LADSPA_IS_HINT_SAMPLE_RATE(x)     ((x) & LADSPA_HINT_SAMPLE_RATE)
Packit 4a16fb
#define LADSPA_IS_HINT_LOGARITHMIC(x)     ((x) & LADSPA_HINT_LOGARITHMIC)
Packit 4a16fb
#define LADSPA_IS_HINT_INTEGER(x)         ((x) & LADSPA_HINT_INTEGER)
Packit 4a16fb
Packit 4a16fb
#define LADSPA_IS_HINT_HAS_DEFAULT(x)     ((x) & LADSPA_HINT_DEFAULT_MASK)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_MINIMUM)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_LOW(x)     (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_LOW)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x)  (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_MIDDLE)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_HIGH(x)    (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_HIGH)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_MAXIMUM)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_0(x)       (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_0)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_1(x)       (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_1)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_100(x)     (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                           == LADSPA_HINT_DEFAULT_100)
Packit 4a16fb
#define LADSPA_IS_HINT_DEFAULT_440(x)     (((x) & LADSPA_HINT_DEFAULT_MASK)   \
Packit 4a16fb
                                            == LADSPA_HINT_DEFAULT_440)
Packit 4a16fb
Packit 4a16fb
typedef struct _LADSPA_PortRangeHint {
Packit 4a16fb
Packit 4a16fb
  /* Hints about the port. */
Packit 4a16fb
  LADSPA_PortRangeHintDescriptor HintDescriptor;
Packit 4a16fb
Packit 4a16fb
  /* Meaningful when hint LADSPA_HINT_BOUNDED_BELOW is active. When
Packit 4a16fb
     LADSPA_HINT_SAMPLE_RATE is also active then this value should be
Packit 4a16fb
     multiplied by the relevant sample rate. */
Packit 4a16fb
  LADSPA_Data LowerBound;
Packit 4a16fb
Packit 4a16fb
  /* Meaningful when hint LADSPA_HINT_BOUNDED_ABOVE is active. When
Packit 4a16fb
     LADSPA_HINT_SAMPLE_RATE is also active then this value should be
Packit 4a16fb
     multiplied by the relevant sample rate. */
Packit 4a16fb
  LADSPA_Data UpperBound;
Packit 4a16fb
Packit 4a16fb
} LADSPA_PortRangeHint;
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Plugin Handles: 
Packit 4a16fb
Packit 4a16fb
   This plugin handle indicates a particular instance of the plugin
Packit 4a16fb
   concerned. It is valid to compare this to NULL (0 for C++) but
Packit 4a16fb
   otherwise the host should not attempt to interpret it. The plugin
Packit 4a16fb
   may use it to reference internal instance data. */
Packit 4a16fb
Packit 4a16fb
typedef void * LADSPA_Handle;
Packit 4a16fb
Packit 4a16fb
/*****************************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Descriptor for a Type of Plugin: 
Packit 4a16fb
Packit 4a16fb
   This structure is used to describe a plugin type. It provides a
Packit 4a16fb
   number of functions to examine the type, instantiate it, link it to
Packit 4a16fb
   buffers and workspaces and to run it. */
Packit 4a16fb
Packit 4a16fb
typedef struct _LADSPA_Descriptor { 
Packit 4a16fb
Packit 4a16fb
  /* This numeric identifier indicates the plugin type
Packit 4a16fb
     uniquely. Plugin programmers may reserve ranges of IDs from a
Packit 4a16fb
     central body to avoid clashes. Hosts may assume that IDs are
Packit 4a16fb
     below 0x1000000. */
Packit 4a16fb
  unsigned long UniqueID;
Packit 4a16fb
Packit 4a16fb
  /* This identifier can be used as a unique, case-sensitive
Packit 4a16fb
     identifier for the plugin type within the plugin file. Plugin
Packit 4a16fb
     types should be identified by file and label rather than by index
Packit 4a16fb
     or plugin name, which may be changed in new plugin
Packit 4a16fb
     versions. Labels must not contain white-space characters. */
Packit 4a16fb
  const char * Label;
Packit 4a16fb
Packit 4a16fb
  /* This indicates a number of properties of the plugin. */
Packit 4a16fb
  LADSPA_Properties Properties;
Packit 4a16fb
Packit 4a16fb
  /* This member points to the null-terminated name of the plugin
Packit 4a16fb
     (e.g. "Sine Oscillator"). */
Packit 4a16fb
  const char * Name;
Packit 4a16fb
Packit 4a16fb
  /* This member points to the null-terminated string indicating the
Packit 4a16fb
     maker of the plugin. This can be an empty string but not NULL. */
Packit 4a16fb
  const char * Maker;
Packit 4a16fb
Packit 4a16fb
  /* This member points to the null-terminated string indicating any
Packit 4a16fb
     copyright applying to the plugin. If no Copyright applies the
Packit 4a16fb
     string "None" should be used. */
Packit 4a16fb
  const char * Copyright;
Packit 4a16fb
Packit 4a16fb
  /* This indicates the number of ports (input AND output) present on
Packit 4a16fb
     the plugin. */
Packit 4a16fb
  unsigned long PortCount;
Packit 4a16fb
Packit 4a16fb
  /* This member indicates an array of port descriptors. Valid indices
Packit 4a16fb
     vary from 0 to PortCount-1. */
Packit 4a16fb
  const LADSPA_PortDescriptor * PortDescriptors;
Packit 4a16fb
Packit 4a16fb
  /* This member indicates an array of null-terminated strings
Packit 4a16fb
     describing ports (e.g. "Frequency (Hz)"). Valid indices vary from
Packit 4a16fb
     0 to PortCount-1. */
Packit 4a16fb
  const char * const * PortNames;
Packit 4a16fb
Packit 4a16fb
  /* This member indicates an array of range hints for each port (see
Packit 4a16fb
     above). Valid indices vary from 0 to PortCount-1. */
Packit 4a16fb
  const LADSPA_PortRangeHint * PortRangeHints;
Packit 4a16fb
Packit 4a16fb
  /* This may be used by the plugin developer to pass any custom
Packit 4a16fb
     implementation data into an instantiate call. It must not be used
Packit 4a16fb
     or interpreted by the host. It is expected that most plugin
Packit 4a16fb
     writers will not use this facility as LADSPA_Handle should be
Packit 4a16fb
     used to hold instance data. */
Packit 4a16fb
  void * ImplementationData;
Packit 4a16fb
Packit 4a16fb
  /* This member is a function pointer that instantiates a plugin. A
Packit 4a16fb
     handle is returned indicating the new plugin instance. The
Packit 4a16fb
     instantiation function accepts a sample rate as a parameter. The
Packit 4a16fb
     plugin descriptor from which this instantiate function was found
Packit 4a16fb
     must also be passed. This function must return NULL if
Packit 4a16fb
     instantiation fails. 
Packit 4a16fb
Packit 4a16fb
     Note that instance initialisation should generally occur in
Packit 4a16fb
     activate() rather than here. */
Packit 4a16fb
  LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
Packit 4a16fb
                               unsigned long                     SampleRate);
Packit 4a16fb
Packit 4a16fb
  /* This member is a function pointer that connects a port on an
Packit 4a16fb
     instantiated plugin to a memory location at which a block of data
Packit 4a16fb
     for the port will be read/written. The data location is expected
Packit 4a16fb
     to be an array of LADSPA_Data for audio ports or a single
Packit 4a16fb
     LADSPA_Data value for control ports. Memory issues will be
Packit 4a16fb
     managed by the host. The plugin must read/write the data at these
Packit 4a16fb
     locations every time run() or run_adding() is called and the data
Packit 4a16fb
     present at the time of this connection call should not be
Packit 4a16fb
     considered meaningful.
Packit 4a16fb
Packit 4a16fb
     connect_port() may be called more than once for a plugin instance
Packit 4a16fb
     to allow the host to change the buffers that the plugin is
Packit 4a16fb
     reading or writing. These calls may be made before or after
Packit 4a16fb
     activate() or deactivate() calls.
Packit 4a16fb
Packit 4a16fb
     connect_port() must be called at least once for each port before
Packit 4a16fb
     run() or run_adding() is called. When working with blocks of
Packit 4a16fb
     LADSPA_Data the plugin should pay careful attention to the block
Packit 4a16fb
     size passed to the run function as the block allocated may only
Packit 4a16fb
     just be large enough to contain the block of samples.
Packit 4a16fb
Packit 4a16fb
     Plugin writers should be aware that the host may elect to use the
Packit 4a16fb
     same buffer for more than one port and even use the same buffer
Packit 4a16fb
     for both input and output (see LADSPA_PROPERTY_INPLACE_BROKEN).
Packit 4a16fb
     However, overlapped buffers or use of a single buffer for both
Packit 4a16fb
     audio and control data may result in unexpected behaviour. */
Packit 4a16fb
   void (*connect_port)(LADSPA_Handle Instance,
Packit 4a16fb
                        unsigned long Port,
Packit 4a16fb
                        LADSPA_Data * DataLocation);
Packit 4a16fb
Packit 4a16fb
  /* This member is a function pointer that initialises a plugin
Packit 4a16fb
     instance and activates it for use. This is separated from
Packit 4a16fb
     instantiate() to aid real-time support and so that hosts can
Packit 4a16fb
     reinitialise a plugin instance by calling deactivate() and then
Packit 4a16fb
     activate(). In this case the plugin instance must reset all state
Packit 4a16fb
     information dependent on the history of the plugin instance
Packit 4a16fb
     except for any data locations provided by connect_port() and any
Packit 4a16fb
     gain set by set_run_adding_gain(). If there is nothing for
Packit 4a16fb
     activate() to do then the plugin writer may provide a NULL rather
Packit 4a16fb
     than an empty function.
Packit 4a16fb
Packit 4a16fb
     When present, hosts must call this function once before run() (or
Packit 4a16fb
     run_adding()) is called for the first time. This call should be
Packit 4a16fb
     made as close to the run() call as possible and indicates to
Packit 4a16fb
     real-time plugins that they are now live. Plugins should not rely
Packit 4a16fb
     on a prompt call to run() after activate(). activate() may not be
Packit 4a16fb
     called again unless deactivate() is called first. Note that
Packit 4a16fb
     connect_port() may be called before or after a call to
Packit 4a16fb
     activate(). */
Packit 4a16fb
  void (*activate)(LADSPA_Handle Instance);
Packit 4a16fb
Packit 4a16fb
  /* This method is a function pointer that runs an instance of a
Packit 4a16fb
     plugin for a block. Two parameters are required: the first is a
Packit 4a16fb
     handle to the particular instance to be run and the second
Packit 4a16fb
     indicates the block size (in samples) for which the plugin
Packit 4a16fb
     instance may run.
Packit 4a16fb
Packit 4a16fb
     Note that if an activate() function exists then it must be called
Packit 4a16fb
     before run() or run_adding(). If deactivate() is called for a
Packit 4a16fb
     plugin instance then the plugin instance may not be reused until
Packit 4a16fb
     activate() has been called again.
Packit 4a16fb
Packit 4a16fb
     If the plugin has the property LADSPA_PROPERTY_HARD_RT_CAPABLE
Packit 4a16fb
     then there are various things that the plugin should not do
Packit 4a16fb
     within the run() or run_adding() functions (see above). */
Packit 4a16fb
  void (*run)(LADSPA_Handle Instance,
Packit 4a16fb
              unsigned long SampleCount);
Packit 4a16fb
Packit 4a16fb
  /* This method is a function pointer that runs an instance of a
Packit 4a16fb
     plugin for a block. This has identical behaviour to run() except
Packit 4a16fb
     in the way data is output from the plugin. When run() is used,
Packit 4a16fb
     values are written directly to the memory areas associated with
Packit 4a16fb
     the output ports. However when run_adding() is called, values
Packit 4a16fb
     must be added to the values already present in the memory
Packit 4a16fb
     areas. Furthermore, output values written must be scaled by the
Packit 4a16fb
     current gain set by set_run_adding_gain() (see below) before
Packit 4a16fb
     addition.
Packit 4a16fb
Packit 4a16fb
     run_adding() is optional. When it is not provided by a plugin,
Packit 4a16fb
     this function pointer must be set to NULL. When it is provided,
Packit 4a16fb
     the function set_run_adding_gain() must be provided also. */
Packit 4a16fb
  void (*run_adding)(LADSPA_Handle Instance,
Packit 4a16fb
                     unsigned long SampleCount);
Packit 4a16fb
Packit 4a16fb
  /* This method is a function pointer that sets the output gain for
Packit 4a16fb
     use when run_adding() is called (see above). If this function is
Packit 4a16fb
     never called the gain is assumed to default to 1. Gain
Packit 4a16fb
     information should be retained when activate() or deactivate()
Packit 4a16fb
     are called.
Packit 4a16fb
Packit 4a16fb
     This function should be provided by the plugin if and only if the
Packit 4a16fb
     run_adding() function is provided. When it is absent this
Packit 4a16fb
     function pointer must be set to NULL. */
Packit 4a16fb
  void (*set_run_adding_gain)(LADSPA_Handle Instance,
Packit 4a16fb
                              LADSPA_Data   Gain);
Packit 4a16fb
Packit 4a16fb
  /* This is the counterpart to activate() (see above). If there is
Packit 4a16fb
     nothing for deactivate() to do then the plugin writer may provide
Packit 4a16fb
     a NULL rather than an empty function.
Packit 4a16fb
Packit 4a16fb
     Hosts must deactivate all activated units after they have been
Packit 4a16fb
     run() (or run_adding()) for the last time. This call should be
Packit 4a16fb
     made as close to the last run() call as possible and indicates to
Packit 4a16fb
     real-time plugins that they are no longer live. Plugins should
Packit 4a16fb
     not rely on prompt deactivation. Note that connect_port() may be
Packit 4a16fb
     called before or after a call to deactivate().
Packit 4a16fb
Packit 4a16fb
     Deactivation is not similar to pausing as the plugin instance
Packit 4a16fb
     will be reinitialised when activate() is called to reuse it. */
Packit 4a16fb
  void (*deactivate)(LADSPA_Handle Instance);
Packit 4a16fb
Packit 4a16fb
  /* Once an instance of a plugin has been finished with it can be
Packit 4a16fb
     deleted using the following function. The instance handle passed
Packit 4a16fb
     ceases to be valid after this call.
Packit 4a16fb
  
Packit 4a16fb
     If activate() was called for a plugin instance then a
Packit 4a16fb
     corresponding call to deactivate() must be made before cleanup()
Packit 4a16fb
     is called. */
Packit 4a16fb
  void (*cleanup)(LADSPA_Handle Instance);
Packit 4a16fb
Packit 4a16fb
} LADSPA_Descriptor;
Packit 4a16fb
Packit 4a16fb
/**********************************************************************/
Packit 4a16fb
Packit 4a16fb
/* Accessing a Plugin: */
Packit 4a16fb
Packit 4a16fb
/* The exact mechanism by which plugins are loaded is host-dependent,
Packit 4a16fb
   however all most hosts will need to know is the name of shared
Packit 4a16fb
   object file containing the plugin types. To allow multiple hosts to
Packit 4a16fb
   share plugin types, hosts may wish to check for environment
Packit 4a16fb
   variable LADSPA_PATH. If present, this should contain a
Packit 4a16fb
   colon-separated path indicating directories that should be searched
Packit 4a16fb
   (in order) when loading plugin types.
Packit 4a16fb
Packit 4a16fb
   A plugin programmer must include a function called
Packit 4a16fb
   "ladspa_descriptor" with the following function prototype within
Packit 4a16fb
   the shared object file. This function will have C-style linkage (if
Packit 4a16fb
   you are using C++ this is taken care of by the `extern "C"' clause
Packit 4a16fb
   at the top of the file).
Packit 4a16fb
Packit 4a16fb
   A host will find the plugin shared object file by one means or
Packit 4a16fb
   another, find the ladspa_descriptor() function, call it, and
Packit 4a16fb
   proceed from there.
Packit 4a16fb
Packit 4a16fb
   Plugin types are accessed by index (not ID) using values from 0
Packit 4a16fb
   upwards. Out of range indexes must result in this function
Packit 4a16fb
   returning NULL, so the plugin count can be determined by checking
Packit 4a16fb
   for the least index that results in NULL being returned. */
Packit 4a16fb
Packit 4a16fb
const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
Packit 4a16fb
Packit 4a16fb
/* Datatype corresponding to the ladspa_descriptor() function. */
Packit 4a16fb
typedef const LADSPA_Descriptor * 
Packit 4a16fb
(*LADSPA_Descriptor_Function)(unsigned long Index);
Packit 4a16fb
Packit 4a16fb
/**********************************************************************/
Packit 4a16fb
Packit 4a16fb
#ifdef __cplusplus
Packit 4a16fb
}
Packit 4a16fb
#endif
Packit 4a16fb
Packit 4a16fb
#endif /* LADSPA_INCLUDED */
Packit 4a16fb
Packit 4a16fb
/* EOF */