#osc #parse #parser

x32_osc_state

X32 State Tracker via Open Sound Control

6 releases

new 0.1.1 Jan 30, 2025
0.1.0 Jan 29, 2025
0.0.4 Jan 28, 2025

#149 in Audio

Download history 420/week @ 2025-01-25

420 downloads per month

ISC license

80KB
1.5K SLoC

X32_OSC_STATE

A state machine for X32 OSC communication. Includes an OSC encoder/decoder

Getting data from the state machine

use x32_osc_state as x32;

let mut state:x32::X32Console = x32::X32Console::default();

assert_eq!(state.active_cue(), "Cue: 0.0.0 :: -- [--] [--]");

let channel_01_fader = state.fader(&x32::enums::FaderIndex::Channel(1)).expect("Unknown Channel");

assert_eq!(channel_01_fader.name(), "Ch01");
assert_eq!(channel_01_fader.level(), (0_f32, String::from("-oo dB")));
assert_eq!(channel_01_fader.is_on(), (false, String::from("OFF")));

Communicating to the X32

use x32_osc_state as x32;

// Ask the X32 for the cue list along with the status of all tracked faders:
//   - main, mono, matrix, aux, bus, dca, and channels
let x32_initial_data:Vec<x32::osc::Buffer> = x32::x32::ConsoleRequest::full_update();

// contains the raw byte buffer for the xremote command
let xremote_command = x32::enums::X32_XREMOTE.clone();

Process updates from the X32

use x32_osc_state as x32;

let mut state:x32::X32Console = x32::X32Console::default();

let mut raw_buffer = [0; 1024];

let buffer = x32::osc::Buffer::from(raw_buffer.clone().to_vec());

// process function will take OSCBuffers or OSCMessages if you prefer
// to do some pre-processing. Messages that are malformed or not understood
// are silently ignored
state.process(buffer);

Dependencies

~2.2–3MB
~54K SLoC