Skip to main content

Crate rodecaster_protocol

Crate rodecaster_protocol 

Source
Expand description

A pure-Rust protocol library for controlling RØDECaster Pro II and RØDECaster Duo audio consoles.

This crate implements the binary protocol used by RØDECaster hardware and desktop applications. It provides high-level typed commands and events while leaving transport I/O (sockets, USB handles) under your control.

§Architecture

The library is organized into three distinct layers:

  1. Domain Layer (High-Level):

    • ProtocolSession: The main entry point for managing connection state and device lifecycle.
    • Command: Strongly-typed commands to mute faders, change volumes, trigger sound pads, and route audio.
    • DeviceEvent: Strongly-typed inbound events representing fader moves, button presses, and state updates.
    • DeviceCapabilities: Query physical and virtual fader counts, available input sources, and hardware model.
  2. Transport Framing:

    • usb: Chunking and reassembly for 64-byte USB HID reports.
    • frame: Framing for TCP network streams using magic header and length prefix.
  3. Protocol Primitives (Low-Level):

    • valuetree: Parses JUCE ValueTree snapshots into structured Node and Property trees.
    • juce_var: Encodes and decodes typed Value items according to JUCE var binary formatting.
    • change_frame: Encodes and decodes granular ValueTreeSynchroniser change opcodes.

§Quickstart

Most applications interact directly with ProtocolSession:

use rodecaster_protocol::{Command, Fader, ProtocolSession, SessionUpdate};

let mut session = ProtocolSession::new();

// Pass raw payloads received from your transport (USB HID or TCP)
let raw_payload: &[u8] = &[];
if let Ok(update) = session.ingest(raw_payload) {
    match update {
        SessionUpdate::Ready { initial_events } => {
            let caps = session.capabilities().unwrap();
            println!("Connected to {} with {} faders", caps.model(), caps.faders().len());
            println!("Initial state contains {} events", initial_events.len());
        }
        SessionUpdate::Event(event) => {
            println!("Device event: {event:?}");
        }
        SessionUpdate::NeedsFullSync => {
            println!("Device topology changed; request full sync");
        }
    }
}

// Send commands once the session is ready
if session.is_ready() {
    let command = Command::SetFaderMute {
        fader: Fader::Physical1,
        mute: true,
    };
    let packets = session.encode(&command)?;
    for packet in packets {
        // Send packet bytes to device via USB or TCP
        let _ = packet;
    }
}

Re-exports§

pub use capabilities::DeviceCapabilities;
pub use change_frame::ChangeFrame;
pub use commands::Command;
pub use events::decode_event;
pub use events::decode_event_from_frame;
pub use events::DeviceEvent;
pub use events::MixLinkDirection;
pub use events::MixLinkRequestOrigin;
pub use frame::frame_payload;
pub use frame::scan_frame;
pub use frame::FrameScan;
pub use frame::Packet;
pub use frame::MAGIC_HEADER;
pub use juce_var::read_value;
pub use juce_var::Reader;
pub use juce_var::Value;
pub use layout::Layout;
pub use names::AppParam;
pub use names::AudioParam;
pub use names::BuildParam;
pub use names::ChannelParam;
pub use names::CurrentShowParam;
pub use names::DeviceModel;
pub use names::DuckerParam;
pub use names::EffectsParam;
pub use names::Fader;
pub use names::FxPresetParam;
pub use names::GuiParam;
pub use names::HeadphoneParam;
pub use names::InputSourceParam;
pub use names::MasterParam;
pub use names::MeterParam;
pub use names::MixMinusesParam;
pub use names::MixOutput;
pub use names::NetworkParam;
pub use names::OutputParam;
pub use names::PadParam;
pub use names::PadRecorderParam;
pub use names::ParseFaderError;
pub use names::ParseMixOutputError;
pub use names::ParseSourceError;
pub use names::PlayerParam;
pub use names::RadioParam;
pub use names::RadioRxParam;
pub use names::RadioTxParam;
pub use names::RcSyncMixParam;
pub use names::RecorderParam;
pub use names::RecordingParam;
pub use names::RecordingsParam;
pub use names::ShowControlParam;
pub use names::ShowParam;
pub use names::SipAdvancedParam;
pub use names::SipCallSlotsParam;
pub use names::SipCallingParam;
pub use names::SipRegistrationParam;
pub use names::Source;
pub use names::StorageVolumeParam;
pub use names::StreamerXMixPresetParam;
pub use names::StreamerXStreamMixParam;
pub use names::SystemParam;
pub use names::TestParam;
pub use names::ThemeParam;
pub use names::WifiScanResultParam;
pub use session::ProtocolSession;
pub use session::SessionError;
pub use session::SessionUpdate;
pub use trigger::TriggerOrigin;
pub use trigger::TriggerPhase;
pub use valuetree::parse_valuetree;
pub use valuetree::Node;
pub use valuetree::Property;

Modules§

capabilities
Device capability discovery and hardware feature inspection.
change_frame
JUCE ValueTreeSynchroniser change-frame encoder and decoder.
commands
Typed command builders for controlling RØDECaster functions.
events
Inbound typed event notifications from a RØDECaster console.
frame
TCP stream packet framing codec.
juce_var
JUCE var binary value encoding and decoding.
layout
Dynamic device topology discovery and address translation.
names
Named Rodecaster entities: the typed vocabulary the public API speaks.
session
High-level session management and connection lifecycle.
trigger
Momentary two-boolean virtual button and trigger pulses.
usb
USB HID transport framing and report chunking.
valuetree
JUCE ValueTree data structures and parser.