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§

source§

impl DSPNodeContext

source

pub fn new_ref() -> Rc<RefCell<Self>>

Creates a new DSPNodeContext that you can pass into crate::JIT::new.

source

pub fn set_debug(&mut self, enabled: bool)

Enabled debug information collection. See also DSPNodeContext::get_ir_dump.

source

pub fn debug_enabled(&self) -> bool

Returns if debug is enabled.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl Drop for DSPNodeContext

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.