pub struct NodeGlobalData {
    scopes: HashMap<usize, Arc<ScopeHandle>>,
    feedback: HashMap<usize, SharedFeedback>,
    trackers: HashMap<usize, Tracker>,
    code_engines: HashMap<usize, CodeEngine>,
    block_functions: HashMap<usize, (u64, Arc<Mutex<BlockFun>>)>,
    dyn_nodes1x1: HashMap<usize, DynNodeHandle<Box<dyn DynamicNode1x1>>>,
}
Expand description

This structure holds any global state that may be shared among crate::dsp::DspNode instances.

This structure is provided to you by the crate::Matrix and resides in crate::NodeConfigurator.

These may be things like feedback buffers that are shared among FbWr and FbRd nodes, or the crate::dsp::tracker::Tracker that drives the TSeq sequencers. Also the crate::ScopeHandle instances used to connect the Scope nodes to the frontend are exchanged through this structure.

Fields

scopes: HashMap<usize, Arc<ScopeHandle>>

Holding the scope buffers

feedback: HashMap<usize, SharedFeedback>

Holds the shared feedback buffers

trackers: HashMap<usize, Tracker>

Holds the handles to the tracker sequencers

code_engines: HashMap<usize, CodeEngine>

Holding the synfx-dsp-jit code engine backends (which are used for the WBlockDSP block functions, but can also be directly used):

block_functions: HashMap<usize, (u64, Arc<Mutex<BlockFun>>)>

Holds the block functions that are JIT compiled to DSP code for the Code nodes. The code is then sent via the CodeEngine in [NodeConfigurator::check_block_function].

dyn_nodes1x1: HashMap<usize, DynNodeHandle<Box<dyn DynamicNode1x1>>>

Holds the communication handles to send crate::dsp::DynamicNode1x1 instances to their corresponding Rust1x1 DSP nodes.

Implementations

Returns the PatternData handle for the tracker index. Implicitly allocates the Tracker instance.

Returns true, if the tracker and patterndata for index has already been allocated.

Returns the TrackerBackend handle for the tracker index. Implicitly allocates the Tracker instance. The returned TrackerBackend will invalidate the other backend handles for the corresponding tracker index.

Checks if there are any updates to send for the pattern data that belongs to the tracker index. Call this repeatedly, eg. once per frame in a GUI, in case the user modified the pattern data. It will make sure that the modifications are sent to the audio thread.

Gives you direct access to the CodeEngine for index instance of the corresponding Code DSP node. You can also get the corresponding BlockFun via [NodeGlobalData::get_block_fun]. But in case of eg. [SynthConstructor] you can use the CodeEngine directly too!

This function only returns None if there is no synfx-dsp-jit feature enabled!

Make sure to call NodeGlobalData::check_code regularily!

Returns true if there was the CodeEngine index already used.

Returns the [synfx-dsp::CodeEngineBackend] for the corresponding code engine at index.

Any call of this function clears the connection of the corresponding CodeEngine to the previously returned CodeEngineBackend.

Retrieve a handle to the block function id. In case you modify the block function, make sure to call NodeGlobalData::check_code.

Only returns None if the feature synfx-dsp-jit is disabled!

Checks the CodeEngine and block function for the id id. If the block function did change, updates are then sent to the audio thread. See also NodeGlobalData::get_block_function.

Updates the dynamic node for the Rust1x1 nodes. The id refers to the instance NodeId::Rust1x1(id). The new DSP code is preserved for the first use of that node, and can also be swapped out at runtime anytime while the DSP graph is working.

See also crate::SynthConstructor::set_dynamic_node1x1

This method is to be used by the Rust1x1 node, to receive the dynamic node buffer.

Attention: If the buffer was already requested by a Rust1x1 constructor, a new internal buffer will be allocated and the previous DynNodeBuffer won’t receive any more updates. That means, after construction of a new Rust1x1, you should update the DynamicNode1x1 using NodeGlobalData::send_dynamic_node1x1. This will be very relevant to do after [crate::NodeConfigurator::set_sample_rate].

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.