Blame src/pcm/ladspa.h

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