This crate is not yet ready to use
This is a pair of firewheel nodes which together can be used to send audio data over any arbitrary network. Audio data is encoded via the opus codec, resulting in significantly reduced bandwidth usage comparable to other modern VOIP services like Discord.
This crate is network transport agnostic. You can supply your own transport by implementing the NetworkNodeTransport trait. The only requirements is that the send and receive methods don't block and that the transport behaves "like udp". That is, that it "fire and forgets" and it doesn't have ordering guarantees. The lack of ordering requirement isn't as strict as the other requirements, but forced ordering (like when using TCP), can introduce delay and the OPUS codec is designed to withstand out-of-order delivery, so your mileage may vary.
Additionally, this crate must have full access to the transport. That is to say, any data that it reads or writes must
be exclusive to this crate. It interprets everything coming in as encoded opus bytes. To use this crate alongside other
networking (for example networked gameplay data for games), you must abstract them into separate streams. For example,
in the built-in UdpSocketTransport case, using an additional separate port for audio data. Or for the
SteamNetworkingMessagesTransport case, using a
different channel than your other gameplay network
traffic.
I can see this crate being integrated into other crates that provide transports like aeronet and being used alongside crates like bevy_replicon, lightyear, and bevy_ggrs. The transport trait is actually very similar to and inspired by the ggrs crate.
The crate contains two transports.
- UDP Sockets, which uses plain UDP sockets
- Steam Networking, which uses the Steam Networking Messages API to send UDP-like messages over steam's relays, implemented via the steamworks crate
If these two do not fit your needs, it is fairly easy to implement your own. Take a look at how the ones above are implemented for reference.
- Has exactly 1 or 2 inputs and 0 outputs
- Has exactly 0 inputs and 1 or 2 outputs
This crate employs no encryption or other security measures. Use a secure transport and hook this crate into that.
This crate spins up 1 networking thread per Transport. This networking thread is responsible for receiving encoded audio data from transmitter nodes in the audio graph and sending them to their appropriate address. It is also responsible for receiving any encoded data from the network and sending the bytes to receiver nodes to be decoded.
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0), or
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.