Struct kira::sound::static_sound::StaticSoundSettings
source · [−]#[non_exhaustive]pub struct StaticSoundSettings {
pub start_time: StartTime,
pub start_position: f64,
pub volume: Volume,
pub playback_rate: PlaybackRate,
pub panning: f64,
pub reverse: bool,
pub loop_behavior: Option<LoopBehavior>,
pub track: TrackId,
pub fade_in_tween: Option<Tween>,
}
Expand description
Settings for a static sound.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.start_time: StartTime
When the sound should start playing.
start_position: f64
The initial playback position of the sound (in seconds).
volume: Volume
The volume of the sound.
playback_rate: PlaybackRate
The playback rate of the sound.
Changing the playback rate will change both the speed and the pitch of the sound.
panning: f64
The panning of the sound, where 0 is hard left and 1 is hard right.
reverse: bool
Whether the sound should play in reverse.
If set to true
, the start position will be relative
to the end of the sound.
loop_behavior: Option<LoopBehavior>
The looping behavior of the sound.
track: TrackId
The mixer track this sound should play on.
fade_in_tween: Option<Tween>
An optional fade-in from silence.
Implementations
sourceimpl StaticSoundSettings
impl StaticSoundSettings
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new StaticSoundSettings
with the default settings.
sourcepub fn start_time(self, start_time: impl Into<StartTime>) -> Self
pub fn start_time(self, start_time: impl Into<StartTime>) -> Self
Sets when the sound should start playing.
sourcepub fn start_position(self, start_position: f64) -> Self
pub fn start_position(self, start_position: f64) -> Self
Sets the initial playback position of the sound (in seconds).
sourcepub fn playback_rate(self, playback_rate: impl Into<PlaybackRate>) -> Self
pub fn playback_rate(self, playback_rate: impl Into<PlaybackRate>) -> Self
Sets the playback rate of the sound.
Changing the playback rate will change both the speed and the pitch of the sound.
sourcepub fn panning(self, panning: f64) -> Self
pub fn panning(self, panning: f64) -> Self
Sets the panning of the sound, where 0 is hard left and 1 is hard right.
sourcepub fn loop_behavior(
self,
loop_behavior: impl Into<Option<LoopBehavior>>
) -> Self
pub fn loop_behavior(
self,
loop_behavior: impl Into<Option<LoopBehavior>>
) -> Self
Sets the looping behavior of the sound.
sourcepub fn track(self, track: impl Into<TrackId>) -> Self
pub fn track(self, track: impl Into<TrackId>) -> Self
Sets the mixer track this sound should play on.
sourcepub fn fade_in_tween(self, fade_in_tween: impl Into<Option<Tween>>) -> Self
pub fn fade_in_tween(self, fade_in_tween: impl Into<Option<Tween>>) -> Self
Sets the tween used to fade in the sound from silence.
Trait Implementations
sourceimpl Clone for StaticSoundSettings
impl Clone for StaticSoundSettings
sourcefn clone(&self) -> StaticSoundSettings
fn clone(&self) -> StaticSoundSettings
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StaticSoundSettings
impl Debug for StaticSoundSettings
sourceimpl Default for StaticSoundSettings
impl Default for StaticSoundSettings
sourceimpl PartialEq<StaticSoundSettings> for StaticSoundSettings
impl PartialEq<StaticSoundSettings> for StaticSoundSettings
sourcefn eq(&self, other: &StaticSoundSettings) -> bool
fn eq(&self, other: &StaticSoundSettings) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &StaticSoundSettings) -> bool
fn ne(&self, other: &StaticSoundSettings) -> bool
This method tests for !=
.
impl Copy for StaticSoundSettings
impl StructuralPartialEq for StaticSoundSettings
Auto Trait Implementations
impl RefUnwindSafe for StaticSoundSettings
impl Send for StaticSoundSettings
impl Sync for StaticSoundSettings
impl Unpin for StaticSoundSettings
impl UnwindSafe for StaticSoundSettings
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, T> IntoSample<T> for F where
T: FromSample<F>,
impl<F, T> IntoSample<T> for F where
T: FromSample<F>,
fn into_sample(self) -> T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more