Crates.io | x32_osc_state |
lib.rs | x32_osc_state |
version | |
source | src |
created_at | 2025-01-25 22:41:07.896092 |
updated_at | 2025-02-01 21:35:04.761738 |
description | X32 State Tracker via Open Sound Control |
homepage | |
repository | https://github.com/jtsage/x32_osc_state |
max_upload_size | |
id | 1530909 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A state machine for X32 OSC communication. Includes an OSC encoder/decoder
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")));
Please see the examples folder for a very simple version of a self-updating X32 state machine.
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();
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 [`osc::Buffer`] or [`osc::Message`] if you prefer
// to do some pre-processing. Messages that are malformed or not understood
// are silently ignored
let result:x32::X32ProcessResult = state.process(buffer);
// This is for acting on new data immediately. The result can be
// safely ignored. Most processed data is cached by the state
// machine with the notable exception of meter information - if
// you wish to use it, you must handle it here.
match result {
x32::X32ProcessResult::NoOperation => (),
x32::X32ProcessResult::Meters((meter_id_int, meter_vec_u8)) => (),
x32::X32ProcessResult::Fader(fader) => (),
x32::X32ProcessResult::CurrentCue(string) => (),
}