libmapper
1.2
|
Typedefs | |
typedef void | mapper_signal_update_handler(mapper_signal sig, mapper_id instance, const void *value, int count, mapper_timetag_t *tt) |
typedef void | mapper_instance_event_handler(mapper_signal sig, mapper_id instance, mapper_instance_event event, mapper_timetag_t *tt) |
Functions | |
void | mapper_signal_update (mapper_signal sig, const void *value, int count, mapper_timetag_t tt) |
void | mapper_signal_update_int (mapper_signal sig, int value) |
void | mapper_signal_update_float (mapper_signal sig, float value) |
void | mapper_signal_update_double (mapper_signal sig, double value) |
const void * | mapper_signal_value (mapper_signal sig, mapper_timetag_t *tt) |
int | mapper_signal_query_remotes (mapper_signal sig, mapper_timetag_t tt) |
mapper_map * | mapper_signal_maps (mapper_signal sig, mapper_direction dir) |
void | mapper_signal_set_user_data (mapper_signal sig, const void *user_data) |
mapper_signal_group | mapper_signal_signal_group (mapper_signal sig) |
void | mapper_signal_set_group (mapper_signal sig, mapper_signal_group group) |
void * | mapper_signal_user_data (mapper_signal sig) |
void | mapper_signal_set_callback (mapper_signal sig, mapper_signal_update_handler *handler) |
int | mapper_signal_reserve_instances (mapper_signal sig, int num, mapper_id *ids, void **user_data) |
void | mapper_signal_instance_update (mapper_signal sig, mapper_id instance, const void *value, int count, mapper_timetag_t tt) |
void | mapper_signal_instance_release (mapper_signal sig, mapper_id instance, mapper_timetag_t tt) |
void | mapper_signal_remove_instance (mapper_signal sig, mapper_id instance) |
int | mapper_signal_instance_is_active (mapper_signal sig, mapper_id instance) |
int | mapper_signal_instance_activate (mapper_signal sig, mapper_id instance) |
mapper_id | mapper_signal_oldest_active_instance (mapper_signal sig) |
mapper_id | mapper_signal_newest_active_instance (mapper_signal sig) |
const void * | mapper_signal_instance_value (mapper_signal sig, mapper_id instance, mapper_timetag_t *tt) |
int | mapper_signal_num_active_instances (mapper_signal sig) |
int | mapper_signal_num_reserved_instances (mapper_signal sig) |
mapper_id | mapper_signal_instance_id (mapper_signal sig, int index) |
mapper_id | mapper_signal_active_instance_id (mapper_signal sig, int index) |
mapper_id | mapper_signal_reserved_instance_id (mapper_signal sig, int index) |
void | mapper_signal_set_instance_stealing_mode (mapper_signal sig, mapper_instance_stealing_type mode) |
mapper_instance_stealing_type | mapper_signal_instance_stealing_mode (mapper_signal sig) |
void | mapper_signal_set_instance_event_callback (mapper_signal sig, mapper_instance_event_handler h, int flags) |
void | mapper_signal_instance_set_user_data (mapper_signal sig, mapper_id instance, const void *user_data) |
void * | mapper_signal_instance_user_data (mapper_signal sig, mapper_id instance) |
const char * | mapper_signal_description (mapper_signal sig) |
mapper_device | mapper_signal_device (mapper_signal sig) |
mapper_direction | mapper_signal_direction (mapper_signal sig) |
mapper_id | mapper_signal_id (mapper_signal sig) |
int | mapper_signal_is_local (mapper_signal sig) |
int | mapper_signal_length (mapper_signal sig) |
void * | mapper_signal_maximum (mapper_signal sig) |
void * | mapper_signal_minimum (mapper_signal sig) |
const char * | mapper_signal_name (mapper_signal sig) |
int | mapper_signal_num_instances (mapper_signal sig) |
int | mapper_signal_num_maps (mapper_signal sig, mapper_direction dir) |
float | mapper_signal_rate (mapper_signal sig) |
char | mapper_signal_type (mapper_signal sig) |
const char * | mapper_signal_unit (mapper_signal sig) |
int | mapper_signal_num_properties (mapper_signal sig) |
int | mapper_signal_property (mapper_signal sig, const char *name, int *length, char *type, const void **value) |
int | mapper_signal_property_index (mapper_signal sig, unsigned int index, const char **name, int *length, char *type, const void **value) |
void | mapper_signal_set_description (mapper_signal sig, const char *description) |
void | mapper_signal_set_maximum (mapper_signal sig, const void *maximum) |
void | mapper_signal_set_minimum (mapper_signal sig, const void *minimum) |
void | mapper_signal_set_rate (mapper_signal sig, float rate) |
void | mapper_signal_set_unit (mapper_signal sig, const char *unit) |
int | mapper_signal_set_property (mapper_signal sig, const char *name, int length, char type, const void *value, int publish) |
void | mapper_signal_clear_staged_properties (mapper_signal sig) |
void | mapper_signal_push (mapper_signal sig) |
int | mapper_signal_remove_property (mapper_signal sig, const char *name) |
mapper_signal * | mapper_signal_query_union (mapper_signal *query1, mapper_signal *query2) |
mapper_signal * | mapper_signal_query_intersection (mapper_signal *query1, mapper_signal *query2) |
mapper_signal * | mapper_signal_query_difference (mapper_signal *query1, mapper_signal *query2) |
mapper_signal | mapper_signal_query_index (mapper_signal *query, int index) |
mapper_signal * | mapper_signal_query_next (mapper_signal *query) |
mapper_signal * | mapper_signal_query_copy (mapper_signal *query) |
void | mapper_signal_query_done (mapper_signal *query) |
void | mapper_signal_print (mapper_signal sig, int device_name) |
Signals define inputs or outputs for devices. A signal consists of a scalar or vector value of some integer or floating-point type. A mapper_signal is created by adding an input or output to a device. It can optionally be provided with some metadata such as a signal's range, unit, or other properties. Signals can be mapped by creating maps through a GUI.
typedef void mapper_instance_event_handler(mapper_signal sig, mapper_id instance, mapper_instance_event event, mapper_timetag_t *tt) |
A handler function to be called whenever a signal instance management event occurs.
typedef void mapper_signal_update_handler(mapper_signal sig, mapper_id instance, const void *value, int count, mapper_timetag_t *tt) |
A signal handler function can be called whenever a signal value changes.
mapper_id mapper_signal_active_instance_id | ( | mapper_signal | sig, |
int | index | ||
) |
Get an active signal instance's ID by its index. Intended to be used for iterating over the active instances.
sig | The signal to operate on. |
index | The numerical index of the ID to retrieve. Should be between zero and the number of instances. |
void mapper_signal_clear_staged_properties | ( | mapper_signal | sig | ) |
Clear any staged property changes.
sig | The signal to operate on. |
const char* mapper_signal_description | ( | mapper_signal | sig | ) |
Get the description for a specific signal.
sig | The signal to check. |
mapper_device mapper_signal_device | ( | mapper_signal | sig | ) |
Get the parent mapper_device for a specific signal.
sig | The signal to check. |
mapper_direction mapper_signal_direction | ( | mapper_signal | sig | ) |
Get the direction for a specific signal.
sig | The signal to check. |
mapper_id mapper_signal_id | ( | mapper_signal | sig | ) |
Get the unique id for a specific signal.
sig | The signal to check. |
int mapper_signal_instance_activate | ( | mapper_signal | sig, |
mapper_id | instance | ||
) |
Activate a specific signal instance.
sig | The signal to operate on. |
instance | The identifier of the instance to activate. |
mapper_id mapper_signal_instance_id | ( | mapper_signal | sig, |
int | index | ||
) |
Get a signal instance's identifier by its index. Intended to be used for iterating over the active instances.
sig | The signal to operate on. |
index | The numerical index of the ID to retrieve. Should be between zero and the number of instances. |
int mapper_signal_instance_is_active | ( | mapper_signal | sig, |
mapper_id | instance | ||
) |
Return whether a given signal instance is currently active.
sig | The signal to operate on. |
instance | The identifier of the instance to check. |
void mapper_signal_instance_release | ( | mapper_signal | sig, |
mapper_id | instance, | ||
mapper_timetag_t | tt | ||
) |
Release a specific instance of a signal by removing it from the list of active instances and adding it to the reserve list.
sig | The signal to operate on. |
instance | The identifier of the instance to suspend. |
tt | The time at which the instance was released; if NULL, will be tagged with the current time. See mapper_device_start_queue() for more information on bundling multiple signal updates with the same timetag. |
void mapper_signal_instance_set_user_data | ( | mapper_signal | sig, |
mapper_id | instance, | ||
const void * | user_data | ||
) |
Associate a signal instance with an arbitrary pointer.
sig | The signal to operate on. |
instance | The identifier of the instance to operate on. |
user_data | A pointer to user data to be associated with this instance. |
mapper_instance_stealing_type mapper_signal_instance_stealing_mode | ( | mapper_signal | sig | ) |
Get the stealing method to be used when a previously-unseen instance ID is received.
sig | The signal to operate on. |
void mapper_signal_instance_update | ( | mapper_signal | sig, |
mapper_id | instance, | ||
const void * | value, | ||
int | count, | ||
mapper_timetag_t | tt | ||
) |
Update the value of a specific signal instance. The signal will be routed according to external requests.
sig | The signal to operate on. |
instance | The identifier of the instance to update. |
value | A pointer to a new value for this signal. If the signal type is 'i', this should be int*; if the signal type is 'f', this should be float* (etc). It should be an array at least as long as the signal's length property. |
count | The number of values being updated, or 0 for non-periodic signals. |
tt | The time at which the value update was aquired. If NULL, libmapper will tag the value update with the current time. See mapper_device_start_queue() for more information on bundling multiple signal updates with the same timetag. |
void* mapper_signal_instance_user_data | ( | mapper_signal | sig, |
mapper_id | instance | ||
) |
Retrieve the arbitrary pointer associated with a signal instance.
sig | The signal to operate on. |
instance | The identifier of the instance to operate on. |
const void* mapper_signal_instance_value | ( | mapper_signal | sig, |
mapper_id | instance, | ||
mapper_timetag_t * | tt | ||
) |
Get a signal_instance's value.
sig | The signal to operate on. |
instance | The identifier of the instance to operate on. |
tt | A location to receive the value's time tag. May be 0. |
int mapper_signal_is_local | ( | mapper_signal | sig | ) |
Indicate whether this signal is local.
sig | The signal to check. |
int mapper_signal_length | ( | mapper_signal | sig | ) |
Get the vector length for a specific signal.
sig | The signal to check. |
mapper_map* mapper_signal_maps | ( | mapper_signal | sig, |
mapper_direction | dir | ||
) |
Return the list of maps associated with a given signal.
sig | Signal record to query for maps. |
dir | The direction of the map relative to the given signal. |
void* mapper_signal_maximum | ( | mapper_signal | sig | ) |
Get the maximum for a specific signal.
sig | The signal to check. |
void* mapper_signal_minimum | ( | mapper_signal | sig | ) |
Get the minimum for a specific signal.
sig | The signal to check. |
const char* mapper_signal_name | ( | mapper_signal | sig | ) |
Get the name for a specific signal.
sig | The signal to check. |
mapper_id mapper_signal_newest_active_instance | ( | mapper_signal | sig | ) |
Get the local id of the newest active instance.
sig | The signal to operate on. |
int mapper_signal_num_active_instances | ( | mapper_signal | sig | ) |
Return the number of active instances owned by a signal.
sig | The signal to query. |
int mapper_signal_num_instances | ( | mapper_signal | sig | ) |
Get the number of instances for a specific signal.
sig | The signal to check. |
int mapper_signal_num_maps | ( | mapper_signal | sig, |
mapper_direction | dir | ||
) |
Get the number of maps associated with a specific signal.
sig | The signal to check. |
dir | The direction of the maps relative to the given signal. |
int mapper_signal_num_properties | ( | mapper_signal | sig | ) |
Get the total number of properties for a specific signal.
sig | The signal to check. |
int mapper_signal_num_reserved_instances | ( | mapper_signal | sig | ) |
Return the number of reserved instances owned by a signal.
sig | The signal to query. |
mapper_id mapper_signal_oldest_active_instance | ( | mapper_signal | sig | ) |
Get the local id of the oldest active instance.
sig | The signal to operate on. |
void mapper_signal_print | ( | mapper_signal | sig, |
int | device_name | ||
) |
Helper to print the properties of a specific signal.
sig | The signal to print. |
device_name | 1 to include the parent device name, 0 otherwise. |
int mapper_signal_property | ( | mapper_signal | sig, |
const char * | name, | ||
int * | length, | ||
char * | type, | ||
const void ** | value | ||
) |
Look up a signal property by name.
sig | The signal to check. |
name | The name of the property to retrieve. |
length | A pointer to a location to receive the vector length of the property value. (Required.) |
type | A pointer to a location to receive the type of the property value. (Required.) |
value | A pointer to a location to receive the address of the property's value. (Required.) |
int mapper_signal_property_index | ( | mapper_signal | sig, |
unsigned int | index, | ||
const char ** | name, | ||
int * | length, | ||
char * | type, | ||
const void ** | value | ||
) |
Look up a signal property by index. To iterate all properties, call this function from index=0, increasing until it returns zero.
sig | The signal to check. |
index | Numerical index of a signal property. |
name | Address of a string pointer to receive the name of indexed property. May be zero. |
length | A pointer to a location to receive the vector length of the property value. (Required.) |
type | A pointer to a location to receive the type of the property value. (Required.) |
value | A pointer to a location to receive the address of the property's value. (Required.) |
void mapper_signal_push | ( | mapper_signal | sig | ) |
Push any property changes out to the network.
sig | The signal to operate on. |
mapper_signal* mapper_signal_query_copy | ( | mapper_signal * | query | ) |
Copy a previously-constructed signal query.
query | The previous signal record pointer. |
mapper_signal* mapper_signal_query_difference | ( | mapper_signal * | query1, |
mapper_signal * | query2 | ||
) |
Get the difference between two signal queries (signals matching query1 but NOT query2).
query1 | The first signal query. |
query2 | The second signal query. |
void mapper_signal_query_done | ( | mapper_signal * | query | ) |
Given a signal record pointer returned from a previous signal query, indicate that we are done iterating.
query | The previous signal record pointer. |
mapper_signal mapper_signal_query_index | ( | mapper_signal * | query, |
int | index | ||
) |
Given a signal record pointer returned from a previous signal query, get an indexed item in the list.
query | The previous signal record pointer. |
index | The index of the list element to retrieve. |
mapper_signal* mapper_signal_query_intersection | ( | mapper_signal * | query1, |
mapper_signal * | query2 | ||
) |
Get the intersection of two signal queries (signals matching query1 AND query2).
query1 | The first signal query. |
query2 | The second signal query. |
mapper_signal* mapper_signal_query_next | ( | mapper_signal * | query | ) |
Given a signal record pointer returned from a previous signal query, get the next item in the list.
query | The previous signal record pointer. |
int mapper_signal_query_remotes | ( | mapper_signal | sig, |
mapper_timetag_t | tt | ||
) |
Query the values of any signals connected via mapping connections.
sig | A local output signal. We will be querying the remote ends of this signal's mapping connections. |
tt | A timetag to be attached to the outgoing query. Query responses should also be tagged with this time. |
mapper_signal* mapper_signal_query_union | ( | mapper_signal * | query1, |
mapper_signal * | query2 | ||
) |
Get the union of two signal queries (signals matching query1 OR query2).
query1 | The first signal query. |
query2 | The second signal query. |
float mapper_signal_rate | ( | mapper_signal | sig | ) |
Get the update rate for a specific signal.
sig | The signal to check. |
void mapper_signal_remove_instance | ( | mapper_signal | sig, |
mapper_id | instance | ||
) |
Remove a specific instance of a signal and free its memory.
sig | The signal to operate on. |
instance | The identifier of the instance to suspend. |
int mapper_signal_remove_property | ( | mapper_signal | sig, |
const char * | name | ||
) |
Remove a property of a signal.
sig | The signal to operate on. |
name | The name of the property to remove. |
int mapper_signal_reserve_instances | ( | mapper_signal | sig, |
int | num, | ||
mapper_id * | ids, | ||
void ** | user_data | ||
) |
Add new instances to the reserve list. Note that if instance ids are specified, libmapper will not add multiple instances with the same id.
sig | The signal to which the instances will be added. |
num | The number of instances to add. |
ids | Array of integer ids, one for each new instance, or 0 for automatically-generated instance ids. |
user_data | Array of user context pointers, one for each new instance, or 0 if not needed. |
mapper_id mapper_signal_reserved_instance_id | ( | mapper_signal | sig, |
int | index | ||
) |
Get a reserved signal instance's ID by its index. Intended to be used for iterating over the reserved instances.
sig | The signal to operate on. |
index | The numerical index of the ID to retrieve. Should be between zero and the number of instances. |
void mapper_signal_set_callback | ( | mapper_signal | sig, |
mapper_signal_update_handler * | handler | ||
) |
Set or unset the message handler for a signal.
sig | The signal to operate on. |
handler | A pointer to a mapper_signal_update_handler function for processing incoming messages. |
void mapper_signal_set_description | ( | mapper_signal | sig, |
const char * | description | ||
) |
Set the description property for a specific signal.
sig | The signal to modify. |
description | The description value to set. |
void mapper_signal_set_group | ( | mapper_signal | sig, |
mapper_signal_group | group | ||
) |
Add a signal to a predefined signal group created using mapper_device_add_signal_group. Signals in the same group will have instance ids automatically coordinated. By default all signals are in the same (default) group.
sig | The signal to add. |
group | A signal group to associate with this signal, or 0 to reset to the default group. |
void mapper_signal_set_instance_event_callback | ( | mapper_signal | sig, |
mapper_instance_event_handler | h, | ||
int | flags | ||
) |
Set the handler to be called on signal instance management events.
sig | The signal to operate on. |
h | A handler function for instance management events. |
flags | Bitflags for indicating the types of events which should trigger the callback. Can be a combination of values from the enum mapper_instance_event. |
void mapper_signal_set_instance_stealing_mode | ( | mapper_signal | sig, |
mapper_instance_stealing_type | mode | ||
) |
Set the stealing method to be used when a previously-unseen instance ID is received and no instances are available.
sig | The signal to operate on. |
mode | Method to use for reallocating active instances if no reserved instances are available. |
void mapper_signal_set_maximum | ( | mapper_signal | sig, |
const void * | maximum | ||
) |
Set or remove the maximum of a signal.
sig | The signal to modify. |
maximum | Must be the same type as the signal, or 0 to remove the maximum. |
void mapper_signal_set_minimum | ( | mapper_signal | sig, |
const void * | minimum | ||
) |
Set or remove the minimum of a signal.
sig | The signal to modify. |
minimum | Must be the same type as the signal, or 0 to remove the minimum. |
int mapper_signal_set_property | ( | mapper_signal | sig, |
const char * | name, | ||
int | length, | ||
char | type, | ||
const void * | value, | ||
int | publish | ||
) |
Set a property of a signal. Can be used to provide arbitrary metadata. Value pointed to will be copied.
sig | The signal to operate on. |
name | The name of the property to add. |
length | The length of value array. |
type | The property datatype. |
value | An array of property values. |
publish | 1 to publish property to network, 0 for local-only. |
void mapper_signal_set_rate | ( | mapper_signal | sig, |
float | rate | ||
) |
Set the rate of a signal.
sig | The signal to modify. |
rate | A rate for this signal in samples/second, or zero for non-periodic signals. |
void mapper_signal_set_unit | ( | mapper_signal | sig, |
const char * | unit | ||
) |
Set the unit of a signal.
sig | The signal to operate on. |
unit | The unit value to set. |
void mapper_signal_set_user_data | ( | mapper_signal | sig, |
const void * | user_data | ||
) |
Associate a signal or signal instance with an arbitrary pointer.
sig | The signal to operate on. |
user_data | A pointer to user data to be associated. |
mapper_signal_group mapper_signal_signal_group | ( | mapper_signal | sig | ) |
Retrieve the signal group from a given signal. Signals in the same group will have instance ids automatically coordinated. By default all signals are in the same (default) group.
sig | The signal to add. |
char mapper_signal_type | ( | mapper_signal | sig | ) |
Get the data type for a specific signal.
sig | The signal to check. |
const char* mapper_signal_unit | ( | mapper_signal | sig | ) |
Get the unit for a specific signal.
sig | The signal to check. |
void mapper_signal_update | ( | mapper_signal | sig, |
const void * | value, | ||
int | count, | ||
mapper_timetag_t | tt | ||
) |
Update the value of a signal. The signal will be routed according to external requests.
sig | The signal to update. |
value | A pointer to a new value for this signal. If the signal type is 'i', this should be int*; if the signal type is 'f', this should be float*. It should be an array at least as long as the signal's length property. |
count | The number of instances of the value that are being updated. For non-periodic signals, this should be 0 or
|
tt | The time at which the value update was aquired. If the value is MAPPER_NOW, libmapper will tag the value update with the current time. See mapper_device_start_queue() for more information on bundling multiple signal updates with the same timetag. |
void mapper_signal_update_double | ( | mapper_signal | sig, |
double | value | ||
) |
Update the value of a scalar signal of type double. This is a scalar equivalent to mapper_signal_update(), for when passing by value is more convenient than passing a pointer. The signal will be routed according to external requests.
sig | The signal to update. |
value | A new scalar value for this signal. |
void mapper_signal_update_float | ( | mapper_signal | sig, |
float | value | ||
) |
Update the value of a scalar signal of type float. This is a scalar equivalent to mapper_signal_update(), for when passing by value is more convenient than passing a pointer. The signal will be routed according to external requests.
sig | The signal to update. |
value | A new scalar value for this signal. |
void mapper_signal_update_int | ( | mapper_signal | sig, |
int | value | ||
) |
Update the value of a scalar signal of type int. This is a scalar equivalent to mapper_signal_update(), for when passing by value is more convenient than passing a pointer. The signal will be routed according to external requests.
sig | The signal to update. |
value | A new scalar value for this signal. |
void* mapper_signal_user_data | ( | mapper_signal | sig | ) |
Retrieve the arbitrary pointer associated with a signal instance.
sig | The signal to operate on. |
const void* mapper_signal_value | ( | mapper_signal | sig, |
mapper_timetag_t * | tt | ||
) |
Get a signal's value.
sig | The signal to operate on. |
tt | A location to receive the value's time tag. May be 0. |