pub struct AudioStream { /* private fields */ }
Expand description
AudioStream, custom audio stream
Implementations§
Source§impl AudioStream
impl AudioStream
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Frequency (samples per second)
Sourcepub fn sample_size(&self) -> u32
pub fn sample_size(&self) -> u32
Bit depth (bits per sample): 8, 16, 32 (24 not supported)
Sourcepub fn new(sample_rate: u32, sample_size: u32, channels: u32) -> Option<Self>
pub fn new(sample_rate: u32, sample_size: u32, channels: u32) -> Option<Self>
Load audio stream (to stream raw audio pcm data)
Sourcepub fn is_processed(&self) -> bool
pub fn is_processed(&self) -> bool
Check if any audio stream buffers requires refill
Sourcepub fn play(&self, _device: &mut AudioDevice)
pub fn play(&self, _device: &mut AudioDevice)
Play audio stream
Sourcepub fn pause(&self, _device: &mut AudioDevice)
pub fn pause(&self, _device: &mut AudioDevice)
Pause audio stream
Sourcepub fn resume(&self, _device: &mut AudioDevice)
pub fn resume(&self, _device: &mut AudioDevice)
Resume audio stream
Sourcepub fn is_playing(&self, _device: &mut AudioDevice) -> bool
pub fn is_playing(&self, _device: &mut AudioDevice) -> bool
Check if audio stream is playing
Sourcepub fn stop(&self, _device: &mut AudioDevice)
pub fn stop(&self, _device: &mut AudioDevice)
Stop audio stream
Sourcepub fn set_volume(&self, volume: f32, _device: &mut AudioDevice)
pub fn set_volume(&self, volume: f32, _device: &mut AudioDevice)
Set volume for audio stream (1.0 is max level)
Sourcepub fn set_pitch(&self, pitch: f32, _device: &mut AudioDevice)
pub fn set_pitch(&self, pitch: f32, _device: &mut AudioDevice)
Set pitch for audio stream (1.0 is base level)
Sourcepub fn set_pan(&self, pan: f32, _device: &mut AudioDevice)
pub fn set_pan(&self, pan: f32, _device: &mut AudioDevice)
Set pan for audio stream (0.5 is centered)
Sourcepub fn set_default_buffer_size(size: usize)
pub fn set_default_buffer_size(size: usize)
Default size for new audio streams
Sourcepub fn as_raw(&self) -> &AudioStream
pub fn as_raw(&self) -> &AudioStream
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
Sourcepub fn as_raw_mut(&mut self) -> &mut AudioStream
pub fn as_raw_mut(&mut self) -> &mut AudioStream
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
Sourcepub unsafe fn from_raw(raw: AudioStream) -> Self
pub unsafe fn from_raw(raw: AudioStream) -> Self
Convert a ‘raw’ ffi object to a safe wrapper
§Safety
- The raw object must be correctly initialized
- The raw object should be unique. Otherwise, make sure its clones don’t outlive the newly created object.
Trait Implementations§
Source§impl Debug for AudioStream
impl Debug for AudioStream
Auto Trait Implementations§
impl Freeze for AudioStream
impl RefUnwindSafe for AudioStream
impl !Send for AudioStream
impl !Sync for AudioStream
impl Unpin for AudioStream
impl UnwindSafe for AudioStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more