Struct ark_api::world::AudioClip

source ·
pub struct AudioClip { /* private fields */ }
Expand description

Represents an audio clip

Used with the AudioSource component to play audio

Implementations§

source§

impl AudioClip

source

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.

source

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.

source

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.

source

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

source

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.

source

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.

source

pub fn info(&self) -> AudioClipInfo

Returns information about this AudioClip.

source

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 Clone for AudioClip

source§

fn clone(&self) -> AudioClip

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AudioClip

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq<AudioClip> for AudioClip

source§

fn eq(&self, other: &AudioClip) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ValueConverterTrait<AudioClip> for ValueConverter

source§

fn into_value(v: AudioClip) -> Value

Wraps the passed-in value in a Value enum.
source§

fn from_value(v: &Value) -> AudioClip

Extracts the value from a Value enum.
source§

impl StructuralPartialEq for AudioClip

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.