pub enum MusicalTransport {
Static(StaticTransport),
Dynamic(Arc<DynamicTransport>),
}Variants§
Static(StaticTransport)
A musical transport with a single static tempo in beats per minute.
Dynamic(Arc<DynamicTransport>)
A musical transport with multiple keyframes of tempo. The tempo immediately jumps from one keyframe to another (the tempo is NOT linearly interpolated between keyframes).
Implementations§
Source§impl MusicalTransport
impl MusicalTransport
Sourcepub fn beats_per_minute(&self) -> Option<f64>
pub fn beats_per_minute(&self) -> Option<f64>
Returns the beats per minute if this is of type MusicalTransport::Static,
None otherwise.
Sourcepub fn musical_to_seconds(
&self,
musical: InstantMusical,
transport_start: InstantSeconds,
speed_multiplier: f64,
) -> InstantSeconds
pub fn musical_to_seconds( &self, musical: InstantMusical, transport_start: InstantSeconds, speed_multiplier: f64, ) -> InstantSeconds
Convert the time in musical beats to the corresponding time in seconds.
musical- The time in musical beats to convert.transport_start- The instant of the start of the transport (musical time of0).speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.
Sourcepub fn musical_to_samples(
&self,
musical: InstantMusical,
transport_start: InstantSamples,
speed_multiplier: f64,
sample_rate: NonZeroU32,
) -> InstantSamples
pub fn musical_to_samples( &self, musical: InstantMusical, transport_start: InstantSamples, speed_multiplier: f64, sample_rate: NonZeroU32, ) -> InstantSamples
Convert the time in musical beats to the corresponding time in samples.
musical- The time in musical beats to convert.transport_start- The instant of the start of the transport (musical time of0).speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.sample_rate- The sample rate of the stream.
Sourcepub fn seconds_to_musical(
&self,
seconds: InstantSeconds,
transport_start: InstantSeconds,
speed_multiplier: f64,
) -> InstantMusical
pub fn seconds_to_musical( &self, seconds: InstantSeconds, transport_start: InstantSeconds, speed_multiplier: f64, ) -> InstantMusical
Convert the time in seconds to the corresponding time in musical beats.
seconds- The time in seconds to convert.transport_start- The instant of the start of the transport (musical time of0).speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.sample_rate- The sample rate of the stream.
Sourcepub fn samples_to_musical(
&self,
sample_time: InstantSamples,
transport_start: InstantSamples,
speed_multiplier: f64,
sample_rate: NonZeroU32,
sample_rate_recip: f64,
) -> InstantMusical
pub fn samples_to_musical( &self, sample_time: InstantSamples, transport_start: InstantSamples, speed_multiplier: f64, sample_rate: NonZeroU32, sample_rate_recip: f64, ) -> InstantMusical
Convert the time in samples to the corresponding time in musical beats.
sample_time- The time in samples to convert.transport_start- The instant of the start of the transport (musical time of0).speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.sample_rate- The sample rate of the stream.sample_rate- The reciprocal of the sample rate.
Sourcepub fn delta_seconds_from(
&self,
from: InstantMusical,
delta_seconds: DurationSeconds,
speed_multiplier: f64,
) -> InstantMusical
pub fn delta_seconds_from( &self, from: InstantMusical, delta_seconds: DurationSeconds, speed_multiplier: f64, ) -> InstantMusical
Return the musical time that occurs delta_seconds seconds after the
given from timestamp.
speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.
Sourcepub fn bpm_at_musical(
&self,
musical: InstantMusical,
speed_multiplier: f64,
) -> f64
pub fn bpm_at_musical( &self, musical: InstantMusical, speed_multiplier: f64, ) -> f64
Return the tempo in beats per minute at the given musical time.
speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.
Sourcepub fn proc_transport_info(
&self,
frames: usize,
playhead: InstantMusical,
speed_multiplier: f64,
sample_rate: NonZeroU32,
) -> ProcTransportInfo
pub fn proc_transport_info( &self, frames: usize, playhead: InstantMusical, speed_multiplier: f64, sample_rate: NonZeroU32, ) -> ProcTransportInfo
Return information about this transport for this processing block.
frames- The number of frames in this processing block.playhead- The current playhead of the transport at frame0in this processing block.speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.sample_rate- The sample rate of the stream.
Sourcepub fn transport_start(
&self,
now: InstantSamples,
playhead: InstantMusical,
speed_multiplier: f64,
sample_rate: NonZeroU32,
) -> InstantSamples
pub fn transport_start( &self, now: InstantSamples, playhead: InstantMusical, speed_multiplier: f64, sample_rate: NonZeroU32, ) -> InstantSamples
Return the instant the beginning of this transport (musical time of 0)
occurs on.
now- The current time in samples.playhead- The current playhead of the transport.speed_multiplier- A multiplier for the playback speed. A value of1.0means no change in speed, a value less than1.0means a decrease in speed, and a value greater than1.0means an increase in speed.sample_rate- The sample rate of the stream.
Trait Implementations§
Source§impl Clone for MusicalTransport
impl Clone for MusicalTransport
Source§fn clone(&self) -> MusicalTransport
fn clone(&self) -> MusicalTransport
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for MusicalTransport
impl Component for MusicalTransport
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
requiree: ComponentId,
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
inheritance_depth: u16,
recursion_check_stack: &mut Vec<ComponentId>,
)
fn register_required_components( requiree: ComponentId, components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, inheritance_depth: u16, recursion_check_stack: &mut Vec<ComponentId>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn map_entities<M: EntityMapper>(this: &mut Self, mapper: &mut M)
fn map_entities<M: EntityMapper>(this: &mut Self, mapper: &mut M)
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§fn register_component_hooks(hooks: &mut ComponentHooks)
fn register_component_hooks(hooks: &mut ComponentHooks)
Component::on_add, etc.)ComponentHooks.Source§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§impl Debug for MusicalTransport
impl Debug for MusicalTransport
Source§impl PartialEq for MusicalTransport
impl PartialEq for MusicalTransport
impl StructuralPartialEq for MusicalTransport
Auto Trait Implementations§
impl Freeze for MusicalTransport
impl RefUnwindSafe for MusicalTransport
impl Send for MusicalTransport
impl Sync for MusicalTransport
impl Unpin for MusicalTransport
impl UnwindSafe for MusicalTransport
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
Source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )
Source§fn register_required_components(
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
)
fn register_required_components( components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, )
Bundle.Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.