![]() |
![]() |
![]() |
Buzztard Bt-Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#include <libbtcore/core.h> struct BtMachine; struct BtMachineClass; enum BtMachineState; gboolean bt_machine_activate_adder (BtMachine * const self
); gboolean bt_machine_activate_spreader (BtMachine * const self
); void bt_machine_add_pattern (const BtMachine *self
,const BtPattern *pattern
); void bt_machine_bind_parameter_control (const BtMachine * const self
,GstObject *object
,const gchar *property_name
,BtIcControl *control
); gchar * bt_machine_describe_global_param_value (const BtMachine * const self
,const gulong index
,GValue * const event
); gchar * bt_machine_describe_voice_param_value (const BtMachine * const self
,const gulong index
,GValue * const event
); gboolean bt_machine_enable_input_gain (BtMachine * const self
); gboolean bt_machine_enable_input_post_level (BtMachine * const self
); gboolean bt_machine_enable_input_pre_level (BtMachine * const self
); gboolean bt_machine_enable_output_gain (BtMachine * const self
); gboolean bt_machine_enable_output_post_level (BtMachine * const self
); gboolean bt_machine_enable_output_pre_level (BtMachine * const self
); void bt_machine_get_global_param_details (const BtMachine * const self
,const gulong index
,GParamSpec **pspec
,GValue **min_val
,GValue **max_val
); glong bt_machine_get_global_param_index (const BtMachine * const self
,const gchar * const name
,GError **error
); const gchar * bt_machine_get_global_param_name (const BtMachine * const self
,const gulong index
); GValue * bt_machine_get_global_param_no_value (const BtMachine * const self
,const gulong index
); GParamSpec * bt_machine_get_global_param_spec (const BtMachine * const self
,const gulong index
); GType bt_machine_get_global_param_type (const BtMachine * const self
,const gulong index
); glong bt_machine_get_global_wave_param_index (const BtMachine * const self
); BtPattern * bt_machine_get_pattern_by_id (const BtMachine * const self
,const gchar * const id
); BtPattern * bt_machine_get_pattern_by_index (const BtMachine * const self
,const gulong index
); BtPattern * bt_machine_get_pattern_by_name (const BtMachine * const self
,const gchar * const name
); gchar * bt_machine_get_unique_pattern_name (const BtMachine * const self
); void bt_machine_get_voice_param_details (const BtMachine * const self
,const gulong index
,GParamSpec **pspec
,GValue **min_val
,GValue **max_val
); glong bt_machine_get_voice_param_index (const BtMachine * const self
,const gchar * const name
,GError **error
); const gchar * bt_machine_get_voice_param_name (const BtMachine * const self
,const gulong index
); GValue * bt_machine_get_voice_param_no_value (const BtMachine * const self
,const gulong index
); GParamSpec * bt_machine_get_voice_param_spec (const BtMachine * const self
,const gulong index
); GType bt_machine_get_voice_param_type (const BtMachine * const self
,const gulong index
); glong bt_machine_get_voice_wave_param_index (const BtMachine * const self
); BtWire * bt_machine_get_wire_by_dst_machine (const BtMachine * const self
,const BtMachine * const dst
); void bt_machine_global_controller_change_value (const BtMachine * const self
,const gulong param
,const GstClockTime timestamp
,GValue *value
); gboolean bt_machine_has_active_adder (const BtMachine * const self
); gboolean bt_machine_has_active_spreader (const BtMachine * const self
); gboolean bt_machine_has_patterns (const BtMachine * const self
); gboolean bt_machine_is_global_param_no_value (const BtMachine * const self
,const gulong index
,GValue * const value
); gboolean bt_machine_is_global_param_trigger (const BtMachine * const self
,const gulong index
); gboolean bt_machine_is_polyphonic (const BtMachine * const self
); gboolean bt_machine_is_voice_param_no_value (const BtMachine *const self
,const gulong index
,GValue * const value
); gboolean bt_machine_is_voice_param_trigger (const BtMachine * const self
,const gulong index
); void bt_machine_randomize_parameters (const BtMachine * const self
); void bt_machine_remove_pattern (const BtMachine *self
,const BtPattern *pattern
); void bt_machine_reset_parameters (const BtMachine * const self
); void bt_machine_set_global_param_default (const BtMachine * const self
,const gulong index
); void bt_machine_set_global_param_value (const BtMachine * const self
,const gulong index
,GValue * const event
); void bt_machine_set_param_defaults (const BtMachine *const self
); void bt_machine_set_voice_param_default (const BtMachine * const self
,const gulong voice
,const gulong index
); void bt_machine_set_voice_param_value (const BtMachine * const self
,const gulong voice
,const gulong index
,GValue * const event
); void bt_machine_unbind_parameter_control (const BtMachine * const self
,GstObject *object
,const char *property_name
); void bt_machine_unbind_parameter_controls (const BtMachine * const self
); void bt_machine_voice_controller_change_value (const BtMachine * const self
,const gulong voice
,const gulong param
,const GstClockTime timestamp
,GValue *value
);
GObject +----GstObject +----GstElement +----GstBin +----BtMachine +----BtProcessorMachine +----BtSinkMachine +----BtSourceMachine
"adder-convert" GstElement* : Read "construction-error" gpointer : Read / Write / Construct Only "global-params" gulong : Read / Write "id" gchar* : Read / Write / Construct "input-gain" GstElement* : Read "input-post-level" GstElement* : Read "input-pre-level" GstElement* : Read "machine" GstElement* : Read "output-gain" GstElement* : Read "output-post-level" GstElement* : Read "output-pre-level" GstElement* : Read "patterns" gpointer : Read "plugin-name" gchar* : Read / Write / Construct "properties" gpointer : Read "song" BtSong* : Read / Write / Construct Only "state" BtMachineState : Read / Write "voice-params" gulong : Read / Write "voices" gulong : Read / Write / Construct
Machines are pieces in a BtSong that generate, process or play media.
The machine class takes care of inserting additional low-level elemnts to do signal conversion etc.. Further it provides general facillities like input/output level monitoring. The resulting machine instance is a box containing several processing elements.
A machine can have several GstElements:
adder: |
mixes all incoming signals |
input volume: |
gain for incoming signals |
input pre/post-gain level: |
level meter for incoming signal |
machine: |
the real machine |
output volume: |
gain for outgoing signal |
output pre/post-gain level: |
level meter for outgoing signal |
spreader: |
distibutes signal to outgoing connections |
The adder and spreader elements are activated depending on element type. The volume controls and level meters are activated as requested via the API. It is recommended to only activate them, when needed. The instances are cached after deactivation (so that they can be easily reactivated) and destroyed with the BtMachine object.
Furthermore the machine handles a list of BtPattern instances. These contain event patterns that form a BtSequence.
struct BtMachine { /*< read-only >*/ GList *src_wires; GList *dst_wires; };
Base object for a virtual piece of hardware (generator, effect, ...).
struct BtMachineClass { /* virtual methods for subclasses */ gboolean (*check_type)(const BtMachine * const machine, const gulong pad_src_ct, const gulong pad_sink_ct); };
Base class for machines.
typedef enum { BT_MACHINE_STATE_NORMAL=0, BT_MACHINE_STATE_MUTE, BT_MACHINE_STATE_SOLO, BT_MACHINE_STATE_BYPASS, } BtMachineState;
A machine is always in one of the 4 states. Use the "state" property of the BtMachine to change or query the current state.
gboolean bt_machine_activate_adder (BtMachine * const self
);
Machines use an adder to allow multiple incoming wires. This method is used by the BtWire class to activate the adder when needed.
|
the machine to activate the adder in |
Returns : |
TRUE for success |
gboolean bt_machine_activate_spreader (BtMachine * const self
);
Machines use a spreader to allow multiple outgoing wires. This method is used by the BtWire class to activate the spreader when needed.
|
the machine to activate the spreader in |
Returns : |
TRUE for success |
void bt_machine_add_pattern (const BtMachine *self
,const BtPattern *pattern
);
Add the supplied pattern to the machine. This is automatically done by
bt_pattern_new()
.
|
the machine to add the pattern to |
|
the new pattern instance |
void bt_machine_bind_parameter_control (const BtMachine * const self
,GstObject *object
,const gchar *property_name
,BtIcControl *control
);
Connect the interaction control object to the give parameter. Changes of the control-value are mapped into a change of the parameter.
|
machine |
|
child object (global or voice child) |
|
name of the parameter |
|
interaction control object |
gchar * bt_machine_describe_global_param_value (const BtMachine * const self
,const gulong index
,GValue * const event
);
Described a param value in human readable form. The type of the given value
must match the type of the paramspec of the param referenced by index
.
|
the machine to get a param description from |
|
the offset in the list of global params |
|
the value to describe |
Returns : |
the description as newly allocated string |
gchar * bt_machine_describe_voice_param_value (const BtMachine * const self
,const gulong index
,GValue * const event
);
Described a param value in human readable form. The type of the given value
must match the type of the paramspec of the param referenced by index
.
|
the machine to get a param description from |
|
the offset in the list of voice params |
|
the value to describe |
Returns : |
the description as newly allocated string |
gboolean bt_machine_enable_input_gain (BtMachine * const self
);
Creates the input-gain element of the machine and activates it.
|
the machine to enable the input-gain element in |
Returns : |
TRUE for success, FALSE otherwise |
gboolean bt_machine_enable_input_post_level (BtMachine * const self
);
Creates the post-gain input-level analyser of the machine and activates it.
|
the machine to enable the post-gain input-level analyser in |
Returns : |
TRUE for success, FALSE otherwise |
gboolean bt_machine_enable_input_pre_level (BtMachine * const self
);
Creates the pre-gain input-level analyser of the machine and activates it.
|
the machine to enable the pre-gain input-level analyser in |
Returns : |
TRUE for success, FALSE otherwise |
gboolean bt_machine_enable_output_gain (BtMachine * const self
);
Creates the output-gain element of the machine and activates it.
|
the machine to enable the output-gain element in |
Returns : |
TRUE for success, FALSE otherwise |
gboolean bt_machine_enable_output_post_level (BtMachine * const self
);
Creates the post-gain output-level analyser of the machine and activates it.
|
the machine to enable the post-gain output-level analyser in |
Returns : |
TRUE for success, FALSE otherwise |
gboolean bt_machine_enable_output_pre_level (BtMachine * const self
);
Creates the pre-gain output-level analyser of the machine and activates it.
|
the machine to enable the pre-gain output-level analyser in |
Returns : |
TRUE for success, FALSE otherwise |
void bt_machine_get_global_param_details (const BtMachine * const self
,const gulong index
,GParamSpec **pspec
,GValue **min_val
,GValue **max_val
);
Retrieves the details of a global param. Any detail can be NULL
if its not
wanted.
|
the machine to search for the global param details |
|
the offset in the list of global params |
|
place for the param spec |
|
place to hold new GValue with minimum |
|
place to hold new GValue with maximum |
glong bt_machine_get_global_param_index (const BtMachine * const self
,const gchar * const name
,GError **error
);
Searches the list of registered param of a machine for a global param of the given name and returns the index if found.
|
the machine to search for the global param |
|
the name of the global param |
|
the location of an error instance to fill with a message, if an error occures |
Returns : |
the index or sets error if it is not found and returns -1. |
const gchar * bt_machine_get_global_param_name (const BtMachine * const self
,const gulong index
);
Gets the global param name. Do not modify returned content.
|
the machine to get the param name from |
|
the offset in the list of global params |
Returns : |
the requested name |
GValue * bt_machine_get_global_param_no_value (const BtMachine * const self
,const gulong index
);
Get the neutral value for the machines parameter.
|
the machine to get params from |
|
the offset in the list of global params |
Returns : |
the value. Don't modify. |
Since 0.6
GParamSpec * bt_machine_get_global_param_spec (const BtMachine * const self
,const gulong index
);
Retrieves the parameter specification for the global param
|
the machine to search for the global param |
|
the offset in the list of global params |
Returns : |
the GParamSpec for the requested global param |
GType bt_machine_get_global_param_type (const BtMachine * const self
,const gulong index
);
Retrieves the GType of a global param
|
the machine to search for the global param type |
|
the offset in the list of global params |
Returns : |
the requested GType |
glong bt_machine_get_global_wave_param_index
(const BtMachine * const self
);
Searches for the wave-table index parameter (if any). This parameter should refer to a wavetable index that should be used to play a note.
|
the machine to lookup the param from |
Returns : |
the index of the wave-table parameter or -1 if none. |
BtPattern * bt_machine_get_pattern_by_id (const BtMachine * const self
,const gchar * const id
);
Search the machine for a pattern by the supplied id.
The pattern must have been added previously to this setup with #bt_machine_add_pattern()
.
Unref the pattern, when done with it.
|
the machine to search for the pattern |
|
the identifier of the pattern |
Returns : |
BtPattern instance or NULL if not found |
BtPattern * bt_machine_get_pattern_by_index (const BtMachine * const self
,const gulong index
);
Fetches the pattern from the given position of the machines pattern list.
The pattern must have been added previously to this setup with #bt_machine_add_pattern()
.
Unref the pattern, when done with it.
|
the machine to search for the pattern |
|
the index of the pattern in the machines pattern list |
Returns : |
BtPattern instance or NULL if not found |
BtPattern * bt_machine_get_pattern_by_name (const BtMachine * const self
,const gchar * const name
);
Search the machine for a pattern by the supplied name.
The pattern must have been added previously to this setup with #bt_machine_add_pattern()
.
Unref the pattern, when done with it.
|
the machine to search for the pattern |
|
the name of the pattern |
Returns : |
BtPattern instance or NULL if not found |
gchar * bt_machine_get_unique_pattern_name (const BtMachine * const self
);
The function generates a unique pattern name for this machine by eventually adding a number postfix. This method should be used when adding new patterns.
|
the machine for which the name should be unique |
Returns : |
the newly allocated unique name |
void bt_machine_get_voice_param_details (const BtMachine * const self
,const gulong index
,GParamSpec **pspec
,GValue **min_val
,GValue **max_val
);
Retrieves the details of a voice param. Any detail can be NULL
if its not
wanted.
|
the machine to search for the voice param details |
|
the offset in the list of voice params |
|
place for the param spec |
|
place to hold new GValue with minimum |
|
place to hold new GValue with maximum |
glong bt_machine_get_voice_param_index (const BtMachine * const self
,const gchar * const name
,GError **error
);
Searches the list of registered param of a machine for a voice param of the given name and returns the index if found.
|
the machine to search for the voice param |
|
the name of the voice param |
|
the location of an error instance to fill with a message, if an error occures |
Returns : |
the index or sets error if it is not found and returns -1. |
const gchar * bt_machine_get_voice_param_name (const BtMachine * const self
,const gulong index
);
Gets the voice param name. Do not modify returned content.
|
the machine to get the param name from |
|
the offset in the list of voice params |
Returns : |
the requested name |
GValue * bt_machine_get_voice_param_no_value (const BtMachine * const self
,const gulong index
);
Get the neutral value for the machines parameter.
|
the machine to get params from |
|
the offset in the list of voice params |
Returns : |
the value. Don't modify. |
Since 0.6
GParamSpec * bt_machine_get_voice_param_spec (const BtMachine * const self
,const gulong index
);
Retrieves the parameter specification for the voice param
|
the machine to search for the voice param |
|
the offset in the list of voice params |
Returns : |
the GParamSpec for the requested voice param |
GType bt_machine_get_voice_param_type (const BtMachine * const self
,const gulong index
);
Retrieves the GType of a voice param
|
the machine to search for the voice param type |
|
the offset in the list of voice params |
Returns : |
the requested GType |
glong bt_machine_get_voice_wave_param_index
(const BtMachine * const self
);
Searches for the wave-table index parameter (if any). This parameter should refer to a wavetable index that should be used to play a note.
|
the machine to lookup the param from |
Returns : |
the index of the wave-table parameter or -1 if none. |
BtWire * bt_machine_get_wire_by_dst_machine (const BtMachine * const self
,const BtMachine * const dst
);
Searches for a wire in the wires originating from this machine that uses the given BtMachine instances as a target. Unref the wire, when done with it.
|
the machine that is at src of a wire |
|
the machine that is at the dst end of the wire |
Returns : |
the BtWire or NULL |
Since 0.6
void bt_machine_global_controller_change_value (const BtMachine * const self
,const gulong param
,const GstClockTime timestamp
,GValue *value
);
Depending on whether the given value is NULL, sets or unsets the controller
value for the specified param and at the given time.
If timestamp
is 0 and value
is NULL
it set a default value for the start
of the controller sequence, taken from the current value of the parameter.
|
the machine to change the param for |
|
the global parameter index |
|
the time stamp of the change |
|
the new value or NULL to unset a previous one |
gboolean bt_machine_has_active_adder (const BtMachine * const self
);
Checks if the machine currently uses an adder. This method is used by the BtWire class to activate the adder when needed.
|
the machine to check |
Returns : |
TRUE for success |
gboolean bt_machine_has_active_spreader (const BtMachine * const self
);
Checks if the machine currently uses an spreader. This method is used by the BtWire class to activate the spreader when needed.
|
the machine to check |
Returns : |
TRUE for success |
gboolean bt_machine_has_patterns (const BtMachine * const self
);
Check if the machine has BtPattern entries appart from the standart private ones.
|
the machine for which to check the patterns |
Returns : |
TRUE if it has patterns |
gboolean bt_machine_is_global_param_no_value (const BtMachine * const self
,const gulong index
,GValue * const value
);
Tests if the given value is the no-value of the global param
|
the machine to check params from |
|
the offset in the list of global params |
|
the value to compare against the no-value |
Returns : |
TRUE if it is the no-value |
gboolean bt_machine_is_global_param_trigger (const BtMachine * const self
,const gulong index
);
Tests if the global param is a trigger param (like a key-note or a drum trigger).
|
the machine to check params from |
|
the offset in the list of global params |
Returns : |
TRUE if it is a trigger |
gboolean bt_machine_is_polyphonic (const BtMachine * const self
);
Tells if the machine can produce (multiple) voices. Monophonic machines have their (one) voice params as part of the global params.
|
the machine to check |
Returns : |
TRUE for polyphic machines, FALSE for monophonic ones |
gboolean bt_machine_is_voice_param_no_value (const BtMachine *const self
,const gulong index
,GValue * const value
);
Tests if the given value is the no-value of the voice param
|
the machine to check params from |
|
the offset in the list of voice params |
|
the value to compare against the no-value |
Returns : |
TRUE if it is the no-value |
gboolean bt_machine_is_voice_param_trigger (const BtMachine * const self
,const gulong index
);
Tests if the voice param is a trigger param (like a key-note or a drum trigger).
|
the machine to check params from |
|
the offset in the list of voice params |
Returns : |
TRUE if it is a trigger |
void bt_machine_randomize_parameters (const BtMachine * const self
);
Randomizes machine parameters.
|
machine |
void bt_machine_remove_pattern (const BtMachine *self
,const BtPattern *pattern
);
Remove the given pattern from the machine.
|
the machine to remove the pattern from |
|
the existing pattern instance |
void bt_machine_reset_parameters (const BtMachine * const self
);
Resets machine parameters back to defaults.
|
machine |
void bt_machine_set_global_param_default (const BtMachine * const self
,const gulong index
);
Set a default value that should be used before the first control-point.
|
the machine |
|
the offset in the list of global params |
void bt_machine_set_global_param_value (const BtMachine * const self
,const gulong index
,GValue * const event
);
Sets a the specified global param to the give data value.
|
the machine to set the global param value |
|
the offset in the list of global params |
|
the new value |
void bt_machine_set_param_defaults (const BtMachine *const self
);
Sets default values that should be used before the first control-point. Should be called, if all parameters are changed (like after switching presets).
|
the machine |
void bt_machine_set_voice_param_default (const BtMachine * const self
,const gulong voice
,const gulong index
);
Set a default value that should be used before the first control-point.
|
the machine |
|
the voice number |
|
the offset in the list of global params |
void bt_machine_set_voice_param_value (const BtMachine * const self
,const gulong voice
,const gulong index
,GValue * const event
);
Sets a the specified voice param to the give data value.
|
the machine to set the voice param value |
|
the voice to change |
|
the offset in the list of voice params |
|
the new value |
void bt_machine_unbind_parameter_control (const BtMachine * const self
,GstObject *object
,const char *property_name
);
Disconnect the interaction control object from the give parameter.
|
machine |
|
child object (global or voice child) |
|
name of the parameter |
void bt_machine_unbind_parameter_controls
(const BtMachine * const self
);
Disconnect all interaction controls.
|
machine |
void bt_machine_voice_controller_change_value (const BtMachine * const self
,const gulong voice
,const gulong param
,const GstClockTime timestamp
,GValue *value
);
Depending on whether the given value is NULL, sets or unsets the controller
value for the specified param and at the given time.
If timestamp
is 0 and value
is NULL
it set a default value for the start
of the controller sequence, taken from the current value of the parameter.
|
the machine to change the param for |
|
the voice number |
|
the voice parameter index |
|
the time stamp of the change |
|
the new value or NULL to unset a previous one |
"adder-convert"
property "adder-convert" GstElement* : Read
the after mixing format converter element, if any.
"construction-error"
property "construction-error" gpointer : Read / Write / Construct Only
signal failed instance creation.
"global-params"
property "global-params" gulong : Read / Write
number of params for the machine.
"id"
property "id" gchar* : Read / Write / Construct
machine identifier.
Default value: "unamed machine"
"input-post-level"
property "input-post-level" GstElement* : Read
the post-gain input-level element, if any.
"input-pre-level"
property "input-pre-level" GstElement* : Read
the pre-gain input-level element, if any.
"output-post-level"
property "output-post-level" GstElement* : Read
the post-gain output-level element, if any.
"output-pre-level"
property "output-pre-level" GstElement* : Read
the pre-gain output-level element, if any.
"plugin-name"
property "plugin-name" gchar* : Read / Write / Construct
the name of the gst plugin for the machine.
Default value: "unamed machine"
"song"
property"song" BtSong* : Read / Write / Construct Only
song object, the machine belongs to.
"state"
property"state" BtMachineState : Read / Write
the current state of this machine.
Default value: BT_MACHINE_STATE_NORMAL
"voice-params"
property "voice-params" gulong : Read / Write
number of params for each machine voice.
"pattern-added"
signalvoid user_function (BtMachine *self,
BtPattern *pattern,
gpointer user_data) : No Hooks
A new pattern item has been added to the machine
|
the machine object that emitted the signal |
|
the new pattern |
|
user data set when the signal handler was connected. |
"pattern-removed"
signalvoid user_function (BtMachine *self,
BtPattern *pattern,
gpointer user_data) : No Hooks
A pattern item has been removed from the machine
|
the machine object that emitted the signal |
|
the old pattern |
|
user data set when the signal handler was connected. |