pub struct StaticSoundData {
pub sample_rate: u32,
pub frames: Arc<[Frame]>,
pub settings: StaticSoundSettings,
}
Expand description
A piece of audio loaded into memory all at once.
These can be cheaply cloned, as the audio data is shared among all clones.
Fields§
§sample_rate: u32
The sample rate of the audio (in Hz).
frames: Arc<[Frame]>
The raw samples that make up the audio.
settings: StaticSoundSettings
Settings for the sound.
Implementations§
Source§impl StaticSoundData
impl StaticSoundData
Sourcepub fn from_file(
path: impl AsRef<Path>,
settings: StaticSoundSettings,
) -> Result<StaticSoundData, FromFileError>
pub fn from_file( path: impl AsRef<Path>, settings: StaticSoundSettings, ) -> Result<StaticSoundData, FromFileError>
Loads an audio file into a StaticSoundData
.
Sourcepub fn from_cursor<T>(
cursor: Cursor<T>,
settings: StaticSoundSettings,
) -> Result<StaticSoundData, FromFileError>
pub fn from_cursor<T>( cursor: Cursor<T>, settings: StaticSoundSettings, ) -> Result<StaticSoundData, FromFileError>
Loads a cursor wrapping audio file data into a StaticSoundData
.
Sourcepub fn from_media_source(
media_source: impl MediaSource + 'static,
settings: StaticSoundSettings,
) -> Result<StaticSoundData, FromFileError>
pub fn from_media_source( media_source: impl MediaSource + 'static, settings: StaticSoundSettings, ) -> Result<StaticSoundData, FromFileError>
Loads an audio file from a type that implements Symphonia’s MediaSource
trait.
Source§impl StaticSoundData
impl StaticSoundData
Sourcepub fn with_settings(&self, settings: StaticSoundSettings) -> StaticSoundData
pub fn with_settings(&self, settings: StaticSoundSettings) -> StaticSoundData
Returns a clone of the StaticSoundData
with the specified settings.
Sourcepub fn with_modified_settings(
&self,
f: impl FnOnce(StaticSoundSettings) -> StaticSoundSettings,
) -> StaticSoundData
pub fn with_modified_settings( &self, f: impl FnOnce(StaticSoundSettings) -> StaticSoundSettings, ) -> StaticSoundData
Returns a clone of the StaticSoundData
with the modified settings from
the given function.
Trait Implementations§
Source§impl Clone for StaticSoundData
impl Clone for StaticSoundData
Source§fn clone(&self) -> StaticSoundData
fn clone(&self) -> StaticSoundData
Returns a copy 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 Debug for StaticSoundData
impl Debug for StaticSoundData
Source§impl PartialEq for StaticSoundData
impl PartialEq for StaticSoundData
Source§impl SoundData for StaticSoundData
impl SoundData for StaticSoundData
Source§type Handle = StaticSoundHandle
type Handle = StaticSoundHandle
The type that can be used to control the sound once
it has started.
Source§fn into_sound(
self,
) -> Result<(Box<dyn Sound>, <StaticSoundData as SoundData>::Handle), <StaticSoundData as SoundData>::Error>
fn into_sound( self, ) -> Result<(Box<dyn Sound>, <StaticSoundData as SoundData>::Handle), <StaticSoundData as SoundData>::Error>
Converts the loaded sound into a live, playing sound
and a handle to control it. Read more
impl StructuralPartialEq for StaticSoundData
Auto Trait Implementations§
impl Freeze for StaticSoundData
impl RefUnwindSafe for StaticSoundData
impl Send for StaticSoundData
impl Sync for StaticSoundData
impl Unpin for StaticSoundData
impl UnwindSafe for StaticSoundData
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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