pub struct TimedEnumValues<I> { /* private fields */ }Expand description
Represents an enum value that changes over the course of a buffer.
Each point represents a change in value at a given sample offset - the value remains constant until the next point (or the end of the buffer)
Some invariants:
- There will always be at least one point
- The first point’s
sample_offsetwill be 0 sample_offsets will be monotonically increasing and only one point will appear for eachsample_offset- All point’s
valuewill be valid
Implementations§
Source§impl<I: IntoIterator<Item = TimedValue<u32>> + Clone> TimedEnumValues<I>
impl<I: IntoIterator<Item = TimedValue<u32>> + Clone> TimedEnumValues<I>
Sourcepub fn new(
points: I,
buffer_size: usize,
valid_range: Range<u32>,
) -> Option<Self>
pub fn new( points: I, buffer_size: usize, valid_range: Range<u32>, ) -> Option<Self>
Construct a new TimedEnumValues from an iterator of points.
This will check the invariants for the curve, and if any are invalid, this will
return None.
Note that here we refer to the enum by the index of the value,
that is, the index of the value in the values array of the parameter.
§Examples
assert!(TimedEnumValues::new(
vec![TimedValue { sample_offset: 0, value: 0 },
TimedValue { sample_offset: 100, value: 1 }],
128,
0..2,
).is_some());Source§impl<I> TimedEnumValues<I>
impl<I> TimedEnumValues<I>
Sourcepub fn buffer_size(&self) -> usize
pub fn buffer_size(&self) -> usize
Get the size of the buffer this curve is defined over.
Trait Implementations§
Source§impl<I: Clone> Clone for TimedEnumValues<I>
impl<I: Clone> Clone for TimedEnumValues<I>
Source§fn clone(&self) -> TimedEnumValues<I>
fn clone(&self) -> TimedEnumValues<I>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<I: IntoIterator<Item = TimedValue<u32>>> IntoIterator for TimedEnumValues<I>
impl<I: IntoIterator<Item = TimedValue<u32>>> IntoIterator for TimedEnumValues<I>
Auto Trait Implementations§
impl<I> Freeze for TimedEnumValues<I>where
I: Freeze,
impl<I> RefUnwindSafe for TimedEnumValues<I>where
I: RefUnwindSafe,
impl<I> Send for TimedEnumValues<I>where
I: Send,
impl<I> Sync for TimedEnumValues<I>where
I: Sync,
impl<I> Unpin for TimedEnumValues<I>where
I: Unpin,
impl<I> UnwindSafe for TimedEnumValues<I>where
I: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more