The filter_plugin_ops structure
The filter_plugin_ops structure that is returned by the Instantiate_Plugin function
and defines an instance of a filter plugin, is defined as:
typedef void op_filter_filechange(void*, char *name);
typedef status_t op_filter_filter(void*, short *buffer,int32 framecount, filter_info *info);
typedef status_t op_filter_filter_float(void*, float **input, float **output, int32 framecount, filter_info *info);
typedef BView* op_filter_configure(void*);
typedef void op_filter_setconfig(void*,BMessage *config);
typedef void op_filter_getconfig(void*,BMessage *config);
typedef struct filter_plugin_ops
{
uint32 ops_magic; // magic number
uint32 ops_version; // version of this plugin structure
op_filter_filechange (*FileChange); // leave NULL if not implemented
op_filter_filter (*Filter); // leave NULL if you implement FilterFloat
op_filter_configure (*Configure); // leave NULL if no run-time config
op_filter_setconfig (*SetConfig); // leave NULL if no run-time config
op_filter_getconfig (*GetConfig); // leave NULL if no run-time config
op_filter_filter_float (*FilterFloat); // leave NULL if you implement Filter
} filter_plugin_ops;
-
ops_magic is a magic number that you should set to PLUGIN_FILTER_MAGIC
-
ops_version is the current API version, and you should set it to PlUGIN_FILTER_VERSION
-
FileChange will be called when a new files begins playing. This functionality is
currently not implemented. If you do not need to implement this function you can set this to NULL
-
Filter will be called repeatedly to filter a buffer of data. The data you get will always
be 16 bit stereo, in native byteorder.
Alternatively, you may choose to implement your filter as a floating point filter. You do this
by leaving Filter set to NULL, and instead implementing FilterFloat. This function
is provided with separate input and output buffers, which are given as pointers to an array of pointers to floating-point arrays, one per channel. Currently the number of channels is fixed at 2.
-
Configure is called to bring up a configuration dialog for the active filter. It should
return a BView with the controls needed to configure the plugin. Leave NULL if not implemented.
-
SetConfig is called to set the configuration of the plugin. This function will be called
after creating the plugin, before the Filter function is called for the first time. The plugin
should retrieve its configuration from the BMessage. Leave NULL if not implemented.
-
GetConfig is called to retrieve the configuration of the plugin. The plugin should store
its current configuration in the BMessage. Leave NULL if not implemented.
The void* that all of the functions receive as their first argument is the pointer that
was filled in by the Instantiate_Plugin function.
The filter_info structure that is passed to the filter functions is defined as:
typedef struct filter_info
{
float pitch;
float volume;
} filter_info;
The filter_info structure gives information about the first track in SoundPlay only.
Copyright © 1999 Marco Nelissen