[][src]Struct sdl2::mixer::Channel

pub struct Channel(pub i32);

Sound effect channel.

Methods

impl Channel[src]

pub fn all() -> Channel[src]

Represent for all channels (-1)

pub fn post() -> Channel[src]

This is the MIX_CHANNEL_POST (-2)

pub fn set_volume(self, volume: i32) -> i32[src]

Set the volume for any allocated channel.

pub fn get_volume(self) -> i32[src]

Returns the channels volume on scale of 0 to 128.

pub fn play(self, chunk: &Chunk, loops: i32) -> Result<Channel, String>[src]

Play chunk on channel, or if channel is -1, pick the first free unreserved channel.

pub fn play_timed(
    self,
    chunk: &Chunk,
    loops: i32,
    ticks: i32
) -> Result<Channel, String>
[src]

pub fn fade_in(
    self,
    chunk: &Chunk,
    loops: i32,
    ms: i32
) -> Result<Channel, String>
[src]

Play chunk on channel, or if channel is -1, pick the first free unreserved channel.

pub fn fade_in_timed(
    self,
    chunk: &Chunk,
    loops: i32,
    ms: i32,
    ticks: i32
) -> Result<Channel, String>
[src]

pub fn pause(self)[src]

Pause channel, or all playing channels if -1 is passed in.

pub fn resume(self)[src]

Unpause channel, or all playing and paused channels if -1 is passed in.

pub fn halt(self)[src]

Halt channel playback

pub fn expire(self, ticks: i32) -> i32[src]

Halt channel playback, after ticks milliseconds.

pub fn fade_out(self, ms: i32) -> i32[src]

Gradually fade out which channel over ms milliseconds starting from now.

pub fn is_playing(self) -> bool[src]

if channel is playing, or not.

pub fn is_paused(self) -> bool[src]

if channel is paused, or not.

pub fn get_fading(self) -> Fading[src]

if channel is fading in, out, or not

pub fn get_chunk(self) -> Option<Chunk>[src]

Get the most recent sample chunk pointer played on channel.

pub fn unregister_all_effects(self) -> Result<(), String>[src]

This removes all effects registered to channel.

pub fn set_panning(self, left: u8, right: u8) -> Result<(), String>[src]

Sets a panning effect, where left and right is the volume of the left and right channels. They range from 0 (silence) to 255 (loud).

pub fn unset_panning(self) -> Result<(), String>[src]

Unregisters panning effect.

pub fn set_distance(self, distance: u8) -> Result<(), String>[src]

This effect simulates a simple attenuation of volume due to distance. distance ranges from 0 (close/loud) to 255 (far/quiet).

pub fn unset_distance(self) -> Result<(), String>[src]

Unregisters distance effect.

pub fn set_position(self, angle: i16, distance: u8) -> Result<(), String>[src]

This effect emulates a simple 3D audio effect. angle ranges from 0 to 360 degrees going clockwise, where 0 is directly in front. distance ranges from 0 (close/loud) to 255 (far/quiet).

pub fn unset_position(self) -> Result<(), String>[src]

Unregisters position effect.

pub fn set_reverse_stereo(self, flip: bool) -> Result<(), String>[src]

Simple reverse stereo, swaps left and right channel sound. true for reverse, false to unregister effect.

Trait Implementations

impl Clone for Channel[src]

impl Copy for Channel[src]

impl Debug for Channel[src]

impl PartialEq<Channel> for Channel[src]

impl StructuralPartialEq for Channel[src]

Auto Trait Implementations

impl RefUnwindSafe for Channel

impl Send for Channel

impl Sync for Channel

impl Unpin for Channel

impl UnwindSafe for Channel

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.