pub trait BufferStates {
// Required method
fn get_by_hash(
&self,
id_hash: IdHash,
) -> Option<BufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone, impl Iterator<Item = TimedValue<u32>> + Clone, impl Iterator<Item = TimedValue<bool>> + Clone>>;
// Provided methods
fn get(
&self,
unique_id: &str,
) -> Option<BufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone, impl Iterator<Item = TimedValue<u32>> + Clone, impl Iterator<Item = TimedValue<bool>> + Clone>> { ... }
fn numeric_by_hash(
&self,
param_id: IdHash,
) -> Option<NumericBufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone>> { ... }
fn get_numeric(
&self,
unique_id: &str,
) -> Option<NumericBufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone>> { ... }
fn enum_by_hash(
&self,
param_id: IdHash,
) -> Option<EnumBufferState<impl Iterator<Item = TimedValue<u32>> + Clone>> { ... }
fn get_enum(
&self,
unique_id: &str,
) -> Option<EnumBufferState<impl Iterator<Item = TimedValue<u32>> + Clone>> { ... }
fn switch_by_hash(
&self,
param_id: IdHash,
) -> Option<SwitchBufferState<impl Iterator<Item = TimedValue<bool>> + Clone>> { ... }
fn get_switch(
&self,
unique_id: &str,
) -> Option<SwitchBufferState<impl Iterator<Item = TimedValue<bool>> + Clone>> { ... }
}
Expand description
Represents the state of several parameters across a buffer.
Each parameter is represented by a BufferState
, which represents
a value for that parameter at each sample of the buffer.
To easily process parameters from this struct, you can use the
crate::pzip
macro, which converts a BufferStates
into a per-sample
iterator containing the values of each parameter you want to look at.
For more low-level usages, you can deal directly with the underlying BufferState
objects, which might yield higher performance in some cases than the crate::pzip
macro.
Most of the time, this trait will be provided by the Conformal framework. However, we provide simple implementations for this trait for testing or in other scenarios where you need to call process functions outside of Conformal.
ConstantBufferStates
- A simple implementation where all parameters are constant.RampedStatesMap
- A simple implementation where the parameter can be different at the start and end of the buffer.
Required Methods§
Sourcefn get_by_hash(
&self,
id_hash: IdHash,
) -> Option<BufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone, impl Iterator<Item = TimedValue<u32>> + Clone, impl Iterator<Item = TimedValue<bool>> + Clone>>
fn get_by_hash( &self, id_hash: IdHash, ) -> Option<BufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone, impl Iterator<Item = TimedValue<u32>> + Clone, impl Iterator<Item = TimedValue<bool>> + Clone>>
Get the state of a parameter by it’s hashed unique ID.
You can get the hash of a unique ID using hash_id
.
If there is no parameter with the given ID, this will return None
.
Provided Methods§
Sourcefn get(
&self,
unique_id: &str,
) -> Option<BufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone, impl Iterator<Item = TimedValue<u32>> + Clone, impl Iterator<Item = TimedValue<bool>> + Clone>>
fn get( &self, unique_id: &str, ) -> Option<BufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone, impl Iterator<Item = TimedValue<u32>> + Clone, impl Iterator<Item = TimedValue<bool>> + Clone>>
Get the state of a parameter by it’s unique ID.
If there is no parameter with the given ID, this will return None
.
Sourcefn numeric_by_hash(
&self,
param_id: IdHash,
) -> Option<NumericBufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone>>
fn numeric_by_hash( &self, param_id: IdHash, ) -> Option<NumericBufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone>>
Get the state of a numeric parameter by it’s hashed unique ID.
You can get the hash of a unique ID using hash_id
.
If there is no parameter with the given ID, or the parameter is not numeric,
this will return None
.
Sourcefn get_numeric(
&self,
unique_id: &str,
) -> Option<NumericBufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone>>
fn get_numeric( &self, unique_id: &str, ) -> Option<NumericBufferState<impl Iterator<Item = PiecewiseLinearCurvePoint> + Clone>>
Get the state of a numeric parameter by it’s unique ID.
If there is no parameter with the given ID, or the parameter is not numeric,
this will return None
.
Sourcefn enum_by_hash(
&self,
param_id: IdHash,
) -> Option<EnumBufferState<impl Iterator<Item = TimedValue<u32>> + Clone>>
fn enum_by_hash( &self, param_id: IdHash, ) -> Option<EnumBufferState<impl Iterator<Item = TimedValue<u32>> + Clone>>
Get the state of an enum parameter by it’s hashed unique ID.
You can get the hash of a unique ID using hash_id
.
If there is no parameter with the given ID, or the parameter is not an enum,
this will return None
.
Sourcefn get_enum(
&self,
unique_id: &str,
) -> Option<EnumBufferState<impl Iterator<Item = TimedValue<u32>> + Clone>>
fn get_enum( &self, unique_id: &str, ) -> Option<EnumBufferState<impl Iterator<Item = TimedValue<u32>> + Clone>>
Get the state of an enum parameter by it’s unique ID.
If there is no parameter with the given ID, or the parameter is not an enum,
this will return None
.
Sourcefn switch_by_hash(
&self,
param_id: IdHash,
) -> Option<SwitchBufferState<impl Iterator<Item = TimedValue<bool>> + Clone>>
fn switch_by_hash( &self, param_id: IdHash, ) -> Option<SwitchBufferState<impl Iterator<Item = TimedValue<bool>> + Clone>>
Get the state of a switch parameter by it’s hashed unique ID.
You can get the hash of a unique ID using hash_id
.
If there is no parameter with the given ID, or the parameter is not a switch,
this will return None
.
Sourcefn get_switch(
&self,
unique_id: &str,
) -> Option<SwitchBufferState<impl Iterator<Item = TimedValue<bool>> + Clone>>
fn get_switch( &self, unique_id: &str, ) -> Option<SwitchBufferState<impl Iterator<Item = TimedValue<bool>> + Clone>>
Get the state of a switch parameter by it’s unique ID.
If there is no parameter with the given ID, or the parameter is not a switch,
this will return None
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.