pub struct AudioSource {
pub handle: AssetHandle<SoundData>,
pub volume: f32,
pub looping: bool,
pub autoplay: bool,
pub state: Option<PlaybackState>,
}Expand description
An ECS component that makes an entity an emitter of sound.
Fields§
§handle: AssetHandle<SoundData>A handle to the sound data to be played.
volume: f32The volume of the sound, where 1.0 is normal volume.
looping: boolWhether the sound should loop back to the beginning when it finishes.
autoplay: boolWhether the sound should start playing automatically when this component is added.
state: Option<PlaybackState>The internal playback state. This should be treated as read-only by most systems outside of the audio engine itself.
Implementations§
Trait Implementations§
Source§impl Clone for AudioSource
impl Clone for AudioSource
Source§fn clone(&self) -> AudioSource
fn clone(&self) -> AudioSource
Returns a duplicate 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 AudioSource
impl Debug for AudioSource
impl Component for AudioSource
Auto Trait Implementations§
impl Freeze for AudioSource
impl RefUnwindSafe for AudioSource
impl Send for AudioSource
impl Sync for AudioSource
impl Unpin for AudioSource
impl UnwindSafe for AudioSource
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<C1> ComponentBundle for C1where
C1: Component,
impl<C1> ComponentBundle for C1where
C1: Component,
Source§fn type_ids() -> Vec<TypeId>
fn type_ids() -> Vec<TypeId>
Returns the sorted list of
TypeIds for the components in this bundle. Read moreSource§fn create_columns() -> HashMap<TypeId, Box<dyn AnyVec>>
fn create_columns() -> HashMap<TypeId, Box<dyn AnyVec>>
Creates the set of empty, type-erased
Vec<T> columns required to store
this bundle’s components. Read moreSource§fn update_metadata(
metadata: &mut EntityMetadata,
location: PageIndex,
registry: &ComponentRegistry,
)
fn update_metadata( metadata: &mut EntityMetadata, location: PageIndex, registry: &ComponentRegistry, )
Updates the appropriate fields in an
EntityMetadata struct to point
to the location of this bundle’s data. Read moreSource§unsafe fn add_to_page(self, page: &mut ComponentPage)
unsafe fn add_to_page(self, page: &mut ComponentPage)
Adds the components from this bundle into the specified
ComponentPage. Read more