pub struct Sampler {
pub node: GraphNode,
/* private fields */
}Expand description
A node that can play or loop a sample
Fields§
§node: GraphNodeThe node to connect to the audio graph
Implementations§
Source§impl Sampler
impl Sampler
Sourcepub fn new_with_event_capacity(
context: &dyn Context,
sample: OwnedAudioBuffer,
capacity: usize,
) -> Self
pub fn new_with_event_capacity( context: &dyn Context, sample: OwnedAudioBuffer, capacity: usize, ) -> Self
Create a Sampler with a specified capacity of events in the event queue
Sourcepub fn new(context: &dyn Context, sample: OwnedAudioBuffer) -> Self
pub fn new(context: &dyn Context, sample: OwnedAudioBuffer) -> Self
Create a new sampler with the given sample
Sourcepub fn start_from_position_at_time(
&mut self,
start_time: Timestamp,
position_in_sample: Timestamp,
)
pub fn start_from_position_at_time( &mut self, start_time: Timestamp, position_in_sample: Timestamp, )
Start from the specified time, at the specified position in the sample
Sourcepub fn stop_at_time(&mut self, stop_time: Timestamp)
pub fn stop_at_time(&mut self, stop_time: Timestamp)
Stop at the specified time
Sourcepub fn enable_loop(&mut self, loop_start: Timestamp, loop_end: Timestamp)
pub fn enable_loop(&mut self, loop_start: Timestamp, loop_end: Timestamp)
Enable looping
§Arguments
loop_start- The position in the sample to start the looploop_end- The position in the sample to go back toloop_start
Sourcepub fn cancel_loop(&mut self)
pub fn cancel_loop(&mut self)
Cancel a loop
This will clear the loop points and finish when it reaches the end of the sample
Sourcepub fn cancel_all(&mut self)
pub fn cancel_all(&mut self)
Cancel all scheduled events that haven’t occurred yet
Sourcepub fn enable_loop_at_time(
&mut self,
enable_at_time: Timestamp,
loop_start: Timestamp,
loop_end: Timestamp,
)
pub fn enable_loop_at_time( &mut self, enable_at_time: Timestamp, loop_start: Timestamp, loop_end: Timestamp, )
Enable loop at a time
§Arguments
enable_at_time- The time to enable loop pointsloop_start- The position in the loop to start loopingloop_end- The position in the loop to go back to the start
Sourcepub fn cancel_loop_at_time(&mut self, cancel_time: Timestamp)
pub fn cancel_loop_at_time(&mut self, cancel_time: Timestamp)
Cancel the loop at a time
Auto Trait Implementations§
impl Freeze for Sampler
impl !RefUnwindSafe for Sampler
impl !Send for Sampler
impl !Sync for Sampler
impl Unpin for Sampler
impl !UnwindSafe for Sampler
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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 moreSource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
Source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
Source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
Source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.