Channel

Struct Channel 

Source
pub struct Channel { /* private fields */ }
Expand description

A weak handle to a sound playing on a virtual channel.

If this channel is stolen by the priority system because another sound was played and no other channels were free, all subsequent method calls on this handle will return Error::ChannelStolen.

The handle will also return Error::InvalidHandle after the next call to system.update() if (non-looping) playback has reached the end of the sound, or if channel.stop() is called. Note that resetting the position before calling system.update() will not prevent the channel handle from being invalidated.

Note that the channel holds a weak reference to the sound that is playing. If the channel handle is dropped, but the sound is still alive, the channel will continue playing.

Implementations§

Source§

impl Channel

Source

pub const fn from_raw_parts(raw: *mut FMOD_CHANNEL, sound_ref: SoundRef) -> Self

Source

pub fn sound_ref(&self) -> SoundRef

Sound that the channel was assigned to play

Source

pub fn get_channel_group(&self) -> Result<ChannelGroupRef, Error>

Retrieves the currently assigned channel group for the channel

Source

pub fn get_frequency(&self) -> Result<f32, Error>

Source

pub fn get_index(&self) -> Result<i32, Error>

Retrieves the internal channel index for a channel.

Channel indices are in the range 0 to the maxchannels specified at System creation.

Source

pub fn get_loop_count(&self) -> Result<i32, Error>

Source

pub fn get_loop_points( &self, loopstarttype: Timeunit, loopendtype: Timeunit, ) -> Result<(u32, u32), Error>

Source

pub fn get_position(&self, timeunit: Timeunit) -> Result<u32, Error>

Source

pub fn get_priority(&self) -> Result<i32, Error>

Source

pub fn is_virtual(&self) -> Result<bool, Error>

Source

pub fn set_frequency(&mut self, frequency: f32) -> Result<(), Error>

Source

pub fn set_position( &mut self, position: u32, postype: Timeunit, ) -> Result<(), Error>

Trait Implementations§

Source§

impl ChannelControl for Channel

Source§

fn add_dsp(&mut self, index: i32, dsp: &mut Dsp) -> Result<(), Error>

Add a DSP to the DSP chain at the given index. Index must be a position in the range $[0, numDSPs]$, or else one of the special indices:

  • DspIndex::Head == -1 – head of the chain; always equal to 0
  • DspIndex::Fader == -2 – built-in fader DSP; initially 0
  • DspIndex::Tail == -3 – tail of the chain; equal to $numDSPs-1$
§Errors

An InvalidParam error will be returned if index > self.get_num_dsps().

Source§

fn get_3d_cone_settings(&self) -> Result<(f32, f32, f32), Error>

Retrieves the angles that define the sound_ref projection cone including the volume when outside the cone.

Returns (insideconeangle, outsideconeangle, outsidevolume).

Source§

fn get_3d_distance_filter(&self) -> Result<(bool, f32, f32), Error>

Retrieve the settings for the 3D distance filter properties for a Channel or Channel Group.

Returns (custom, customlevel, centerfreq).

Source§

fn get_3d_min_max_distance(&self) -> Result<(f32, f32), Error>

Retrieves the minimum and maximum audible distance

Source§

fn get_3d_occlusion(&self) -> Result<(f32, f32), Error>

Retrieves the occlusion factors.

Returns (directocclusion, reverbocclusion).

Source§

fn get_3d_spread(&self) -> Result<f32, Error>

Retrieves the spread of a 3D sound_ref in speaker space.

Returns the speaker spread angle.

Source§

fn get_dsp(&self, index: i32) -> Result<DspRef, Error>

Retrieve the DSP unit at the specified index

Source§

fn get_dsp_clock(&self) -> Result<u64, Error>

DSP clock value for the head DSP node

Source§

fn get_dsp_clock_parent(&self) -> Result<u64, Error>

DSP clock value for the tail DSP node

Source§

fn get_dsp_index(&self, dsp: &Dsp) -> Result<i32, Error>

Retrieve the index in the DSP chain of the provided DSP

Source§

fn get_num_dsps(&self) -> Result<u32, Error>

Retrieves the number of DSP units in the DSP chain

Source§

fn get_reverb_properties(&self, instance: i32) -> Result<f32, Error>

Retrieves the wet level (or send level) for a particular reverb instance.

Returns the send level for the signal to the reverb, from 0 (none) to 1.0 (full).

instance – Index of the particular reverb instance to target, from 0 to dsp::REVERB_MAXINSTANCES.

Source§

fn add_fade_point(&mut self, dspclock: u64, volume: f32) -> Result<(), Error>

Source§

fn get_3d_attributes(&self) -> Result<([f32; 3], [f32; 3]), Error>

Source§

fn get_3d_cone_orientation(&self) -> Result<[f32; 3], Error>

Source§

fn get_3d_custom_rolloff(&self) -> Result<Vec<[f32; 3]>, Error>

Source§

fn get_3d_doppler_level(&self) -> Result<f32, Error>

Source§

fn get_audibility(&self) -> Result<f32, Error>

Source§

fn get_delay(&self) -> Result<Delay, Error>

Source§

fn get_low_pass_gain(&self) -> Result<f32, Error>

Source§

fn get_mode(&self) -> Result<Mode, Error>

Source§

fn get_mute(&self) -> Result<bool, Error>

Source§

fn get_paused(&self) -> Result<bool, Error>

Source§

fn get_volume(&self) -> Result<f32, Error>

Source§

fn is_playing(&self) -> Result<bool, Error>

Source§

fn remove_dsp(&mut self, dsp: &mut Dsp) -> Result<(), Error>

Source§

fn set_3d_attributes( &mut self, pos: [f32; 3], vel: [f32; 3], ) -> Result<(), Error>

Source§

fn set_delay( &mut self, dspclock_start: u64, dspclock_end: u64, stopchannels: bool, ) -> Result<(), Error>

Source§

fn set_fade_point_ramp( &mut self, dspclock: u64, volume: f32, ) -> Result<(), Error>

Source§

fn set_mute(&mut self, mute: bool) -> Result<(), Error>

Source§

fn set_paused(&mut self, paused: bool) -> Result<(), Error>

Source§

fn set_reverb_properties( &mut self, instance: i32, wet: f32, ) -> Result<(), Error>

Set the wet level of a reverb instance. Read more
Source§

fn set_volume(&mut self, volume: f32) -> Result<(), Error>

Source§

fn stop(&mut self) -> Result<(), Error>

Source§

impl Clone for Channel

Source§

fn clone(&self) -> Channel

Returns a duplicate 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 Channel

Source§

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

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

impl PartialEq for Channel

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Channel

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.