Struct hexodsp::NodeExecutor
source · [−]pub struct NodeExecutor {
pub(crate) smoothers: Vec<(usize, Smoother)>,
pub(crate) target_refresh: Vec<(usize, f32)>,
pub(crate) prog: NodeProg,
pub(crate) monitor_signal_cur_inp_indices: [usize; 6],
pub(crate) sample_rate: f32,
pub(crate) exec_ctx: NodeExecContext,
shared: SharedNodeExec,
injected_midi: Vec<HxMidiEvent>,
dsp_log_init: bool,
}
Expand description
Holds the complete allocation of nodes and the program. New Nodes or the program is not newly allocated in the audio backend, but it is copied from the input ring buffer. If this turns out to be too slow, we might have to push buffers of the program around.
Fields
smoothers: Vec<(usize, Smoother)>
Contains the stand-by smoothing operators for incoming parameter changes.
target_refresh: Vec<(usize, f32)>
Contains target parameter values after a smoother finished, these will refresh the input buffers:
prog: NodeProg
Contains the to be executed nodes and output operations. Is copied from the input ringbuffer when a corresponding message arrives.
monitor_signal_cur_inp_indices: [usize; 6]
Holds the input vector indices which are to be monitored by the frontend.
sample_rate: f32
The sample rate
exec_ctx: NodeExecContext
Context that can be accessed by all (executed) nodes at runtime.
The connection with the crate::nodes::NodeConfigurator.
injected_midi: Vec<HxMidiEvent>
A small buffer for injected HxMidiEvent
dsp_log_init: bool
A flag to remember if we already initialized the logger on the audio thread.
Implementations
sourceimpl NodeExecutor
impl NodeExecutor
pub(crate) fn new(shared: SharedNodeExec) -> Self
pub fn no_logging(&mut self)
pub fn process_graph_updates(&mut self)
pub fn set_external_params(&mut self, ext_param: Arc<dyn ExternalParams>)
pub fn set_sample_rate(&mut self, sample_rate: f32)
pub fn feed_midi_events_from<F: FnMut() -> Option<HxTimedEvent>>(&mut self, f: F)
pub fn get_prog(&self) -> &NodeProg
pub fn get_nodes(&self) -> Vec<Node>
fn set_modamt(&mut self, mod_idx: usize, modamt: f32)
fn set_param(&mut self, input_idx: usize, value: f32)
fn process_smoothers(&mut self, nframes: usize)
pub fn process<T: NodeAudioContext>(&mut self, ctx: &mut T)
sourcepub fn test_run_input(
&mut self,
input: &[f32],
realtime: bool,
events: &[HxTimedEvent]
) -> (Vec<f32>, Vec<f32>)
pub fn test_run_input(
&mut self,
input: &[f32],
realtime: bool,
events: &[HxTimedEvent]
) -> (Vec<f32>, Vec<f32>)
This is a convenience function used for testing the DSP graph output in automated tests for this crate.
The sample rate that is used to run the DSP code is 44100 Hz.
Relying on the behvaiour of this function for production code is not it’s intended usecase and changes might break your code.
realtime
: If this is set, the function will sleep.
You can use it’s source as reference for your own audio DSP thread processing function.
sourcepub fn test_run(
&mut self,
seconds: f32,
realtime: bool,
events: &[HxTimedEvent]
) -> (Vec<f32>, Vec<f32>)
pub fn test_run(
&mut self,
seconds: f32,
realtime: bool,
events: &[HxTimedEvent]
) -> (Vec<f32>, Vec<f32>)
This is a convenience function used for testing the DSP graph input and output in automated tests for this crate.
The sample rate that is used to run the DSP code is 44100 Hz.
Relying on the behvaiour of this function for production code is not it’s intended usecase and changes might break your code.
seconds
: The number of seconds to run the DSP thread for.realtime
: If this is set, the function will sleep.
You can use it’s source as reference for your own audio DSP thread processing function.