Struct comfy_wgpu::StaticSoundData
pub struct StaticSoundData {
pub sample_rate: u32,
pub frames: Arc<[Frame], Global>,
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: u32The sample rate of the audio (in Hz).
frames: Arc<[Frame], Global>The raw samples that make up the audio.
settings: StaticSoundSettingsSettings for the sound.
Implementations§
§impl StaticSoundData
impl StaticSoundData
pub 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.
pub fn from_cursor<T>(
cursor: Cursor<T>,
settings: StaticSoundSettings
) -> Result<StaticSoundData, FromFileError>where
T: AsRef<[u8]> + Send + Sync + 'static,
pub fn from_cursor<T>( cursor: Cursor<T>, settings: StaticSoundSettings ) -> Result<StaticSoundData, FromFileError>where T: AsRef<[u8]> + Send + Sync + 'static,
Loads a cursor wrapping audio file data into a StaticSoundData.
pub 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.
§impl StaticSoundData
impl StaticSoundData
pub 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.
pub 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§
§impl Clone for StaticSoundData
impl Clone for StaticSoundData
§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 more§impl Debug for StaticSoundData
impl Debug for StaticSoundData
§impl PartialEq<StaticSoundData> for StaticSoundData
impl PartialEq<StaticSoundData> for StaticSoundData
§fn eq(&self, other: &StaticSoundData) -> bool
fn eq(&self, other: &StaticSoundData) -> bool
This method tests for
self and other values to be equal, and is used
by ==.§impl SoundData for StaticSoundData
impl SoundData for StaticSoundData
§type Handle = StaticSoundHandle
type Handle = StaticSoundHandle
The type that can be used to control the sound once
it has started.
§fn into_sound(
self
) -> Result<(Box<dyn Sound, Global>, <StaticSoundData as SoundData>::Handle), <StaticSoundData as SoundData>::Error>
fn into_sound( self ) -> Result<(Box<dyn Sound, Global>, <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 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