pub struct AudioClip { /* private fields */ }Expand description
Represents an audio clip
Used with the AudioSource component to play audio
Implementations§
source§impl 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§
source§impl PartialEq<AudioClip> for AudioClip
impl PartialEq<AudioClip> for AudioClip
source§impl ValueConverterTrait<AudioClip> for ValueConverter
impl ValueConverterTrait<AudioClip> for ValueConverter
source§fn into_value(v: AudioClip) -> Value
fn into_value(v: AudioClip) -> Value
Value enum.source§fn from_value(v: &Value) -> AudioClip
fn from_value(v: &Value) -> AudioClip
Value enum.