liblolowlevel(3)

๐Ÿ“ฆ
version 0.34 ยท 3 versions
, in fedora 44

โœจ NAME โœจ

okay so bestie, meet liblolowlevel(3) from the Library Functions Manual ๐Ÿ’– โ€” it's the Low-level OSC API. That's the whole name situation, and yes, it's giving foundational C library energy.

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

๐Ÿ“ฆ Data Structures ๐Ÿ“ฆ

  • struct lo_server_config โ€” a configuration struct for initializing lo_server using lo_server_new_from_config(). Think of it as the setup sheet before the main character server makes its entrance โœจ.

๐Ÿท๏ธ Typedefs ๐Ÿท๏ธ

  • typedef long double lo_hires โ€” type used to represent numerical values in conversions between OSC types. It's the numeric bestie for OSC type conversions, periodt ๐Ÿ’….

๐ŸŒˆ Enumerations ๐ŸŒˆ

  • enum lo_slip_encoding โ€” used with lo_address_set_stream_slip() to specify whether sent messages should be encoded with SLIP, and whether the encoding should be single- or double-ENDed. So it's the switch that decides SLIP encoding vibes and ENDing style ๐Ÿฆ‹.

Functions ๐Ÿ’–โœจ

okay so this is the actual menu of everything you can call, bestie. Every single one, no skips. Go get your snack, this is a long one. ๐Ÿ“

  • int lo_send_message (lo_address targ, const char *path, lo_message msg) โ€” yeets a lo_message object over to target targ. ๐Ÿš€
  • int lo_send_message_from (lo_address targ, lo_server serv, const char *path, lo_message msg) โ€” same energy, but the message goes to targ from the address of serv. it's giving "who's your sender" ๐Ÿ’…
  • int lo_send_bundle (lo_address targ, lo_bundle b) โ€” sends a lo_bundle object to address targ. bundle goes brrr ๐ŸŽ€
  • int lo_send_bundle_from (lo_address targ, lo_server serv, lo_bundle b) โ€” sends a lo_bundle object to address targ, except it's coming from the address of serv. ๐Ÿ˜Œ

  • lo_message lo_message_new (void) โ€” creates a brand new lo_message object. newborn icon ๐Ÿ‘ถโœจ
  • void lo_message_incref (lo_message m) โ€” adds one to a message's reference count. +1 bestie ๐Ÿ’–
  • int lo_message_decref (lo_message m) โ€” subtracts one from a message's reference count. bye girl ๐Ÿ‘‹
  • lo_message lo_message_clone (lo_message m) โ€” creates a new lo_message object by cloning one that already exists. literally its twin ๐Ÿชž
  • void lo_message_free (lo_message m) โ€” frees the memory allocated by lo_message_new() and any subsequent lo_message_add_int32 lo_message_add*() calls. clean up after yourself fr fr ๐Ÿงน
  • void lo_message_clear (lo_message m) โ€” clears the elements out of a lo_message but does not free the allocated memory. emptied, not evicted ๐Ÿซถ
  • int lo_message_add (lo_message m, const char *types,...) โ€” appends a number of arguments to a message. pile 'em on ๐Ÿ”ฅ
  • int lo_message_add_varargs (lo_message m, const char *types, va_list ap) โ€” appends a varargs list to a message. the varargs girlies ate ๐Ÿ’…

  • int lo_message_add_int32 (lo_message m, int32_t a) โ€” appends a data item and typechar of the specified type to a message. this one's the blueprint, everyone else points here ๐Ÿ‘‘
  • int lo_message_add_float (lo_message m, float a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_string (lo_message m, const char *a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_blob (lo_message m, lo_blob a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_int64 (lo_message m, int64_t a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_timetag (lo_message m, lo_timetag a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_double (lo_message m, double a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_symbol (lo_message m, const char *a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_char (lo_message m, char a) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_midi (lo_message m, uint8_t a[4]) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_true (lo_message m) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_false (lo_message m) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_nil (lo_message m) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details.
  • int lo_message_add_infinitum (lo_message m) โ€” appends a data item and typechar of the specified type to a message. see lo_message_add_int32() for details. infinite, literally โˆž ๐Ÿ˜ญ

  • lo_address lo_message_get_source (lo_message m) โ€” returns the source (lo_address) of an incoming message. who sent this?? ๐Ÿ“ฌ
  • lo_timetag lo_message_get_timestamp (lo_message m) โ€” returns the timestamp (lo_timetag *) of a bundled incoming message. when did this happen โฐ
  • char * lo_message_get_types (lo_message m) โ€” return the message type tag string. the receipts ๐Ÿงพ
  • int lo_message_get_argc (lo_message m) โ€” return the message argument count. how many arguments, bestie ๐Ÿ”ข
  • lo_arg ** lo_message_get_argv (lo_message m) โ€” return the message arguments. do not free the returned data. > hands off, it's not yours to free ๐Ÿ™ˆ
  • size_t lo_message_length (lo_message m, const char *path) โ€” return the length of a message in bytes. measuring tape out ๐Ÿ“
  • void * lo_message_serialise (lo_message m, const char *path, void *to, size_t *size) โ€” serialises the lo_message object to an area of memory and returns a pointer to the serialised form. it's the opposite of lo_message_deserialise(). glowed up into raw bytes โœจ
  • lo_message lo_message_deserialise (void *data, size_t size, int *result) โ€” deserialises a raw OSC message and returns a new lo_message object. opposite of lo_message_serialise(). raw bytes, but make it a message ๐Ÿ’ซ
  • int lo_server_dispatch_data (lo_server s, void *data, size_t size) โ€” dispatch a raw block of memory containing an OSC message. send it where it needs to go ๐Ÿƒโ€โ™€๏ธ

  • const char * lo_address_get_hostname (lo_address a) โ€” return the hostname of a lo_address object. where do you live ๐Ÿ 
  • const char * lo_address_get_port (lo_address a) โ€” return the port/service name of a lo_address object. which door ๐Ÿšช
  • int lo_address_get_protocol (lo_address a) โ€” return the protocol of a lo_address object. how do you travel ๐Ÿ›ผ
  • char * lo_address_get_url (lo_address a) โ€” return a URL representing an OSC address. link in bio ๐Ÿ”—
  • void lo_address_set_ttl (lo_address t, int ttl) โ€” set the Time-to-Live value for a given target address. how many hops before it gives up ๐Ÿ˜ต
  • int lo_address_get_ttl (lo_address t) โ€” get the Time-to-Live value for a given target address. same but read-only bestie ๐Ÿ‘€
  • int lo_address_set_iface (lo_address t, const char *iface, const char *ip) โ€” set the network interface to use for a given target address. pick your lane ๐Ÿ›ฃ๏ธ
  • const char * lo_address_get_iface (lo_address t) โ€” get the name of the network interface assigned to an OSC address. which lane tho ๐Ÿง
  • int lo_address_set_tcp_nodelay (lo_address t, int enable) โ€” set the TCP_NODELAY flag on outgoing TCP connections. no waiting around, we move fast โšก
  • int lo_address_set_stream_slip (lo_address t, lo_slip_encoding encoding) โ€” set outgoing stream connections (e.g., TCP) to be transmitted using the SLIP packetizing protocol. slipping into something comfy ๐Ÿฉฐ

  • lo_bundle lo_bundle_new (lo_timetag tt) โ€” create a new bundle object. bundle baby ๐ŸŽ
  • void lo_bundle_incref (lo_bundle b) โ€” add one to a bundle's reference count. +1 for the bundle ๐Ÿ’–
  • int lo_bundle_add_message (lo_bundle b, const char *path, lo_message m) โ€” adds an OSC message to an existing bundle. tuck it in ๐Ÿผ
  • int lo_bundle_add_bundle (lo_bundle b, lo_bundle n) โ€” adds an OSC bundle to an existing bundle. bundle-ception, nesting era ๐Ÿช†
  • size_t lo_bundle_length (lo_bundle b) โ€” return the length of a bundle in bytes. ๐Ÿ“
  • unsigned int lo_bundle_count (lo_bundle b) โ€” return the number of top-level elements in a bundle. top-level only, don't count the babies ๐Ÿ”ข
  • lo_element_type lo_bundle_get_type (lo_bundle b, int index) โ€” gets the element type contained within a bundle. what even are you ๐Ÿ‘€
  • lo_bundle lo_bundle_get_bundle (lo_bundle b, int index) โ€” gets a nested bundle contained within a bundle. the bundle inside the bundle ๐Ÿช†
  • lo_message lo_bundle_get_message (lo_bundle b, int index, const char **path) โ€” gets a message contained within a bundle. found her ๐Ÿ”
  • lo_timetag lo_bundle_get_timestamp (lo_bundle b) โ€” get the timestamp associated with a bundle. โฐ
  • void * lo_bundle_serialise (lo_bundle b, void *to, size_t *size) โ€” serialise the bundle object to an area of memory and return a pointer to the serialised form. bytes era โœจ
  • void lo_bundle_free (lo_bundle b) โ€” frees the memory taken by a bundle object. say bye ๐Ÿ‘‹
  • void lo_bundle_free_recursive (lo_bundle b) โ€” frees the memory taken by a bundle object and its messages and nested bundles recursively. the whole tree, gone, no crumbs ๐Ÿงน
  • void lo_bundle_free_messages (lo_bundle b) โ€” obsolete, use lo_bundle_free_recursive instead. > she's retired bestie, don't call her ๐Ÿ’€

  • int lo_is_numerical_type (lo_type a) โ€” return true if the type specified has a numerical value, such as LO_INT32, LO_FLOAT etc. is it math-coded ๐Ÿงฎ
  • int lo_is_string_type (lo_type a) โ€” return true if the type specified has a textual value, such as LO_STRING or LO_SYMBOL. is it word-coded ๐Ÿ“
  • int lo_coerce (lo_type type_to, lo_arg *to, lo_type type_from, lo_arg *from) โ€” attempt to convert one OSC type to another. glow-up transformation ๐Ÿ’…
  • lo_hires lo_hires_val (lo_type type, lo_arg *p) โ€” return the numerical value of the given argument with the maximum native system precision. maximum precision, no rounding, we're precise ๐Ÿ˜ค

  • lo_server lo_server_new (const char *port, lo_err_handler err_h) โ€” create a new server instance. hi server ๐Ÿซถ
  • lo_server lo_server_new_with_proto (const char *port, int proto, lo_err_handler err_h) โ€” create a new server instance, specifying protocol. same but you pick the protocol ๐Ÿ’…
  • lo_server lo_server_new_multicast (const char *group, const char *port, lo_err_handler err_h) โ€” create a new server instance, and join a UDP multicast group. joining the group chat fr fr ๐Ÿ“ข
  • lo_server lo_server_new_multicast_iface (const char *group, const char *port, const char *iface, const char *ip, lo_err_handler err_h) โ€” create a new server instance, and join a UDP multicast group, optionally specifying which network interface to use. note that usually only one of iface or ip are specified. pick one, not both, iykyk ๐Ÿ˜Œ
  • lo_server lo_server_new_from_url (const char *url, lo_err_handler err_h) โ€” create a new server instance, taking port and the optional multicast group IP from an URL string. everything from the link ๐Ÿ”—
  • lo_server lo_server_new_from_config (lo_server_config *config) โ€” create a new server instance, using a configuration struct. structured and organized ๐Ÿ’…
  • int lo_server_enable_coercion (lo_server server, int enable) โ€” enables or disables type coercion during message dispatch. on or off, your call ๐Ÿ”˜
  • void lo_server_free (lo_server s) โ€” free up memory used by the lo_server object. bye server ๐Ÿ‘‹

  • int lo_server_wait (lo_server s, int timeout) โ€” wait for an OSC message to be received. sitting pretty, waiting โŒ›
  • int lo_servers_wait (lo_server *s, int *status, int num_servers, int timeout) โ€” wait on multiple servers for an OSC message to be received. multitasking queen ๐Ÿ‘‘
  • int lo_server_recv_noblock (lo_server s, int timeout) โ€” look for an OSC message waiting to be received. peek, don't block ๐Ÿ‘€
  • int lo_servers_recv_noblock (lo_server *s, int *recvd, int num_servers, int timeout) โ€” look for an OSC message waiting to be received on multiple servers. peeking at all of them at once ๐Ÿ˜ญ
  • int lo_server_recv (lo_server s) โ€” block, waiting for an OSC message to be received. she will stand there until it arrives, periodt โœ‹

  • lo_method lo_server_add_method (lo_server s, const char *path, const char *typespec, lo_method_handler h, const void *user_data) โ€” add an OSC method to the specifed server. new method just dropped ๐ŸŽ‰
  • void lo_server_del_method (lo_server s, const char *path, const char *typespec) โ€” delete an OSC method from the specified server. method, you're fired ๐Ÿ’€
  • int lo_server_del_lo_method (lo_server s, lo_method m) โ€” delete a specific OSC method from the specified server. targeted removal, very specific ๐ŸŽฏ
  • int lo_server_add_bundle_handlers (lo_server s, lo_bundle_start_handler sh, lo_bundle_end_handler eh, void *user_data) โ€” add bundle notification handlers to the specified server. start AND end, both notified ๐Ÿ””
  • int lo_server_get_socket_fd (lo_server s) โ€” return the file descriptor of the server socket. the fd, hand it over ๐ŸŽซ
  • int lo_server_get_port (lo_server s) โ€” return the port number that the server has bound to. which port did she claim ๐Ÿšช

and bestie, we are NOT done, there's more coming, stay with me ๐Ÿ’œ

  • int lo_server_get_protocol (lo_server s) โ€” Returns the protocol that the server is using. slay ๐Ÿ’…
  • char * lo_server_get_url (lo_server s) โ€” Returns an OSC URL that can be used to contact the server. so handy ๐Ÿฆ‹
  • int lo_server_enable_queue (lo_server s, int queue_enabled, int dispatch_remaining) โ€” Toggle event queue. If queueing is enabled, timetagged messages that are sent in advance of the current time will be put on an internal queue, and they will be dispatched at the indicated time. By default, queueing is enabled. Use this function to disable it, if it is desired to have a server process messages immediately. In that case, use lo_message_get_timestamp() to get the message timestamp from within a method handler. time vibes โฐ
  • int lo_server_events_pending (lo_server s) โ€” Returns true if there are scheduled events (eg. from bundles) waiting to be dispatched by the server. eyes on the queue ๐Ÿ‘€
  • double lo_server_next_event_delay (lo_server s) โ€” Returns the time in seconds until the next scheduled event. countdown โณ
  • int lo_server_max_msg_size (lo_server s, int req_size) โ€” Set the maximum message size accepted by a server. size matters ๐Ÿ“
  • char * lo_url_get_protocol (const char *url) โ€” Returns the protocol portion of an OSC URL, eg. udp, tcp. protocol tea ๐Ÿ”—
  • int lo_url_get_protocol_id (const char *url) โ€” Returns the protocol ID of an OSC URL. ID check ๐Ÿ†”
  • char * lo_url_get_hostname (const char *url) โ€” Returns the hostname portion of an OSC URL. where you at ๐Ÿ 
  • char * lo_url_get_port (const char *url) โ€” Returns the port portion of an OSC URL. port numbers ๐Ÿ”Œ
  • char * lo_url_get_path (const char *url) โ€” Returns the path portion of an OSC URL. the path less traveled ๐Ÿ›ค๏ธ
  • int lo_strsize (const char *s) โ€” A function to calculate the amount of OSC message space required by a C char *. math but make it cute ๐Ÿ“
  • uint32_t lo_blobsize (lo_blob b) โ€” A function to calculate the amount of OSC message space required by a lo_blob object. blob math ๐Ÿงฎ
  • int lo_pattern_match (const char *str, const char *p) โ€” Test a string against an OSC pattern glob. matchmaker ๐ŸŽฏ
  • int lo_string_contains_pattern (const char *str) โ€” Test if a string contains any OSC pattern characters. detective work ๐Ÿ”
  • double lo_timetag_diff (lo_timetag a, lo_timetag b) โ€” Find the time difference between two timetags. time math โฑ๏ธ
  • void lo_timetag_now (lo_timetag *t) โ€” Return a timetag for the current time. right now โŒš
  • size_t lo_arg_size (lo_type type, void *data) โ€” Return the storage size, in bytes, of the given argument. size of arg ๐Ÿ“ฆ
  • char * lo_get_path (void *data, ssize_t size) โ€” Given a raw OSC message, return the message path. path reveal ๐Ÿ›ฃ๏ธ
  • void lo_arg_host_endian (lo_type type, void *data) โ€” Convert the specified argument to host byte order where necessary. endian switch ๐Ÿ 
  • void lo_arg_network_endian (lo_type type, void *data) โ€” Convert the specified argument to network byte order where necessary. network endian ๐ŸŒ

โœจ Detailed Description โœจ

Use these functions if you require more precise control over OSC message contruction or handling that what is provided in the high-level functions described in liblo. iykyk ๐Ÿ’–


๐Ÿ“š Typedef Documentation ๐Ÿ“š

typedef long double lo_hires

Type used to represent numerical values in conversions between OSC types.

Definition at line 56 of file lo_lowlevel.h. fancy precision โœจ


๐Ÿท๏ธ Enumeration Type Documentation ๐Ÿท๏ธ

enum lo_slip_encoding

Used with lo_address_set_stream_slip() to specify whether sent messages should be encoded with SLIP, and whether the encoding should be single- or double-ENDed.

Definition at line 85 of file lo_lowlevel.h. slip slidin' ๐Ÿ›ท


๐Ÿ› ๏ธ Function Documentation ๐Ÿ› ๏ธ

const char * lo_address_get_hostname (lo_address a)

Return the hostname of a lo_address object. Returned value must not be modified or free'd. Value will be a dotted quad, colon'd IPV6 address, or resolvable name. hostname tea ๐Ÿ 

const char * lo_address_get_iface (lo_address t)

Get the name of the network interface assigned to an OSC address. interface vibes ๐Ÿ–ฅ๏ธ

Parameters:

  • t โ€” An OSC address.

Returns:

  • A string pointer or 0 if no interface has been assigned. Caller should not modify the provided string. It is a legal pointer until the next call to lo_address_set_iface or lo_address_free. don't touch ๐Ÿ™…โ€โ™€๏ธ

const char * lo_address_get_port (lo_address a)

Return the port/service name of a lo_address object. Returned value must not be modified or free'd. Value will be a service name or ASCII representation of the port number. port please ๐Ÿ”Œ

int lo_address_get_protocol (lo_address a)

Return the protocol of a lo_address object. Returned value will be one of LO_UDP, LO_TCP or LO_UNIX. protocol check ๐Ÿ”—

int lo_address_get_ttl (lo_address t)

Get the Time-to-Live value for a given target address. TTL baby โณ

Parameters:

  • t โ€” An OSC address.

Returns:

  • An integer specifying the scope of a multicast UDP message. scope it out ๐ŸŒ

char * lo_address_get_url (lo_address a)

Return a URL representing an OSC address. Returned value must be free'd. free it later ๐Ÿ—‘๏ธ

int lo_address_set_iface (lo_address t, const char * iface, const char * ip)

Set the network interface to use for a given target address. The caller should specify either the iface or ip variable. The IP, if specified, should match the same network family as the OSC address. (That is, should correctly correspond to IPv4 or IPv6.) Typically the assigned network interface will only be used in the case of sending multicast messages. It is recommended to use the if_nameindex POSIX function to get a list of network interface names. interface assignment ๐Ÿ› ๏ธ

Parameters:

  • t โ€” An OSC address.
  • iface โ€” The name of a network interface on the local system.
  • ip โ€” The IP address of a network interface on the local system.

Returns:

  • 0 if the interface was successfully identified, or non-zero otherwise. zero is good โœ…

int lo_address_set_stream_slip (lo_address t, lo_slip_encoding encoding)

Set outgoing stream connections (e.g., TCP) to be transmitted using the SLIP packetizing protocol. slip it ๐Ÿ›ท

Parameters:

  • t โ€” The address to set this flag for.
  • encoding โ€” Specify single- or double-ENDed SLIP, or disable SLIP.

Returns:

  • the previous value of this flag. flag history ๐Ÿšฉ

int lo_address_set_tcp_nodelay (lo_address t, int enable)

Set the TCP_NODELAY flag on outgoing TCP connections. no delay โšก

Parameters:

  • t โ€” The address to set this flag for.
  • enable โ€” Non-zero to set the flag, zero to unset it.

Returns:

  • the previous value of this flag. flag check ๐Ÿšฉ

void lo_address_set_ttl (lo_address t, int ttl)

Set the Time-to-Live value for a given target address. This is required for sending multicast UDP messages. A value of 1 (the usual case) keeps the message within the subnet, while 255 means a global, unrestricted scope. TTL rules ๐ŸŒ

Parameters:

  • t โ€” An OSC address.
  • ttl โ€” An integer specifying the scope of a multicast UDP message.

void lo_arg_host_endian (lo_type type, void * data)

Convert the specified argument to host byte order where necessary. endian flip ๐Ÿ”„

Parameters:

  • type โ€” The OSC type of the data item (eg. LO_FLOAT).
  • data โ€” A pointer to the data item to be converted. It is changed in-place.

void lo_arg_network_endian (lo_type type, void * data)

Convert the specified argument to network byte order where necessary. network flip ๐ŸŒ

Parameters:

  • type โ€” The OSC type of the data item (eg. LO_FLOAT).
  • data โ€” A pointer to the data item to be converted. It is changed in-place.

size_t lo_arg_size (lo_type type, void * data)

Return the storage size, in bytes, of the given argument. size it ๐Ÿ“

uint32_t lo_blobsize (lo_blob b)

A function to calculate the amount of OSC message space required by a lo_blob object. Returns the storage size in bytes, which will always be a multiple of four. blob math ๐Ÿงฎ

int lo_bundle_add_bundle (lo_bundle b, lo_bundle n)

Adds an OSC bundle to an existing bundle. The child bundle passed is appended to the list of child bundles|messages in the parent bundle to be dispatched. bundle inception ๐ŸŽ

Returns:

  • 0 if successful, less than 0 otherwise. zero or bust โœ…

int lo_bundle_add_message (lo_bundle b, const char * path, lo_message m)

Adds an OSC message to an existing bundle. The message passed is appended to the list of messages in the bundle to be dispatched to 'path'. message drop ๐Ÿ“จ

Returns:

  • 0 if successful, less than 0 otherwise. success vibes โœ…

unsigned int lo_bundle_count (lo_bundle b)

Return the number of top-level elements in a bundle. count 'em ๐Ÿ”ข

Parameters:

  • b โ€” The bundle to be counted.

void lo_bundle_free (lo_bundle b)

Frees the memory taken by a bundle object. free it ๐Ÿ—‘๏ธ

Parameters:

  • b โ€” The bundle to be freed.

void lo_bundle_free_messages (lo_bundle b)

Obsolete, use lo_bundle_free_recursive instead. old and busted โš ๏ธ

Parameters:

  • b โ€” The bundle, which may contain messages and nested bundles, to be freed.

void lo_bundle_free_recursive (lo_bundle b)

Frees the memory taken by a bundle object and its messages and nested bundles recursively. deep free ๐ŸŒ€

Parameters:

  • b โ€” The bundle, which may contain messages and nested bundles, to be freed.

lo_bundle lo_bundle_get_bundle (lo_bundle b, int index)

Gets a nested bundle contained within a bundle. Returns a lo_bundle at a given index within a bundle. nested bundle ๐ŸŽ

Returns:

  • The requested lo_bundle if successful, otherwise 0. get it โœ…

lo_message lo_bundle_get_message (lo_bundle b, int index, const char ** path)

Gets a message contained within a bundle. Returns a lo_message at a given index within a bundle, and optionally the path associated with that message. message extraction ๐Ÿ“ฉ

Returns:

  • The requested lo_message if successful, otherwise 0. got it โœ…

lo_timetag lo_bundle_get_timestamp (lo_bundle b)

Get the timestamp associated with a bundle. timestamp tea โฑ๏ธ

Parameters:

  • b โ€” The bundle for which the timestamp should be returned.

Returns:

  • The timestamp of the bundle as a lo_timetag. time stamp ๐Ÿ•ฐ๏ธ

lo_element_type lo_bundle_get_type (lo_bundle b, int index)

Gets the element type contained within a bundle. Returns a lo_element_type at a given index within a bundle. type check ๐Ÿ”

Returns:

  • The requested lo_element_type if successful, otherwise 0. type vibes โœ…

void lo_bundle_incref (lo_bundle b)

Add one to a bundle's reference count. Bundles are reference counted. If a bundle is multiply referenced, the bundle's counter should be incremented. It is automatically decremented by lo_bundle_free lo_bundle_free_recursive, with lo_bundle_free_recursive being the preferable method. ref count ๐Ÿ”ข

size_t lo_bundle_length (lo_bundle b)

Return the length of a bundle in bytes. Includes the marker and typetag length. length check ๐Ÿ“

Parameters:

  • b โ€” The bundle to be sized

lo_bundle lo_bundle_new (lo_timetag tt)

Create a new bundle object. OSC Bundles encapsulate one or more OSC messages and may include a timestamp indicating when the bundle should be dispatched. new bundle who dis ๐ŸŽ

Parameters:

  • tt โ€” The timestamp when the bundle should be handled by the receiver. Pass LO_TT_IMMEDIATE if you want the receiving server to dispatch the bundle as soon as it receives it.

void * lo_bundle_serialise (lo_bundle b, void * to, size_t * size)

Serialise the bundle object to an area of memory and return a pointer to the serialised form. serialise it ๐Ÿ“ฆ

โ€ฆand we're still deep in that parameter list from the serialise situation, so let's finish it off bestie:

  • b โ€” the bundle to be serialised ๐ŸŽ€
  • to โ€” the address to serialise to, memory will be allocated if to is NULL. yes, it just gives you memory, iconic behaviour.
  • size โ€” if this pointer is non-NULL the size of the memory area will be written here

The returned form is suitable to be sent over a low level OSC transport, having the correct endianess and bit-packed structure. it's giving "ready to ship, no notes" โœจ


int lo_coerce (lo_type type_to, lo_arg * to, lo_type type_from, lo_arg * from)

Attempt to convert one OSC type to another. So numerical types (eg. LO_INT32, LO_FLOAT etc.) may be converted to other numerical types, and string types (LO_STRING and LO_SYMBOL) may be converted to the other type. ๐Ÿฆ‹

This is done automatically if a received message matches the path, but not the exact types, and is coercible (ie. all numerical types in numerical positions). The library is literally doing the vibes-matching for you.

On failure no translation occurs and false is returned. no translation, no crumbs, just false ๐Ÿ’€

Parameters

  • type_to โ€” the type of the destination variable.
  • to โ€” a pointer to the destination variable.
  • type_from โ€” the type of the source variable.
  • from โ€” a pointer to the source variable.

char * lo_get_path (void * data, ssize_t size)

Given a raw OSC message, return the message path. ๐Ÿ›ฃ๏ธ

Parameters

  • data โ€” a pointer to the raw OSC message data.
  • size โ€” the size of data in bytes (total buffer bytes).

Returns the message path or NULL if an error occurs. Do not free() the returned pointer. it's not yours, it's borrowed, hands off ๐Ÿ™ˆ


lo_hires lo_hires_val (lo_type type, lo_arg * p)

Return the numerical value of the given argument with the maximum native system precision. maximum precision, maximum slay ๐Ÿ”ฅ


int lo_is_numerical_type (lo_type a)

Return true if the type specified has a numerical value, such as LO_INT32, LO_FLOAT etc. ๐Ÿ”ข

Parameters

  • a โ€” the type to be tested.

int lo_is_string_type (lo_type a)

Return true if the type specified has a textual value, such as LO_STRING or LO_SYMBOL. ๐Ÿ”ค

Parameters

  • a โ€” the type to be tested.

int lo_message_add (lo_message m, const char * types, ...)

Append a number of arguments to a message. The data will be added in OSC byteorder (bigendian). bigendian, we respect her ๐Ÿ’œ

Parameters

  • m โ€” the message to be extended.
  • types โ€” the types of the data items in the message, types are defined in lo_types_common.h
  • ... โ€” the data values to be transmitted. The types of the arguments passed here must agree with the types specified in the type parameter. they MUST agree, this is not a vibe-based negotiation

Returns

  • Less than 0 on failure, 0 on success. โœจ

int lo_message_add_blob (lo_message m, lo_blob a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐Ÿซถ

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_char (lo_message m, char a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐ŸŽ€

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_double (lo_message m, double a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐Ÿ’ซ

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_false (lo_message m)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. no arguments, just vibes and a false

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_float (lo_message m, float a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐ŸŒธ

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_infinitum (lo_message m)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. โ™พ๏ธ it's giving infinity, literally in the name

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_int32 (lo_message m, int32_t a)

Append a data item and typechar of the specified type to a message. The data will be added in OSC byteorder (bigendian). โญ this is the blueprint, the moment, the template all the other add girls reference

Parameters

  • m โ€” the message to be extended.
  • a โ€” the data item.

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_int64 (lo_message m, int64_t a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐Ÿฆ‹

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_midi (lo_message m, uint8_t a[4])

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐ŸŽน four whole bytes of MIDI, cute

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_nil (lo_message m)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐Ÿ’€ nil, the void, the nothingness, iconic

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_string (lo_message m, const char * a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐Ÿ“

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_symbol (lo_message m, const char * a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. ๐ŸŽ€

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_timetag (lo_message m, lo_timetag a)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. โฐ

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_true (lo_message m)

Append a data item and typechar of the specified type to a message. See lo_message_add_int32() for details. โœ…

Returns

  • Less than 0 on failure, 0 on success.

int lo_message_add_varargs (lo_message m, const char * types, va_list ap)

Append a varargs list to a message. The data will be added in OSC byteorder (bigendian).

IMPORTANT: args list must be terminated with LO_ARGS_END, or this call will fail. This is used to do simple error checking on the sizes of parameters passed. do not forget LO_ARGS_END. do NOT. it will fail and you will be sad. ๐Ÿ˜ญ

Parameters

  • m โ€” the message to be extended.
  • types โ€” the types of the data items in the message, types are defined in lo_types_common.h
  • ap โ€” the va_list created by a C function declared with an ellipsis (...) argument, and pre-initialised with "va_start(ap)". The types of the arguments passed here must agree with the types specified in the type parameter.

Returns

  • Less than 0 on failure, 0 on success.

void lo_message_clear (lo_message m)

Clear elements from a lo_message but do not free allocated memory. ๐Ÿงน cleared, but the memory is still there living its life โ€” this is not a free


lo_message lo_message_clone (lo_message m)

Create a new lo_message object by cloning an already existing one. ๐Ÿซถ two of them. twins. matching energy.


int lo_message_decref (lo_message m)

Subtract one from a message's reference count. Messages are reference counted. In general decrementing the counter should be handled automatically using lo_message_free or lo_bundle_free_recursive, however if necessary the counter can be decremented manually. ๐Ÿ’… you can do it by hand, but like, why would you when the automatic way exists


lo_message lo_message_deserialise (void * data, size_t size, int * result)

Deserialise a raw OSC message and return a new lo_message object. Opposite of lo_message_serialise(). ๐Ÿ”„

Parameters

  • data โ€” pointer to the raw OSC message data in network transmission form (network byte order where appropriate).
  • size โ€” the size of data in bytes
  • result โ€” if this pointer is non-NULL, the result or error code will be written here.

Returns a new lo_message, or NULL if deserialisation fails. Use lo_message_free() to free the resulting object. and yes, you HAVE to free it. it's yours now, you're responsible. ๐Ÿ‘‘


void lo_message_free (lo_message m)

Free memory allocated by lo_message_new() and any subsequent lo_message_add_int32 lo_message_add*() calls. ๐Ÿ—‘๏ธ closure, finally


int lo_message_get_argc (lo_message m)

Return the message argument count. The result is valid until further data is added with lo_message_add*(). โš ๏ธ valid until you add more stuff โ€” it is not forever, bestie


lo_arg ** lo_message_get_argv (lo_message m)

Return the message arguments. Do not free the returned data. The result is valid until further data is added with lo_message_add*(). ๐Ÿ™ˆ borrowed data, hands off, and again: only valid until the next lo_message_add*()


lo_address lo_message_get_source (lo_message m)

Returns the source (lo_address) of an incoming message. Returns NULL if the message is outgoing. Do not free the returned address.

This is usually called on the lo_message passed to lo_method_handler, to set up bidirectional communication. See example_tcp_echo_server.c for an example of this. ๐ŸŒˆ this is the one that lets you talk BACK, two-way conversation energy


lo_timetag lo_message_get_timestamp (lo_message m)

Returns the timestamp (lo_timetag *) of a bundled incoming message. Returns LO_TT_IMMEDIATE if the message is outgoing, or did not arrive contained in a bundle. Do not free the returned timetag. โฑ๏ธ


char * lo_message_get_types (lo_message m)

Return the message type tag string. The result is valid until further data is added with lo_message_add*(). ๐Ÿท๏ธ same rule as always: valid until the next add


void lo_message_incref (lo_message m)

Add one to a message's reference count. Messages are reference counted. If a message is multiply referenced, the message's counter should be incremented. It is automatically decremented by lo_message_free or lo_bundle_free_recursive, with lo_bundle_free_recursive being the preferable method if bundles are used. ๐Ÿ‘‘ multiply referenced = increment. that's the whole tea.


size_t lo_message_length (lo_message m, const char * path)

Return the length of a message in bytes. ๐Ÿ“

Parameters

  • m โ€” the message to be sized
  • path โ€” the path the message will be sent to

lo_message lo_message_new (void )

Create a new lo_message object. โœจ fresh out the box, brand new, no notes


void * lo_message_serialise (lo_message m, const char * path, void * to, size_t * size)

Serialise the lo_message object to an area of memory and return a pointer to the serialised form. Opposite of lo_message_deserialise(). ๐Ÿ”„

Parameters

  • m โ€” the message to be serialised
  • path โ€” the path the message will be sent to
  • to โ€” the address to serialise to, memory will be allocated if to is NULL.
  • size โ€” if this pointer is non-NULL the size of the memory area will be written here

The returned form is suitable to be sent over a low level OSC transport, having the correct endianess and bit-packed structure. ๐Ÿ’–


int lo_pattern_match (const char * str, const char * p)

Test a string against an OSC pattern glob. ๐ŸŒธ

Parameters

  • str โ€” the string to test
  • p โ€” the pattern to test against

Returns

  • 1 if true, 0 otherwise. one or zero, that's it, that's the answer

int lo_send_bundle (lo_address targ, lo_bundle b)

Send a lo_bundle object to address targ. Bundles are constructed with the lo_bundle_new() and lo_bundle_add_message() functions. ๐ŸŽ you gotta BUILD the bundle first, this girl only ships it


int lo_send_bundle_from (lo_address targ, lo_server serv, lo_bundle b)

Send a lo_bundle object to address targ from address of serv. Bundles are constructed with the lo_bundle_new() and lo_bundle_add_message() functions. ๐Ÿš€

Parameters

  • targ โ€” the address to send the bundle to
  • serv โ€” the server socket to send the bundle from (can be NULL to use new socket)
  • b โ€” the bundle itself

lo_send_message()

int lo_send_message (lo_address targ, const char * path, lo_message msg)

okay so bestie, this one ships a whole lo_message object off to the target targ ๐ŸŽ€. It's slightly more efficient than lo_send() when you're sending a lot of similar messages โ€” which, if that's your whole vibe, slay. You build those messages with the lo_message_new() and lo_message_add*() functions. ๐Ÿ’…


lo_send_message_from()

int lo_send_message_from (lo_address targ, lo_server serv, const char * path, lo_message msg)

same energy as above but it sends a lo_message object to targ from the address of serv โœจ. Also slightly more efficient than lo_send() when you've got a whole pile of similar messages to push out. Messages get built with lo_message_new() and lo_message_add*(). ๐Ÿ’–

Parameters

  • targ โ€” the address you're sending the message to ๐Ÿซถ
  • serv โ€” the server socket to send the message from (can be NULL to use a new socket) ๐Ÿฆ‹
  • path โ€” the path to send the message to
  • msg โ€” the bundle itself ๐Ÿ‘‘

lo_server_add_bundle_handlers()

int lo_server_add_bundle_handlers (lo_server s, lo_bundle_start_handler sh, lo_bundle_end_handler eh, void * user_data)

adds bundle notification handlers to the server you point at, no cap ๐Ÿ””. You get told when a bundle starts and when it's done, which is very main-character of you.

Parameters

  • s โ€” the server the method is to be added to ๐ŸŒธ
  • sh โ€” the callback function that gets called before the messages of a bundle are dispatched
  • eh โ€” the callback function that gets called after the messages of a bundle are dispatched
  • user_data โ€” a value that gets passed to the user_data parameter of both callback functions ๐Ÿ’œ

lo_server_add_method()

lo_method lo_server_add_method (lo_server s, const char * path, const char * typespec, lo_method_handler h, const void * user_data)

registers an OSC method on the specified server โœจ iconic behaviour honestly.

Parameters

  • s โ€” the server the method is to be added to ๐ŸŽ€
  • path โ€” the OSC path to register the method to. If NULL is passed, the method will match all paths ๐Ÿ‘‘
  • typespec โ€” the typespec the method accepts. Incoming messages with similar typespecs (e.g. ones with numerical types in the same position) will be coerced to the typespec given here ๐Ÿฆ‹
  • h โ€” the method handler callback function that gets called if a matching message is received ๐Ÿ’–
  • user_data โ€” a value that gets passed to the callback function h when it's invoked matching from this method ๐Ÿซถ

Returns

A unique pointer identifying the method. > It should not be freed. ๐Ÿ’€ do NOT free it bestie, I'm begging.


lo_server_del_lo_method()

int lo_server_del_lo_method (lo_server s, lo_method m)

deletes one specific OSC method from the server you name ๐Ÿงน bye girl.

Parameters

  • s โ€” the server the method is to be removed from
  • m โ€” the lo_method identifier returned from lo_server_add_method for the method to delete from the server ๐ŸŒธ

Returns

Non-zero if it was not found in the list of methods for the server. ๐Ÿ’€


lo_server_del_method()

void lo_server_del_method (lo_server s, const char * path, const char * typespec)

deletes an OSC method from the server you specify ๐Ÿฆ‹.

Parameters

  • s โ€” the server the method is to be removed from
  • path โ€” the OSC path of the method to delete. If NULL is passed, the method will match the generic handler โœจ
  • typespec โ€” the typespec the method accepts ๐Ÿ’œ

lo_server_dispatch_data()

int lo_server_dispatch_data (lo_server s, void * data, size_t size)

dispatches a raw block of memory that contains an OSC message ๐Ÿ“ฆ. This is genuinely so useful: if you've got a raw block of memory sitting there structured as OSC, and you want liblo to dispatch the message to a handler function as if it had been received over the network, this is your girl. ๐Ÿ’…

Parameters

  • s โ€” the lo_server to use for dispatching
  • data โ€” pointer to the raw OSC message data in network transmission form (network byte order where appropriate) ๐ŸŒˆ
  • size โ€” the size of data in bytes

Returns the number of bytes used if successful, or less than 0 otherwise. ๐Ÿ˜ญ


lo_server_enable_coercion()

int lo_server_enable_coercion (lo_server server, int enable)

turns type coercion during message dispatch on or off ๐ŸŽš๏ธ.

Parameters

  • server โ€” the server to toggle this option for
  • enable โ€” non-zero to enable, or zero to disable type coercion โœจ

Returns

The previous value of this option ๐Ÿ‘‘


lo_server_enable_queue()

int lo_server_enable_queue (lo_server s, int queue_enabled, int dispatch_remaining)

toggles the event queue ๐Ÿ•ฐ๏ธ. If queueing is enabled, timetagged messages sent in advance of the current time get put on an internal queue and dispatched at the indicated time. By default, queueing is enabled. Use this function to disable it if you want the server to process messages immediately โ€” in that case, use lo_message_get_timestamp() to get the message timestamp from within a method handler. ๐Ÿฆ‹

Parameters

  • s โ€” a liblo server
  • queue_enabled โ€” zero to disable queue, non-zero to enable
  • dispatch_remaining โ€” if non-zero, previously queued messages will be immediately dispatched when the queue is disabled โšก

Returns

The previous state of queue behaviour. Zero if queueing was previously disabled, non-zero otherwise ๐Ÿ’œ


lo_server_events_pending()

int lo_server_events_pending (lo_server s)

returns true if there are scheduled events (eg. from bundles) waiting to be dispatched by the server ๐Ÿ‘€โœจ


lo_server_free()

void lo_server_free (lo_server s)

frees up the memory used by the lo_server object ๐Ÿงน๐Ÿซถ

๐Ÿ“Ž Referenced by lo::Server::~Server().

lo_server_get_port()

int lo_server_get_port (lo_server s)

returns the port number the server has bound to ๐Ÿ”ข. Super handy when you passed NULL for the port number and now you're sitting there like "okay but how do I even address this server" โ€” this tells you. ๐Ÿ’…


lo_server_get_protocol()

int lo_server_get_protocol (lo_server s)

returns the protocol the server is using ๐ŸŒ. The value you get back will be one of LO_UDP, LO_TCP or LO_UNIX.


lo_server_get_socket_fd()

int lo_server_get_socket_fd (lo_server s)

returns the file descriptor of the server socket ๐ŸŽ€. If the server protocol supports exposing the server's underlying receive mechanism for monitoring with select() or poll(), this function returns the file descriptor you need โ€” otherwise it returns -1. ๐Ÿ˜ญ

โš ๏ธ WARNING: when you use this function, beware that not all OSC packets that are received are dispatched immediately. lo_server_events_pending() and lo_server_next_event_delay() can be used to tell if there are pending events and how long before you should attempt to receive them. ๐Ÿ‘‘

lo_server_get_url()

char * lo_server_get_url (lo_server s)

returns an OSC URL you can use to contact the server ๐Ÿ”—โœจ. The return value should be free()'d when it's no longer needed โ€” don't be a memory leaker bestie, that's not the vibe. ๐Ÿ’…


lo_server_max_msg_size()

int lo_server_max_msg_size (lo_server s, int req_size)

sets the maximum message size the server will accept ๐Ÿ“. For UDP servers, the maximum message size cannot exceed 64k, thanks to the UDP transport specifications. For TCP servers the number can be larger, but be aware that one or more contiguous blocks of memory of this size may be allocated by liblo โ€” at least one per connection. ๐Ÿ˜ญ

Parameters

  • s โ€” the server on which to operate
  • req_size โ€” the new maximum message size to request, 0 if it should not be modified, or -1 if it should be set to unlimited. > ๐Ÿ’€ Note that an unlimited message buffer may make your application open to a denial of service attack.

Returns

The new maximum message size is returned, which may or may not be equal to req_size. If -1 is returned, maximum size is unlimited. ๐Ÿฆ‹


lo_server_new()

lo_server lo_server_new (const char * port, lo_err_handler err_h)

creates a shiny new server instance โœจ. Using lo_server_recv(), lo_servers block until they receive OSC messages โ€” which, ngl, is usually not what you want. Most likely you're after non-blocking behaviour, so use of lo_server_recv_noblock() is encouraged, or go with the lo_server_thread_new and "lo_server_thread_*" functions. ๐Ÿ’…

Parameters

  • port โ€” if NULL is passed, then an unused UDP port will be chosen by the system, and its number may be retrieved with lo_server_thread_get_port() so it can be passed to clients ๐ŸŽ€. Otherwise a decimal port number, service name or UNIX domain socket path may be passed ๐ŸŒธ
  • err_h โ€” an error callback function that will be called if there is an error in message reception or server creation. Pass NULL if you do not want error handling ๐Ÿ™ˆ
๐Ÿ“Ž Referenced by lo::Server::Server(), and lo::Server::Server().

lo_server_new_from_config()

lo_server lo_server_new_from_config (lo_server_config * config)

creates a new server instance, using a configuration struct ๐Ÿ› ๏ธโœจ.

Parameters

  • config โ€” a pre-initialized config struct. > ๐Ÿ’œ A pointer to it will not be kept.

Returns

A new lo_server instance ๐Ÿ‘‘


lo_server_new_from_url()

lo_server lo_server_new_from_url (const char * url, lo_err_handler err_h)

creates a new server instance, taking the port and the optional multicast group IP from an URL string ๐Ÿ”—๐ŸŒˆ.

Parameters

  • url โ€” the URL to specify the server parameters
  • err_h โ€” an error callback function that will be called if there is an error in message reception or server creation. Pass NULL if you do not want error handling ๐Ÿ™ˆ

Returns

A new lo_server instance ๐ŸŽ€


lo_server_new_multicast()

lo_server lo_server_new_multicast (const char * group, const char * port, lo_err_handler err_h)

creates a new server instance and joins a UDP multicast group ๐Ÿซ‚โœจ iconic.

Parameters

  • group โ€” the multicast group to join. See documentation on IP multicast for the acceptable address range; e.g., http://tldp.org/HOWTO/Multicast-HOWTO-2.html ๐ŸŒ
  • port โ€” if using UDP then NULL may be passed to find an unused port. Otherwise a decimal port number or service name may be passed. If using UNIX domain sockets then a socket path should be passed here ๐Ÿฆ‹
  • err_h โ€” an error callback function that will be called if there is an error in message reception or server creation. Pass NULL if you do not want error handling ๐Ÿ™ˆ
๐Ÿ“Ž Referenced by lo::Server::Server().

lo_server_new_multicast_iface()

lo_server lo_server_new_multicast_iface (const char * group, const char * port, const char * iface, const char * ip, lo_err_handler err_h)

creates a new server instance and joins a UDP multicast group, optionally specifying which network interface to use ๐Ÿ’…. > ๐Ÿ“Œ Note that usually only one of iface or ip are specified.

Parameters

  • group โ€” the multicast group to join. See documentation on IP multicast for the acceptable address range; e.g., http://tldp.org/HOWTO/Multicast-HOWTO-2.html ๐ŸŒ
  • port โ€” if using UDP then NULL may be passed to find an unused port. Otherwise a decimal port number or service name may be passed. If using UNIX domain sockets then a socket path should be passed here ๐Ÿฆ‹
  • iface โ€” a string specifying the name of a network interface to use, or zero if not specified ๐ŸŽ€
  • ip โ€” a string specifying the IP address of a network interface to use, or zero if not specified โญ
  • err_h โ€” an error callback function that will be called if there is an error in message reception or server creation. Pass NULL if you do not want error handling ๐Ÿ™ˆ
๐Ÿ“Ž Referenced by lo::Server::Server(), and lo::Server::Server().

๐Ÿ’ซ lo_server_new_with_proto

lo_server lo_server_new_with_proto (const char * port, int proto,
    lo_err_handler err_h)

okay so bestie, this is where you build a whole new server instance and you get to say which protocol it speaks. periodt. here's the thing though โ€” if you use lo_server_recv(), your lo_servers are gonna block until an OSC message shows up, which is giving "waiting by the phone forever" energy ๐Ÿ˜ญ. most likely you want the non-blocking vibe, so the docs are literally begging you to use lo_server_recv_noblock() or go hang out with lo_server_thread_new and all the lo_server_thread_* functions instead. ๐Ÿ‘‘

Parameters

  • port โ€” if you're doing UDP, you can pass NULL and it'll find an unused port for you, iconic. otherwise pass a decimal port number or a service name, or... a socket path, if you're on UNIX domain sockets. slay.
  • proto โ€” the protocol, and it should be one of LO_UDP, LO_TCP or LO_UNIX. pick your fighter.
  • err_h โ€” an error callback function that gets called if something goes wrong with message reception or server creation. pass NULL if you do not want error handling (bold move, but okay ๐Ÿซถ).

Referenced by lo::Server::Server(), and lo::Server::Server(). (yes it's listed twice, no we're not questioning it ๐Ÿ’…)


โฐ lo_server_next_event_delay

double lo_server_next_event_delay (lo_server s)

gives you the time in seconds until the next scheduled event. and if that delay is greater than 100 seconds? it just returns 100.0. capped, humble, lowkey. โœจ


๐Ÿ“ฅ lo_server_recv

int lo_server_recv (lo_server s)

this one blocks โ€” just sits there waiting for an OSC message to arrive. and honestly? that blocking behavior is, in most cases, undesireable, because a program with no incoming messages may literally never exit ๐Ÿ’€. it is encouraged to use lo_server_recv_noblock() instead, which is equivalent to lo_server_wait() and then lo_server_recv(). do that. please.

the return value is the number of bytes in the received message. the message will be dispatched to a matching method if one is found. and in cases where no message is received but you need to return anyway, this function may return 0. okay so basically never trust it to be a real message, iykyk.


๐Ÿฆ‹ lo_server_recv_noblock

int lo_server_recv_noblock (lo_server s, int timeout)

looks for an OSC message waiting to be received. in new programs, this function should be prefered over lo_server_recv(). this is the main character of message receiving, fr fr. ๐ŸŒŸ

Parameters

  • s โ€” the server to wait for connections on.
  • timeout โ€” a timeout in milliseconds to wait for the incoming packet. a value of 0 will return immediately.

the return value is the number of bytes in the received message, or 0 if there is no message. the message will be dispatched to a matching method if one is found. no message, no problem. ๐ŸŽ€


โณ lo_server_wait

int lo_server_wait (lo_server s, int timeout)

wait for an OSC message to be received. simple. elegant. iconic.

Parameters

  • s โ€” the server to wait for connections on.
  • timeout โ€” a timeout in milliseconds to wait for the incoming packet. a value of 0 will return immediately.

the return value is 1 if there is a message waiting, 0 if there is no message, and -1 if there is an error that causes the function to return early. if there is a message waiting you can now call lo_server_recv() to receive that message. and this is preferable to using lo_server_recv() alone, since otherwise it may never exit if no new messages are incoming. the way that waiting is a whole strategy ๐Ÿ˜ญโœจ


๐Ÿซถ lo_servers_recv_noblock

int lo_servers_recv_noblock (lo_server * s, int * recvd, int num_servers,
    int timeout)

look for an OSC message waiting to be received on multiple servers. yes bestie, plural. we're multithreading the vibe.

Parameters

  • s โ€” as array of servers to wait for connections on.
  • recvd โ€” an array to store the number of bytes received by each server in array s.
  • num_servers โ€” the number of servers in the array s.
  • timeout โ€” a timeout in milliseconds to wait for the incoming packet. a value of 0 will return immediately.

the return value is the total number of bytes received by all servers. the messages will be dispatched to a matching method if one is found. ๐Ÿ’–


๐ŸŒธ lo_servers_wait

int lo_servers_wait (lo_server * s, int * status, int num_servers, int
    timeout)

wait on multiple servers for an OSC message to be received. one wait, many servers, we love efficiency.

Parameters

  • s โ€” an array of servers to wait for connections on.
  • status โ€” an array to receive the status of each server.
  • num_servers โ€” the number of servers in the array s.
  • timeout โ€” a timeout in milliseconds to wait for the incoming packet. a value of 0 will return immediately.

the return value is the number of servers with a message waiting, or -1 if there is an error that causes the function to return early. if there is a message waiting you can now call lo_server_recv() to receive that message. this is preferable to using lo_server_recv() alone, since otherwise it may never exit if no new messages are incoming. (yes it says that again. consistency queen. ๐Ÿ‘‘)


๐Ÿ” lo_string_contains_pattern

int lo_string_contains_pattern (const char * str)

test if a string contains any OSC pattern characters. pattern check, vibe check, same thing really.

Parameters

  • str โ€” the string to test

Returns 1 if true, 0 otherwise. binary, unbothered, moisturized.


๐Ÿ“ lo_strsize

int lo_strsize (const char * s)

a function to calculate the amount of OSC message space required by a C char *. returns the storage size in bytes, which will always be a multiple of four. always. no cap. the alignment is aligned. โœจ


๐Ÿ•ฐ๏ธ lo_timetag_diff

double lo_timetag_diff (lo_timetag a, lo_timetag b)

find the time difference between two timetags. returns a - b in seconds. note the order, bestie โ€” it's a minus b, not the other way around ๐Ÿ™ˆ.


โฑ๏ธ lo_timetag_now

void lo_timetag_now (lo_timetag * t)

return a timetag for the current time. on exit the timetag pointed to by t is filled with the OSC representation of this instant in time. this exact moment. captured. โœจ

Referenced by lo::now().


๐ŸŒ lo_url_get_hostname

char * lo_url_get_hostname (const char * url)

return the hostname portion of an OSC URL. and listen โ€” the return value should be free()'d when it is no longer needed. do not forget. do not leak. ๐Ÿซถ


๐Ÿ›ค๏ธ lo_url_get_path

char * lo_url_get_path (const char * url)

return the path portion of an OSC URL. again: the return value should be free()'d when it is no longer needed. memory hygiene is self care. ๐Ÿ’…


๐Ÿ”Œ lo_url_get_port

char * lo_url_get_port (const char * url)

return the port portion of an OSC URL. and yep, you already know โ€” the return value should be free()'d when it is no longer needed.


๐Ÿ“ก lo_url_get_protocol

char * lo_url_get_protocol (const char * url)

return the protocol portion of an OSC URL, eg. udp, tcp. this library uses OSC URLs of the form:

osc.prot://hostname:port/path

if the prot part is missing, UDP is assumed. classic default behavior, lowkey relatable.

the return value should be free()'d when it is no longer needed. yes. again. free it. ๐ŸŽ€


๐Ÿท๏ธ lo_url_get_protocol_id

int lo_url_get_protocol_id (const char * url)

return the protocol ID of an OSC URL. this library uses OSC URLs of the form:

osc.prot://hostname:port/path

if the prot part is missing, UDP is assumed. returned value will be one of LO_UDP, LO_TCP, LO_UNIX or -1.

Returns an integer specifying the protocol. return -1 when the protocol is not supported by liblo. so if you get -1, that protocol said "not me" ๐Ÿ™ˆ.


๐Ÿ‘‘ Author

Generated automatically by Doxygen for liblo from the source code. (the robots wrote it, we just gave it the group chat glow-up โœจ)


and that's a wrap on liblolowlevel(3), bestie! this page came to you from liblo, Version 0.34, and it's dated the same as always on this man page โ€” go forth and free() your strings, avoid blocking calls, and slay your OSC servers responsibly ๐Ÿ’–๐Ÿฆ‹๐ŸŽ€๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from