SPB Git

Repository Public

dump_registry.rs 1.7 KB 52 lines rust

1//! ORIX Sonata2//! File: crates/sonata-compiler/examples/dump_registry.rs3//! Description: Prints the registry of this build (engines, effects, patch nodes) as JSON or as a summary.4//!5//! Author: Simon-Pierre Boucher6//! Contact: contact@spboucher.ai78fn main() {9    let r = sonata_compiler::registry();10    if std::env::args().any(|a| a == "--json") {11        println!("{}", serde_json::to_string_pretty(r).unwrap_or_default());12        return;13    }14    if let Err(e) = r.validate() {15        println!("INVALID REGISTRY: {e}");16    }17    for e in &r.engines {18        println!(19            "engine {} [{}] range {:?} presets [{}]",20            e.model,21            e.family,22            e.range,23            e.presets.iter().map(|p| p.name.as_str()).collect::<Vec<_>>().join(", ")24        );25        for p in &e.params {26            println!("    {} {:?} [{}, {}] = {} {:?} auto={}", p.name, p.unit, p.min, p.max, p.default, p.choices, p.automatable);27        }28    }29    for e in &r.effects {30        println!(31            "effect {} [{}] mix {} latency {:?} presets [{}]",32            e.kind,33            e.category,34            e.default_mix,35            e.latency,36            e.presets.iter().map(|p| p.name.as_str()).collect::<Vec<_>>().join(", ")37        );38        for p in &e.params {39            println!("    {} {:?} [{}, {}] = {} {:?}", p.name, p.unit, p.min, p.max, p.default, p.choices);40        }41    }42    for n in &r.patch_nodes {43        println!(44            "node {} [{}] {:?}: {}",45            n.kind,46            n.category,47            n.output_rate,48            n.ports.iter().map(|p| format!("{}:{:?}{}", p.name, p.unit, if p.constant_only { "!" } else { "" })).collect::<Vec<_>>().join(", ")49        );50    }51}52
Files main
Menu

Theme