Struct vst::util::ParameterTransfer
source · pub struct ParameterTransfer { /* private fields */ }
Expand description
A set of parameters that can be shared between threads.
Supports efficient iteration over parameters that changed since last iteration.
Implementations§
source§impl ParameterTransfer
impl ParameterTransfer
sourcepub fn new(parameter_count: usize) -> Self
pub fn new(parameter_count: usize) -> Self
Create a new parameter set with parameter_count
parameters.
sourcepub fn set_parameter(&self, index: usize, value: f32)
pub fn set_parameter(&self, index: usize, value: f32)
Set the value of the parameter with index index
to value
and mark
it as changed.
sourcepub fn get_parameter(&self, index: usize) -> f32
pub fn get_parameter(&self, index: usize) -> f32
Get the current value of the parameter with index index
.
sourcepub fn iterate(&self, acquire: bool) -> ParameterTransferIterator<'_> ⓘ
pub fn iterate(&self, acquire: bool) -> ParameterTransferIterator<'_> ⓘ
Iterate over all parameters marked as changed. If acquire
is true
,
mark all returned parameters as no longer changed.
The iterator returns a pair of (index, value)
for each changed parameter.
When parameters have been changed on the current thread, the iterator is precise: it reports all changed parameters with the values they were last changed to.
When parameters are changed on a different thread, the iterator is conservative, in the sense that it is guaranteed to report changed parameters eventually, but if a parameter is changed multiple times in a short period of time, it may skip some of the changes (but never the last) and may report an extra, spurious change at the end.
The changed parameters are reported in increasing index order, and the same parameter is never reported more than once in the same iteration.