Crate bbx_net

Source
Expand description

§BBX Net

Network audio control for art installations and live performance: OSC and WebSocket protocols.

This crate provides lock-free, realtime-safe network message passing for distributed audio systems. It supports:

  • OSC (UDP): For TouchOSC, Max/MSP, and other creative tools
  • WebSocket: For phone PWA interfaces

§Features

  • osc - Enable OSC protocol support (requires rosc crate)
  • websocket - Enable WebSocket support (requires tokio runtime)
  • full - Enable all protocols

§Example

use bbx_net::{net_buffer, NetMessage, NodeId};
use bbx_core::random::XorShiftRng;

// Create a buffer for network -> audio thread communication
let (mut producer, mut consumer) = net_buffer(256);

// Generate a node ID
let mut rng = XorShiftRng::new(12345);
let node_id = NodeId::generate(&mut rng);

// In network thread: send parameter changes
let msg = NetMessage::param_change("gain", 0.5, node_id);
producer.try_send(msg);

// In audio thread: receive messages (realtime-safe)
let events = consumer.drain_into_stack();
for event in events {
    // Apply parameter change to DSP graph
}

Re-exports§

pub use address::AddressPath;
pub use address::NodeId;
pub use buffer::MAX_NET_EVENTS_PER_BUFFER;
pub use buffer::NetBufferConsumer;
pub use buffer::NetBufferProducer;
pub use buffer::net_buffer;
pub use clock::ClockSync;
pub use clock::SyncedTimestamp;
pub use error::NetError;
pub use error::Result;
pub use message::NetEvent;
pub use message::NetMessage;
pub use message::NetMessageType;
pub use message::NetPayload;
pub use message::hash_param_name;

Modules§

address
Block identification and address parsing for network messages.
buffer
Lock-free network buffer for thread-safe message passing.
clock
Clock synchronization for distributed audio timing.
error
Error types for bbx_net network operations.
message
Network message types for audio control.
osc
OSC (Open Sound Control) protocol support.
websocket
WebSocket protocol support for phone PWA interfaces.