pub struct AudioInterpreter {Show 14 fields
pub sample_rate: u32,
pub bpm: f32,
pub function_registry: FunctionRegistry,
pub events: AudioEventList,
pub variables: HashMap<String, Value>,
pub groups: HashMap<String, Vec<Statement>>,
pub banks: BankRegistry,
pub automation_registry: AutomationRegistry,
pub note_automation_templates: HashMap<String, NoteAutomationContext>,
pub cursor_time: f32,
pub special_vars: SpecialVarContext,
pub event_registry: EventRegistry,
pub midi_manager: Option<Arc<Mutex<MidiManager>>>,
pub suppress_beat_emit: bool,
/* private fields */
}Fields§
§sample_rate: u32§bpm: f32§function_registry: FunctionRegistry§events: AudioEventList§variables: HashMap<String, Value>§groups: HashMap<String, Vec<Statement>>§banks: BankRegistry§automation_registry: AutomationRegistryRegistered global automations
note_automation_templates: HashMap<String, NoteAutomationContext>Per-target note-mode automation contexts (including templates and timing info)
cursor_time: f32§special_vars: SpecialVarContext§event_registry: EventRegistry§midi_manager: Option<Arc<Mutex<MidiManager>>>§suppress_beat_emit: boolInternal guard to avoid re-entrant beat emission during handler execution
Implementations§
Source§impl AudioInterpreter
impl AudioInterpreter
pub fn new(sample_rate: u32) -> Self
pub fn interpret(&mut self, statements: &[Statement]) -> Result<Vec<f32>>
Sourcepub fn events(&self) -> &AudioEventList
pub fn events(&self) -> &AudioEventList
Get reference to collected audio events (for MIDI export)
Sourcepub fn current_statement_location(&self) -> Option<(usize, usize)>
pub fn current_statement_location(&self) -> Option<(usize, usize)>
Get current statement location for error reporting
Sourcepub fn calculate_total_duration(&self, _statements: &[Statement]) -> Result<f32>
pub fn calculate_total_duration(&self, _statements: &[Statement]) -> Result<f32>
Calculate approximate total duration by scanning statements
pub fn collect_events(&mut self, statements: &[Statement]) -> Result<()>
pub fn handle_let(&mut self, name: &str, value: &Value) -> Result<()>
pub fn extract_audio_event( &mut self, target: &str, context: &FunctionContext, ) -> Result<()>
pub fn render_audio(&self) -> Result<Vec<f32>>
pub fn set_bpm(&mut self, bpm: f32)
pub fn samples_per_beat(&self) -> usize
Sourcepub fn beat_duration(&self) -> f32
pub fn beat_duration(&self) -> f32
Get duration of one beat in seconds
Sourcepub fn execute_print(&self, value: &Value) -> Result<()>
pub fn execute_print(&self, value: &Value) -> Result<()>
Execute print statement with variable interpolation Supports {variable_name} syntax
Sourcepub fn interpolate_string(&self, template: &str) -> String
pub fn interpolate_string(&self, template: &str) -> String
Interpolate variables in a string Replaces {variable_name} with the variable’s value
Sourcepub fn execute_if(
&mut self,
condition: &Value,
body: &[Statement],
else_body: &Option<Vec<Statement>>,
) -> Result<()>
pub fn execute_if( &mut self, condition: &Value, body: &[Statement], else_body: &Option<Vec<Statement>>, ) -> Result<()>
Execute if statement with condition evaluation
Sourcepub fn evaluate_condition(&self, condition: &Value) -> Result<bool>
pub fn evaluate_condition(&self, condition: &Value) -> Result<bool>
Evaluate a condition to a boolean Supports: ==, !=, <, >, <=, >=
Sourcepub fn resolve_value(&self, value: &Value) -> Value
pub fn resolve_value(&self, value: &Value) -> Value
Resolve a value (replace identifiers with their values from variables)
Sourcepub fn execute_event_handlers(&mut self, event_name: &str) -> Result<()>
pub fn execute_event_handlers(&mut self, event_name: &str) -> Result<()>
Execute event handlers matching the event name
Sourcepub fn values_equal(&self, left: &Value, right: &Value) -> bool
pub fn values_equal(&self, left: &Value, right: &Value) -> bool
Check if two values are equal
Sourcepub fn compare_values(
&self,
left: &Value,
right: &Value,
ordering: Ordering,
) -> Result<bool>
pub fn compare_values( &self, left: &Value, right: &Value, ordering: Ordering, ) -> Result<bool>
Compare two values
Sourcepub fn handle_assign(
&mut self,
target: &str,
property: &str,
value: &Value,
) -> Result<()>
pub fn handle_assign( &mut self, target: &str, property: &str, value: &Value, ) -> Result<()>
Handle property assignment: target.property = value
Sourcepub fn extract_synth_def_from_map(
&self,
map: &HashMap<String, Value>,
) -> Result<SynthDefinition>
pub fn extract_synth_def_from_map( &self, map: &HashMap<String, Value>, ) -> Result<SynthDefinition>
Extract synth definition from a map
Sourcepub fn handle_load(&mut self, source: &str, alias: &str) -> Result<()>
pub fn handle_load(&mut self, source: &str, alias: &str) -> Result<()>
Handle MIDI file loading: @load “path.mid” as alias
Sourcepub fn handle_bind(
&mut self,
source: &str,
target: &str,
options: &Value,
) -> Result<()>
pub fn handle_bind( &mut self, source: &str, target: &str, options: &Value, ) -> Result<()>
Handle MIDI binding: bind source -> target { options }
Sourcepub fn extract_pattern_data(
&self,
value: &Value,
) -> (Option<String>, Option<HashMap<String, f32>>)
pub fn extract_pattern_data( &self, value: &Value, ) -> (Option<String>, Option<HashMap<String, f32>>)
Extract pattern string and options from pattern value
Sourcepub fn execute_pattern(
&mut self,
target: &str,
pattern: &str,
options: Option<HashMap<String, f32>>,
) -> Result<()>
pub fn execute_pattern( &mut self, target: &str, pattern: &str, options: Option<HashMap<String, f32>>, ) -> Result<()>
Execute a pattern with given target and pattern string
Sourcepub fn resolve_sample_uri(&self, target: &str) -> String
pub fn resolve_sample_uri(&self, target: &str) -> String
Resolve sample URI from bank.trigger notation (e.g., myBank.kick -> devalang://bank/devaloop.808/kick)
Auto Trait Implementations§
impl Freeze for AudioInterpreter
impl !RefUnwindSafe for AudioInterpreter
impl !Send for AudioInterpreter
impl !Sync for AudioInterpreter
impl Unpin for AudioInterpreter
impl !UnwindSafe for AudioInterpreter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more