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
impl Channel
pub const fn from_raw_parts(raw: *mut FMOD_CHANNEL, sound_ref: SoundRef) -> Self
Sourcepub fn get_channel_group(&self) -> Result<ChannelGroupRef, Error>
pub fn get_channel_group(&self) -> Result<ChannelGroupRef, Error>
Retrieves the currently assigned channel group for the channel
pub fn get_frequency(&self) -> Result<f32, Error>
Sourcepub fn get_index(&self) -> Result<i32, Error>
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.
pub fn get_loop_count(&self) -> Result<i32, Error>
pub fn get_loop_points( &self, loopstarttype: Timeunit, loopendtype: Timeunit, ) -> Result<(u32, u32), Error>
pub fn get_position(&self, timeunit: Timeunit) -> Result<u32, Error>
pub fn get_priority(&self) -> Result<i32, Error>
pub fn is_virtual(&self) -> Result<bool, Error>
pub fn set_frequency(&mut self, frequency: f32) -> Result<(), Error>
pub fn set_position( &mut self, position: u32, postype: Timeunit, ) -> Result<(), Error>
Trait Implementations§
Source§impl ChannelControl for Channel
impl ChannelControl for Channel
Source§fn add_dsp(&mut self, index: i32, dsp: &mut Dsp) -> Result<(), Error>
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 0DspIndex::Fader == -2
– built-in fader DSP; initially 0DspIndex::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>
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>
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>
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>
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>
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>
fn get_dsp(&self, index: i32) -> Result<DspRef, Error>
Retrieve the DSP unit at the specified index
Source§fn get_dsp_index(&self, dsp: &Dsp) -> Result<i32, Error>
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>
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>
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
.