pub struct AudioClip { /* private fields */ }
Expand description
Represents an audio clip
Used with the AudioSource
component to play audio
Implementations
sourceimpl AudioClip
impl AudioClip
sourcepub fn new_ogg(data: &[u8]) -> Self
pub fn new_ogg(data: &[u8]) -> Self
Creates a new AudioClip
. This creates a data object in the host that can be shared
for multiple entities. Expects the data to be of ‘ogg’ type, otherwise invalid.
sourcepub fn new_wav(data: &[u8]) -> Self
pub fn new_wav(data: &[u8]) -> Self
Creates a new AudioClip
. This creates a data object in the host that can be shared
for multiple entities. Expects the data to be of ‘wav’ type, otherwise invalid.
sourcepub fn new(data: &[u8]) -> Option<Self>
pub fn new(data: &[u8]) -> Option<Self>
Creates a new AudioClip
. This creates a data object in the host that can be shared
for multiple entities. Will try to autodetect file format from the 4 first bytes in the data.
sourcepub fn from_resource(resource: AudioClipResource) -> Self
pub fn from_resource(resource: AudioClipResource) -> Self
Creates a new AudioClip
from a resource downloaded through the Resource Ark API
This creates a data object in the host that can be shared for multiple entities.
The provided resource must point to a loaded resource
sourcepub fn from_audio_module(
module_dependency_name: &'static str,
data: &[u8]
) -> Self
pub fn from_audio_module(
module_dependency_name: &'static str,
data: &[u8]
) -> Self
Creates the AudioClip
from an audio module name and data
.
module_dependency_name
is the module name, same as specified in module-dependencies in the Cargo.toml.
sourcepub fn from_audio_module_dynamic(
module_dependency_name: &str,
data: &[u8]
) -> Self
pub fn from_audio_module_dynamic(
module_dependency_name: &str,
data: &[u8]
) -> Self
Creates the AudioClip
from an audio module name and data
in a unsafe manner.
module_dependency_name
is the module name, same as specified in module-dependencies in the Cargo.toml.
Takes a non-’static str as parameter.
AudioClip::from_audio_module
should be preferred over this.
sourcepub fn info(&self) -> AudioClipInfo
pub fn info(&self) -> AudioClipInfo
Returns information about this AudioClip
.
sourcepub fn set_debug_name(&self, name: &str)
pub fn set_debug_name(&self, name: &str)
Sets a debug name of this data object. Useful for debugging memory usage and leaks.
Trait Implementations
sourceimpl PartialEq<AudioClip> for AudioClip
impl PartialEq<AudioClip> for AudioClip
sourceimpl ValueConverterTrait<AudioClip> for ValueConverter
impl ValueConverterTrait<AudioClip> for ValueConverter
sourcefn into_value(v: AudioClip) -> Value
fn into_value(v: AudioClip) -> Value
Wraps the passed-in value in a Value
enum.
sourcefn from_value(v: &Value) -> AudioClip
fn from_value(v: &Value) -> AudioClip
Extracts the value from a Value
enum.
impl StructuralPartialEq for AudioClip
Auto Trait Implementations
impl RefUnwindSafe for AudioClip
impl Send for AudioClip
impl Sync for AudioClip
impl Unpin for AudioClip
impl UnwindSafe for AudioClip
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