liblo(3)

πŸ“¦
version 0.34 Β· 3 versions
, in fedora 44

πŸ’– liblo β€” the high-level OSC API, bestie edition πŸ’–

okay so real talk: liblo is the High-level OSC API. that's the whole vibe. it's the library manual page, and we're getting into it together, no cap.


✨ NAME ✨

liblo β€” High-level OSC API πŸ¦‹


🌸 SYNOPSIS 🌸

πŸŽ€ Data Structures

  • struct lo_timetag β€” a structure to store OSC TimeTag values. literally its whole job.
  • union lo_arg β€” a union used to read values from incoming messages. it's giving "pick a lane, any lane".

🧚 Macros

  • #define LO_TT_IMMEDIATE ((lo_timetag){0U,1U}) β€” a timetag constant representing "now".

⭐ Enumerations

  • enum lo_element_type { LO_ELEMENT_MESSAGE = 1, LO_ELEMENT_BUNDLE = 2 } β€” an enumeration of bundle element types liblo can handle.
  • enum lo_type { LO_INT32 = 'i', LO_FLOAT = 'f', LO_STRING = 's', LO_BLOB = 'b', LO_INT64 = 'h', LO_TIMETAG = 't', LO_DOUBLE = 'd', LO_SYMBOL = 'S', LO_CHAR = 'c', LO_MIDI = 'm', LO_TRUE = 'T', LO_FALSE = 'F', LO_NIL = 'N', LO_INFINITUM = 'I' } β€” an enumeration of the OSC types liblo can send and receive.

πŸ’… Functions

  • lo_address lo_address_new (const char *host, const char *port) β€” declare an OSC destination, given IP address and port number. same as lo_address_new_with_proto(), but using UDP.
  • lo_address lo_address_new_with_proto (int proto, const char *host, const char *port) β€” declare an OSC destination, given IP address and port number, specifying protocol.
  • lo_address lo_address_new_from_url (const char *url) β€” create a lo_address object from an OSC URL.
  • void lo_address_free (lo_address t) β€” free the memory used by the lo_address object.
  • void lo_address_set_ttl (lo_address t, int ttl) β€” set the Time-to-Live value for a given target address.
  • int lo_address_get_ttl (lo_address t) β€” get the Time-to-Live value for a given target address.
  • int lo_send (lo_address targ, const char *path, const char *type,...) β€” send an OSC formatted message to the address specified.
  • int lo_send_from (lo_address targ, lo_server from, lo_timetag ts, const char *path, const char *type,...) β€” send an OSC formatted message to the address specified, from the same socket as the specified server.
  • int lo_send_timestamped (lo_address targ, lo_timetag ts, const char *path, const char *type,...) β€” send an OSC formatted message to the address specified, scheduled to be dispatched at some time in the future.
  • int lo_address_errno (lo_address a) β€” return the error number from the last failed lo_send() or lo_address_new() call.
  • const char * lo_address_errstr (lo_address a) β€” return the error string from the last failed lo_send() or lo_address_new() call.
  • lo_blob lo_blob_new (int32_t size, const void *data) β€” create a new OSC blob type.
  • void lo_blob_free (lo_blob b) β€” free the memory taken by a blob.
  • uint32_t lo_blob_datasize (lo_blob b) β€” return the amount of valid data in a lo_blob object.
  • void * lo_blob_dataptr (lo_blob b) β€” return a pointer to the start of the blob data to allow contents to be changed.
  • void lo_version (char *verstr, int verstr_size, int *major, int *minor, char *extra, int extra_size, int *lt_major, int *lt_minor, int *lt_bug) β€” get information on the version of liblo current in use.

πŸ”₯ Detailed Description πŸ”₯

Defines the high-level API functions necessary to implement OSC support. should be adequate for most applications, but if you require lower level control you can use the functions defined in lo_lowlevel.h. iykyk πŸ‘‘


🌈 Macro Definition Documentation 🌈

✨ #define LO_TT_IMMEDIATE ((lo_timetag){0U,1U})

a timetag constant representing "now". the moment. the present. main character energy fr fr.

definition at line 151 of file lo_osc_types.h.

referenced by lo::immediate().


πŸ‘‘ Enumeration Type Documentation πŸ‘‘

πŸ¦‹ enum lo_element_type

an enumeration of bundle element types liblo can handle. the element of a bundle can either be a message or an other bundle. that's it, those are the options, no notes πŸ’…

Enumerator

  • LO_ELEMENT_MESSAGE β€” bundle element is a message
  • LO_ELEMENT_BUNDLE β€” bundle element is a bundle

definition at line 48 of file lo_osc_types.h.


πŸ“ enum lo_type

an enumeration of the OSC types liblo can send and receive. the value of the enumeration is the typechar used to tag messages and to specify arguments with lo_send(). okay so this is lowkey the most important list on the page, pay attention bestie 😭

Enumerator

  • LO_INT32 β€” 32 bit signed integer.
  • LO_FLOAT β€” 32 bit IEEE-754 float.
  • LO_STRING β€” standard C, NULL terminated string.
  • LO_BLOB β€” OSC binary blob type. accessed using the lo_blob_*() functions.
  • LO_INT64 β€” 64 bit signed integer.
  • LO_TIMETAG β€” OSC TimeTag type, represented by the lo_timetag structure.
  • LO_DOUBLE β€” 64 bit IEEE-754 double.
  • LO_SYMBOL β€” standard C, NULL terminated, string. used in systems which distinguish strings and symbols.
  • LO_CHAR β€” standard C, 8 bit, char variable.
  • LO_MIDI β€” a 4 byte MIDI packet.
  • LO_TRUE β€” Sybol representing the value True.
  • LO_FALSE β€” Sybol representing the value False.
  • LO_NIL β€” Sybol representing the value Nil.
  • LO_INFINITUM β€” Sybol representing the value Infinitum.

definition at line 61 of file lo_osc_types.h.

πŸ’– Function Documentation πŸ’–

okay bestie this is the big one β€” every single function in liblo, explained. grab a snack, we're going through all of them. no skips, no "you get the idea". we get the idea by reading the whole thing. periodt. 🫢


🌸 int lo_address_errno (lo_address a)

returns the error number from the last failed lo_send() or lo_address_new() call. that's it, that's the function. your little receipt of shame. πŸ’€

πŸ¦‹ const char * lo_address_errstr (lo_address a)

returns the error string from the last failed lo_send() or lo_address_new() call. same energy as above but in words. the number's friend who explains what went wrong. 😭

πŸŽ€ void lo_address_free (lo_address t)

frees the memory used by the lo_address object. clean up after yourself queen, the memory isn't gonna free itself. πŸ’…

⭐ int lo_address_get_ttl (lo_address t)

gets the Time-to-Live value for a given target address.

Parameters

  • t β€” an OSC address.

Returns

an integer specifying the scope of a multicast UDP message. basically: how far your message is allowed to travel before it gives up. 🌈

πŸ‘‘ lo_address lo_address_new (const char * host, const char * port)

declares an OSC destination, given an IP address and port number. same as lo_address_new_with_proto(), but using UDP. (so if you wanted TCP or UNIX you gotta go talk to the other one, iykyk.)

Parameters

  • host β€” an IP address or number, or NULL for the local machine.
  • port β€” a decimal port number or service name.

the lo_address object may be used as the target of OSC messages.

note, and this one matters: if you wish to receive replies from the target of this address, you must either supply a lo_server by using lo_send_from() or lo_send_message_from() to send your message β€” otherwise the last lo_server or lo_server_thread that was created will be used as the reply socket. the remote receiver may get the reply address by calling lo_message_get_source() in the message handler. see example_tcp_echo_server.c for an example of how to establish bidirectional communication. so yes, "whoever got made last becomes your reply inbox" is real and it's giving chaos. πŸ”₯

🧚 lo_address lo_address_new_from_url (const char * url)

creates a lo_address object from an OSC URL. example: "osc.udp://localhost:4444/my/path/" β€” just hand it the whole URL and let it cook. ✨

πŸ’œ lo_address lo_address_new_with_proto (int proto, const char * host, const char * port)

declares an OSC destination, given an IP address and port number, specifying protocol. this is the choose-your-own-adventure version.

Parameters

  • proto β€” the protocol to use, must be one of LO_UDP, LO_TCP or LO_UNIX.
  • host β€” an IP address or number, or NULL for the local machine.
  • port β€” a decimal port number or service name.

the lo_address object may be used as the target of OSC messages.

note: if you wish to receive replies from the target of this address, you must first create a lo_server_thread or lo_server object which will receive the replies. the last lo_server(_thread) object created will be the receiver. again with the "last one wins" rule, it's iconic honestly. 🫢

πŸ’… void lo_address_set_ttl (lo_address t, int ttl)

sets 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. so 1 = staying in the group chat, 255 = posting to the whole internet. 🌍

Parameters

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

πŸ“ void * lo_blob_dataptr (lo_blob b)

returns a pointer to the start of the blob data to allow contents to be changed. if the size is 0, this will return a NULL-pointer. no data, no pointer, no problem. πŸ™ˆ

🌟 uint32_t lo_blob_datasize (lo_blob b)

returns the amount of valid data in a lo_blob object. if you want to know the storage size, use lo_arg_size(). yes those are two different numbers, no you cannot swap them, don't try it bestie. πŸ’€

🌸 void lo_blob_free (lo_blob b)

frees the memory taken by a blob. bye bye blob, you were so real. 😭

πŸŽ€ lo_blob lo_blob_new (int32_t size, const void * data)

creates a new OSC blob type. fresh blob just dropped. ✨

Parameters

  • size β€” the amount of space to allocate in the blob structure.
  • data β€” the data that will be used to initialise the blob, should be size bytes long.

πŸ”₯ int lo_send (lo_address targ, const char * path, const char * type, ...)

sends an OSC formatted message to the address specified. this is the main character function ngl.

Parameters

  • targ β€” the target OSC address
  • path β€” the OSC path the message will be delivered to
  • type β€” the types of the data items in the message, types are defined in lo_osc_types.h
  • ... β€” the data values to be transmitted. the types of the arguments passed here must agree with the types specified in the type parameter.

example:

lo_send(t, "/foo/bar", "ff", 0.1f, 23.0f);

Returns

-1 on failure. that's the whole returns section, she's short and she's honest. πŸ’…

🌈 int lo_send_from (lo_address targ, lo_server from, lo_timetag ts, const char * path, const char * type, ...)

sends an OSC formatted message to the address specified, from the same socket as the specified server. if a liblo server is receiving this message, it can reply by getting the server's address by calling lo_message_get_source() in the message handler, passing the lo_message provided as an argument to the lo_method_handler. by this mechanism, bidirectional communication can be established by setting up a lo_server or lo_server_thread on both sides. two servers, one conversation, the way that they talk back and forth is genuinely so cute. πŸ¦‹

Parameters

  • targ β€” the target OSC address
  • from β€” the server to send message from (can be NULL to use new socket)
  • ts β€” the OSC timetag timestamp at which the message will be processed (can be LO_TT_IMMEDIATE if you don't want to attach a timetag)
  • path β€” the OSC path the message will be delivered to
  • type β€” the types of the data items in the message, types are defined in lo_osc_types.h
  • ... β€” the data values to be transmitted. the types of the arguments passed here must agree with the types specified in the type parameter.

example:

serv = lo_server_new(NULL, err);
lo_server_add_method(serv, "/reply", "ss", reply_handler, NULL);
lo_send_from(t, serv, LO_TT_IMMEDIATE, "/foo/bar", "ff", 0.1f, 23.0f);

see example_tcp_echo_server.c for an example of how to use lo_message_get_source() as described.

Returns

on success, the number of bytes sent, or -1 on failure.

⭐ int lo_send_timestamped (lo_address targ, lo_timetag ts, const char * path, const char * type, ...)

sends an OSC formatted message to the address specified, scheduled to be dispatch at some time in the future. yes, "dispatch", that's what the original says, we're not touching it. this is the schedule-send-for-later function. planning ahead is so mature of you. πŸ‘‘

Parameters

  • targ β€” the target OSC address
  • ts β€” the OSC timetag timestamp at which the message will be processed
  • path β€” the OSC path the message will be delivered to
  • type β€” the types of the data items in the message, types are defined in lo_osc_types.h
  • ... β€” the data values to be transmitted. the types of the arguments passed here must agree with the types specified in the type parameter.

example:

lo_timetag now;
lo_timetag_now(&now);
lo_send_timestamped(t, now, "/foo/bar", "ff", 0.1f, 23.0f);

Returns

on success, the number of bytes sent, or -1 on failure.

πŸ’œ void lo_version (char * verstr, int verstr_size, int * major, int * minor, char * extra, int extra_size, int * lt_major, int * lt_minor, int * lt_bug)

get information on the version of liblo current in use. all parameters are optional and can be given the value of 0 if that information is not desired. for example, to get just the version as a string, call:

lo_version(str, size, 0, 0, 0, 0, 0, 0, 0);

the "lt" fields, called the ABI version, corresponds to libtool's versioning system for binary interface compatibility, and is not related to the library version number. this information is usually encoded in the filename of the shared library. so don't mix them up, they're two different girls with the same vibe. πŸ™ˆ

typically the string returned in 'verstr' should correspond with $major.$minor$extra, e.g., "0.28rc". if no 'extra' information is present, e.g., "0.28", extra will given the null string.

Parameters

  • verstr β€” a buffer to receive a string describing the library version.
  • verstr_size β€” size of the buffer pointed to by string.
  • major β€” location to receive the library major version.
  • minor β€” location to receive the library minor version.
  • extra β€” location to receive the library version extra string.
  • extra_size β€” size of the buffer pointed to by extra.
  • lt_major β€” location to receive the ABI major version.
  • lt_minor β€” location to receive the ABI minor version.
  • lt_bug β€” location to receive the ABI 'bugfix' version.

referenced by lo::version().


✨ Author ✨

generated automatically by Doxygen for liblo from the source code. so like, the docs wrote themselves. Doxygen ate and left no crumbs, we just did the vibes. πŸ’…βœ¨


okay that's the whole page bestie!! this was liblo, Version 0.34, living in the liblo(3) man page πŸ’– (the footer's date slot didn't come through with what I was handed, so we're just gonna say "some iconic day, whenever liblo 0.34 was feeling herself"). you read all of it, you understood all of it, that's main character energy fr fr. go send some OSC messages, you've earned it. πŸŒˆπŸ‘‘πŸŽ€

πŸ“¦ where this page comes from