The sACN Source API provides a method for applications to transmit sACN data on one or more universes. This API exposes both a C and C++ language interface. The C++ interface is a header-only wrapper around the C interface.
A source must first be created before it can be used to transmit sACN data. Each source has a name and a CID. These are specified in the source's configuration structure, along with other optional settings. Once the source's configuration is initialized, it can simply be passed into the source Create/Startup function. If the source Create/Startup function succeeds, that source's functionality will become available. In C, this is accessed with a source handle, whereas in C++ it's accessed through a Source object. A source can later be destroyed using the source Destroy Shutdown function.
A set of configuration settings that a source needs to initialize.
Definition source.h:71
Adding and Removing Universes
A universe represents a destination for the DMX data being transmitted by a source. The receivers on the other end can choose which universes they want to listen on. Thus, universes allow for the organization of DMX traffic.
A source can transmit on one or more universes. Each universe has a configuration, which includes the universe number and other optional settings. Once you create this configuration, you can simply pass it into the Add Universe function. In this function, you can also specify specific network interfaces for the source to use for this universe. You can also indicate that all network interfaces should be used. When you're done transmitting on that universe, you can call the Remove Universe function.
uint16_t my_universe = 1; // Using universe 1 as an example.
At this point, once you have new data to transmit, you can use one of the Update functions to copy in the NULL start code or per-address priority (PAP) data that should be transmitted on the network. Assuming you didn't set the manually_process_source setting to true, the source thread will take care of actually sending the data. Otherwise, you'll need to call the Process Manual function at your DMX rate (typically 23 ms).
Please note that per-address priority is an ETC-specific sACN extension, and is disabled if the library is compiled with SACN_ETC_PRIORITY_EXTENSION set to 0.
// Initialize my_levels_buffer and (possibly) my_priorities_buffer with the data you want to send...
Copies the universe's DMX levels into the packet to be sent on the next threaded or manual update.
Definition source.h:638
Multicast and Unicast
By default, sources transmit DMX data over multicast. The destination multicast address is based on the universe number, therefore each universe's data goes to a different multicast address. However, sources can also transmit to one or more unicast addresses in addition to multicast. To add a unicast destination for a universe, call the Add Unicast Destination function. There's also a Remove Unicast Destination function. The universe configuration also has a send_unicast_only setting, which disables the transmission of multicast altogether. Once you change the unicast configuration, transmission suppression is reset and the newly added unicast destinations will have data transmitted to them.
// Unicast can be sent to one or more addresses, in addition to multicast.
Obtain a vector of a universe's unicast destinations.
Definition source.h:486
Custom Start Codes
The Update functions only allow you to send start code 0x00 (NULL) and 0xDD (PAP) data. If you want to send data for a different start code, you'll need to use the Send Now function to transmit that data synchronously.
Immediately sends the provided sACN start code & data.
Definition source.h:600
sACN Sync
You can also configure synchronization universes for each of your universes using the Change Synchronization Universe function. Then the transmitted DMX data will include this synchronization universe, indicating to the receivers to wait to apply the data until a synchronization message is received on the specified synchronization universe. To send the synchronization message, call the Send Synchronization function. NOTE: sACN Sync will not be supported in sACN 2.0.x.
// You can also set up a synchronization universe for a universe.
// Receivers should hang on to the data and wait for a sync message.
uint16_t my_sync_universe = 123; // Let's say the sync universe is 123, for example.
Indicate that a new synchronization packet should be sent on the given synchronization universe.
Definition source.h:620
The initial setting for sync universe can also be specified with the universe configuration's optional sync_universe setting.
Changing Preview Flag, Universe Priority, or Source Name
The preview flag, universe priority, and/or source name can be changed at any time using the appropriate Change function. This will also update the data being sent on the network and reset transmission suppression.
// The preview flag, priority, and name can also be changed at any time: