Struct synfx_dsp_jit::DSPNodeContext
source · [−]pub struct DSPNodeContext { /* private fields */ }
Expand description
This table holds all the DSP state including the state of the individual DSP nodes that were created by the [crate::jit::DSPFunctionTranslator].
Implementations
sourceimpl DSPNodeContext
impl DSPNodeContext
sourcepub fn new_ref() -> Rc<RefCell<Self>>
pub fn new_ref() -> Rc<RefCell<Self>>
Creates a new DSPNodeContext that you can pass into crate::JIT::new.
sourcepub fn set_debug(&mut self, enabled: bool)
pub fn set_debug(&mut self, enabled: bool)
Enabled debug information collection. See also DSPNodeContext::get_ir_dump.
sourcepub fn debug_enabled(&self) -> bool
pub fn debug_enabled(&self) -> bool
Returns if debug is enabled.
sourcepub fn get_ir_dump(&self) -> &str
pub fn get_ir_dump(&self) -> &str
If DSPNodeContext::set_debug is enabled, this will return the most recent IR code for the most recently compiled DSPFunction.
sourcepub fn atom(&self, idx: usize) -> Option<Arc<AtomicFloat>>
pub fn atom(&self, idx: usize) -> Option<Arc<AtomicFloat>>
Returns you a reference to the specified atom connected with the DSP backend.
These atoms can be read and written in the DSPFunction using the atomr
and atomw
nodes.
sourcepub fn get_persistent_variable_index_by_name(
&self,
pers_var_name: &str
) -> Option<usize>
pub fn get_persistent_variable_index_by_name(
&self,
pers_var_name: &str
) -> Option<usize>
Retrieve the index into the most recently compiled DSPFunction. To be used by DSPFunction::access_persistent_var.
sourcepub fn send_table(
&mut self,
tbl_idx: usize,
table: Arc<Vec<f64>>
) -> Result<(), DSPNodeContextError>
pub fn send_table(
&mut self,
tbl_idx: usize,
table: Arc<Vec<f64>>
) -> Result<(), DSPNodeContextError>
Tries to send a new table to the backend. You have to make sure the table has exactly the same size as the previous table given in the [DSPContextConfig]. Otherwise a [DSPNodeContextError] is returned.
sourcepub fn cleanup_dsp_fun_after_user(&mut self, _fun: Box<DSPFunction>)
pub fn cleanup_dsp_fun_after_user(&mut self, _fun: Box<DSPFunction>)
If you received a DSPFunction back from the audio thread, you should pass it into this function. It will make sure to purge old unused [DSPNodeState] instances.
sourcepub fn free(&mut self)
pub fn free(&mut self)
You must call this after all DSPFunction instances compiled with this state are done executing. If you don’t call this, you might get a memory leak. The API is a bit manual at this point, because usually DSPFunction will be executed on a different thread, and synchronizing this would come with additional overhead that I wanted to save.