pub struct Soloud { /* private fields */ }
Expand description
Wrapper around the Soloud native object
Implementations§
source§impl Soloud
impl Soloud
sourcepub unsafe fn default_uninit() -> MaybeUninit<Self>
pub unsafe fn default_uninit() -> MaybeUninit<Self>
Creates an uninitialized instance of a Soloud engine
Safety
Creates an uninitialized instance of Soloud
sourcepub unsafe fn init(&mut self) -> Result<(), SoloudError>
pub unsafe fn init(&mut self) -> Result<(), SoloudError>
initialize an uninitialized instance of Soloud
Safety
initializes an uninitialized instance of Soloud
sourcepub fn default() -> Result<Self, SoloudError>
pub fn default() -> Result<Self, SoloudError>
Creates a default initialized instance of soloud
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
fn main() -> Result<(), Box<dyn std::error::Error>> {
let sl = Soloud::default()?;
let mut wav = audio::Wav::default();
let bytes = std::fs::read("sample.wav")?;
wav.load_mem(&bytes)?;
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
let mut filt = filter::EchoFilter::default();
filt.set_params(0.2)?; // Here sets the delay by default for echo filters
wav.load("sample.wav")?;
wav.set_filter(0, Some(&filt));
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
wav.load("song.mp3")?;
sl.play(&wav);
while sl.voice_count() > 0 {
// calls to play are non-blocking, so we put the thread to sleep
std::thread::sleep(std::time::Duration::from_millis(100));
}
// wav.load("Recording.mp3")?;
// sl.play(&wav);
// while sl.voice_count() > 0 {
// std::thread::sleep(std::time::Duration::from_millis(100));
// }
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
speech.set_text("Hello World")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("1 2 3")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("Can you hear me?")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
let strings: Vec<String> = std::env::args().collect();
if strings.len() < 2 {
speech.set_text("Please provide command line arguments!")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
} else {
for i in 1..strings.len() {
speech.set_text(&strings[i])?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
}
Ok(())
}
sourcepub fn init_ex(
&mut self,
flags: SoloudFlag,
backend: Backend,
samplerate: u32,
buf_size: u32,
channels: u32
) -> Result<(), SoloudError>
pub fn init_ex( &mut self, flags: SoloudFlag, backend: Backend, samplerate: u32, buf_size: u32, channels: u32 ) -> Result<(), SoloudError>
initialize an uninitialized instance of Soloud with extra args
sourcepub fn new(
flags: SoloudFlag,
backend: Backend,
samplerate: u32,
buf_size: u32,
channels: u32
) -> Result<Self, SoloudError>
pub fn new( flags: SoloudFlag, backend: Backend, samplerate: u32, buf_size: u32, channels: u32 ) -> Result<Self, SoloudError>
Creates a default initialized instance of soloud
sourcepub fn backend_id(&self) -> u32
pub fn backend_id(&self) -> u32
Gets the backend id
sourcepub fn backend_string(&self) -> String
pub fn backend_string(&self) -> String
Gets the backend name
sourcepub fn backend_channels(&self) -> u32
pub fn backend_channels(&self) -> u32
Get the backend channels
sourcepub fn backend_samplerate(&self) -> u32
pub fn backend_samplerate(&self) -> u32
Get the backend samplerate
sourcepub fn backend_buffer_size(&self) -> u32
pub fn backend_buffer_size(&self) -> u32
Get the backend buffer size
sourcepub fn set_speaker_position(
&mut self,
channel: u32,
x: f32,
y: f32,
z: f32
) -> Result<(), SoloudError>
pub fn set_speaker_position( &mut self, channel: u32, x: f32, y: f32, z: f32 ) -> Result<(), SoloudError>
Set speaker position
sourcepub fn speaker_position(
&self,
channel: u32
) -> Result<(f32, f32, f32), SoloudError>
pub fn speaker_position( &self, channel: u32 ) -> Result<(f32, f32, f32), SoloudError>
Get the speaker position
sourcepub fn play_ex<AS: AudioExt>(
&self,
sound: &AS,
volume: f32,
pan: f32,
paused: bool,
bus: Handle
) -> Handle
pub fn play_ex<AS: AudioExt>( &self, sound: &AS, volume: f32, pan: f32, paused: bool, bus: Handle ) -> Handle
Play audio with extra args
sourcepub fn play_clocked_ex<AS: AudioExt>(
&self,
sound_time: f64,
sound: &AS,
volume: f32,
pan: f32,
bus: Handle
) -> Handle
pub fn play_clocked_ex<AS: AudioExt>( &self, sound_time: f64, sound: &AS, volume: f32, pan: f32, bus: Handle ) -> Handle
Play clocked with extra args
sourcepub fn play_3d<AS: AudioExt>(
&self,
sound: &AS,
pos_x: f32,
pos_y: f32,
pos_z: f32
) -> Handle
pub fn play_3d<AS: AudioExt>( &self, sound: &AS, pos_x: f32, pos_y: f32, pos_z: f32 ) -> Handle
Play 3D
sourcepub fn play_3d_ex<AS: AudioExt>(
&self,
sound: &AS,
pos_x: f32,
pos_y: f32,
pos_z: f32,
vel_x: f32,
vel_y: f32,
vel_z: f32,
volume: f32,
paused: bool,
bus: Handle
) -> Handle
pub fn play_3d_ex<AS: AudioExt>( &self, sound: &AS, pos_x: f32, pos_y: f32, pos_z: f32, vel_x: f32, vel_y: f32, vel_z: f32, volume: f32, paused: bool, bus: Handle ) -> Handle
Play 3D with extra args
sourcepub fn play_3d_clocked<AS: AudioExt>(
&self,
sound_time: f64,
sound: &AS,
pos_x: f32,
pos_y: f32,
pos_z: f32
) -> Handle
pub fn play_3d_clocked<AS: AudioExt>( &self, sound_time: f64, sound: &AS, pos_x: f32, pos_y: f32, pos_z: f32 ) -> Handle
Play 3D clocked
sourcepub fn play_3d_clocked_ex<AS: AudioExt>(
&self,
sound_time: f64,
sound: &AS,
pos_x: f32,
pos_y: f32,
pos_z: f32,
vel_x: f32,
vel_y: f32,
vel_z: f32,
volume: f32,
bus: Handle
) -> Handle
pub fn play_3d_clocked_ex<AS: AudioExt>( &self, sound_time: f64, sound: &AS, pos_x: f32, pos_y: f32, pos_z: f32, vel_x: f32, vel_y: f32, vel_z: f32, volume: f32, bus: Handle ) -> Handle
Play 3D clocked with extra args
sourcepub fn play_background<AS: AudioExt>(&self, sound: &AS) -> Handle
pub fn play_background<AS: AudioExt>(&self, sound: &AS) -> Handle
Play in the background
sourcepub fn play_background_ex<AS: AudioExt>(
&self,
sound: &AS,
volume: f32,
paused: bool,
bus: Handle
) -> Handle
pub fn play_background_ex<AS: AudioExt>( &self, sound: &AS, volume: f32, paused: bool, bus: Handle ) -> Handle
Play in the background with extra args
sourcepub fn seek(
&self,
voice_handle: Handle,
seconds: f64
) -> Result<(), SoloudError>
pub fn seek( &self, voice_handle: Handle, seconds: f64 ) -> Result<(), SoloudError>
Seek in seconds
sourcepub fn play<T: AudioExt>(&self, sound: &T) -> Handle
pub fn play<T: AudioExt>(&self, sound: &T) -> Handle
Play audio, returns a handle identifying the played audio
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
fn main() -> Result<(), Box<dyn std::error::Error>> {
let sl = Soloud::default()?;
let mut wav = audio::Wav::default();
let bytes = std::fs::read("sample.wav")?;
wav.load_mem(&bytes)?;
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
let mut filt = filter::EchoFilter::default();
filt.set_params(0.2)?; // Here sets the delay by default for echo filters
wav.load("sample.wav")?;
wav.set_filter(0, Some(&filt));
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
wav.load("song.mp3")?;
sl.play(&wav);
while sl.voice_count() > 0 {
// calls to play are non-blocking, so we put the thread to sleep
std::thread::sleep(std::time::Duration::from_millis(100));
}
// wav.load("Recording.mp3")?;
// sl.play(&wav);
// while sl.voice_count() > 0 {
// std::thread::sleep(std::time::Duration::from_millis(100));
// }
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
speech.set_text("Hello World")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("1 2 3")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("Can you hear me?")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
let strings: Vec<String> = std::env::args().collect();
if strings.len() < 2 {
speech.set_text("Please provide command line arguments!")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
} else {
for i in 1..strings.len() {
speech.set_text(&strings[i])?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
}
Ok(())
}
sourcepub fn active_voice_count(&self) -> u32
pub fn active_voice_count(&self) -> u32
Get active voice count
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
speech.set_text("Hello World")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("1 2 3")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("Can you hear me?")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
let strings: Vec<String> = std::env::args().collect();
if strings.len() < 2 {
speech.set_text("Please provide command line arguments!")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
} else {
for i in 1..strings.len() {
speech.set_text(&strings[i])?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
}
Ok(())
}
sourcepub fn voice_count(&self) -> u32
pub fn voice_count(&self) -> u32
Get voice count
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
fn main() -> Result<(), Box<dyn std::error::Error>> {
let sl = Soloud::default()?;
let mut wav = audio::Wav::default();
let bytes = std::fs::read("sample.wav")?;
wav.load_mem(&bytes)?;
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
let mut filt = filter::EchoFilter::default();
filt.set_params(0.2)?; // Here sets the delay by default for echo filters
wav.load("sample.wav")?;
wav.set_filter(0, Some(&filt));
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
wav.load("song.mp3")?;
sl.play(&wav);
while sl.voice_count() > 0 {
// calls to play are non-blocking, so we put the thread to sleep
std::thread::sleep(std::time::Duration::from_millis(100));
}
// wav.load("Recording.mp3")?;
// sl.play(&wav);
// while sl.voice_count() > 0 {
// std::thread::sleep(std::time::Duration::from_millis(100));
// }
Ok(())
}
sourcepub fn set_global_volume(&mut self, val: f32)
pub fn set_global_volume(&mut self, val: f32)
Set global volume
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
let mut filt = filter::EchoFilter::default();
filt.set_params(0.2)?; // Here sets the delay by default for echo filters
wav.load("sample.wav")?;
wav.set_filter(0, Some(&filt));
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
wav.load("song.mp3")?;
sl.play(&wav);
while sl.voice_count() > 0 {
// calls to play are non-blocking, so we put the thread to sleep
std::thread::sleep(std::time::Duration::from_millis(100));
}
// wav.load("Recording.mp3")?;
// sl.play(&wav);
// while sl.voice_count() > 0 {
// std::thread::sleep(std::time::Duration::from_millis(100));
// }
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
speech.set_text("Hello World")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("1 2 3")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
speech.set_text("Can you hear me?")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
Ok(())
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut sl = Soloud::default()?;
sl.set_global_volume(4.0);
let mut speech = audio::Speech::default();
let strings: Vec<String> = std::env::args().collect();
if strings.len() < 2 {
speech.set_text("Please provide command line arguments!")?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
} else {
for i in 1..strings.len() {
speech.set_text(&strings[i])?;
sl.play(&speech);
while sl.active_voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
}
Ok(())
}
sourcepub fn stop_audio_source<AS: AudioExt>(&self, sound: &AS)
pub fn stop_audio_source<AS: AudioExt>(&self, sound: &AS)
Stop audio source
sourcepub fn count_audio_source<AS: AudioExt>(&self, sound: &AS) -> i32
pub fn count_audio_source<AS: AudioExt>(&self, sound: &AS) -> i32
Count audio source
sourcepub fn stream_time(&self, voice_handle: Handle) -> f64
pub fn stream_time(&self, voice_handle: Handle) -> f64
Get stream time
sourcepub fn stream_position(&self, voice_handle: Handle) -> f64
pub fn stream_position(&self, voice_handle: Handle) -> f64
Get stream position
sourcepub fn overall_volume(&self, voice_handle: Handle) -> f32
pub fn overall_volume(&self, voice_handle: Handle) -> f32
Get overall volume
sourcepub fn samplerate(&self, voice_handle: Handle) -> f32
pub fn samplerate(&self, voice_handle: Handle) -> f32
Get samplerate of audio
sourcepub fn protect_voice(&self, voice_handle: Handle) -> bool
pub fn protect_voice(&self, voice_handle: Handle) -> bool
Return whether protect voice is set
sourcepub fn is_valid_voice_handle(&self, voice_handle: Handle) -> bool
pub fn is_valid_voice_handle(&self, voice_handle: Handle) -> bool
Check whether a handle is a valid voice handle
sourcepub fn relative_play_speed(&self, voice_handle: Handle) -> f32
pub fn relative_play_speed(&self, voice_handle: Handle) -> f32
Get relative play speed
sourcepub fn post_clip_scaler(&self) -> f32
pub fn post_clip_scaler(&self) -> f32
Get post clip scaler
sourcepub fn main_resampler(&self) -> Resampler
pub fn main_resampler(&self) -> Resampler
Get main resampler
sourcepub fn global_volume(&self) -> f32
pub fn global_volume(&self) -> f32
Get global volume
sourcepub fn max_active_voice_count(&self) -> u32
pub fn max_active_voice_count(&self) -> u32
Get max active voice count
sourcepub fn loop_point(&self, voice_handle: Handle) -> f64
pub fn loop_point(&self, voice_handle: Handle) -> f64
Get loop point
sourcepub fn set_loop_point(&mut self, voice_handle: Handle, loop_point: f64)
pub fn set_loop_point(&mut self, voice_handle: Handle, loop_point: f64)
Set loop point
sourcepub fn set_looping(&mut self, voice_handle: Handle, flag: bool)
pub fn set_looping(&mut self, voice_handle: Handle, flag: bool)
Set whether audio is looping
sourcepub fn set_auto_stop(&mut self, voice_handle: Handle, flag: bool)
pub fn set_auto_stop(&mut self, voice_handle: Handle, flag: bool)
Set auto stop
sourcepub fn set_max_active_voice_count(
&mut self,
count: u32
) -> Result<(), SoloudError>
pub fn set_max_active_voice_count( &mut self, count: u32 ) -> Result<(), SoloudError>
Set max active voice count
sourcepub fn set_inaudible_behavior(
&mut self,
voice_handle: Handle,
must_tick: bool,
kill: bool
)
pub fn set_inaudible_behavior( &mut self, voice_handle: Handle, must_tick: bool, kill: bool )
Set inaudible behaviour
sourcepub fn set_post_clip_scaler(&mut self, scaler: f32)
pub fn set_post_clip_scaler(&mut self, scaler: f32)
Set post clip scaler
sourcepub fn set_main_resampler(&mut self, resampler: Resampler)
pub fn set_main_resampler(&mut self, resampler: Resampler)
Set main resampler
sourcepub fn set_pause_all(&mut self, flag: bool)
pub fn set_pause_all(&mut self, flag: bool)
Set pause for all handles
sourcepub fn set_relative_play_speed(
&mut self,
voice_handle: Handle,
speed: f32
) -> Result<(), SoloudError>
pub fn set_relative_play_speed( &mut self, voice_handle: Handle, speed: f32 ) -> Result<(), SoloudError>
Set relative play speed
sourcepub fn set_protect_voice(&mut self, voice_handle: Handle, flag: bool)
pub fn set_protect_voice(&mut self, voice_handle: Handle, flag: bool)
Set whether an audio source has protect voice
sourcepub fn set_samplerate(&mut self, voice_handle: Handle, samplerate: f32)
pub fn set_samplerate(&mut self, voice_handle: Handle, samplerate: f32)
Set samplerate
sourcepub fn set_pan_absolute(
&mut self,
voice_handle: Handle,
lvolume: f32,
rvolume: f32
)
pub fn set_pan_absolute( &mut self, voice_handle: Handle, lvolume: f32, rvolume: f32 )
Set pan absolute
sourcepub fn set_channel_volume(
&mut self,
voice_handle: Handle,
channel: u32,
volume: f32
)
pub fn set_channel_volume( &mut self, voice_handle: Handle, channel: u32, volume: f32 )
Set channel volume
sourcepub fn set_volume(&mut self, voice_handle: Handle, volume: f32)
pub fn set_volume(&mut self, voice_handle: Handle, volume: f32)
Set volume by handle
sourcepub fn set_delay_samples(&mut self, voice_handle: Handle, samples: u32)
pub fn set_delay_samples(&mut self, voice_handle: Handle, samples: u32)
Set delay samples
sourcepub fn fade_volume(&self, voice_handle: Handle, to: f32, time: f64)
pub fn fade_volume(&self, voice_handle: Handle, to: f32, time: f64)
Set up volume fader
sourcepub fn fade_relative_play_speed(&self, voice_handle: Handle, to: f32, time: f64)
pub fn fade_relative_play_speed(&self, voice_handle: Handle, to: f32, time: f64)
Set fader relative play speed
sourcepub fn fade_global_volume(&self, to: f32, time: f64)
pub fn fade_global_volume(&self, to: f32, time: f64)
Set fader global volume
sourcepub fn schedule_pause(&self, voice_handle: Handle, time: f64)
pub fn schedule_pause(&self, voice_handle: Handle, time: f64)
Schedule a pause
sourcepub fn schedule_stop(&self, voice_handle: Handle, time: f64)
pub fn schedule_stop(&self, voice_handle: Handle, time: f64)
Schedule a stop
sourcepub fn oscillate_volume(
&self,
voice_handle: Handle,
from: f32,
to: f32,
time: f64
)
pub fn oscillate_volume( &self, voice_handle: Handle, from: f32, to: f32, time: f64 )
Set up volume oscillator
sourcepub fn oscillate_pan(&self, voice_handle: Handle, from: f32, to: f32, time: f64)
pub fn oscillate_pan(&self, voice_handle: Handle, from: f32, to: f32, time: f64)
Set up panning oscillator
sourcepub fn oscillate_relative_play_speed(
&self,
voice_handle: Handle,
from: f32,
to: f32,
time: f64
)
pub fn oscillate_relative_play_speed( &self, voice_handle: Handle, from: f32, to: f32, time: f64 )
Oscillator relative play speed
sourcepub fn oscillate_global_volume(&self, from: f32, to: f32, time: f64)
pub fn oscillate_global_volume(&self, from: f32, to: f32, time: f64)
Get oscillator global volume
sourcepub fn set_visualize_enable(&self, flag: bool)
pub fn set_visualize_enable(&self, flag: bool)
Enable visualizations
sourcepub fn calc_fft(&self) -> Vec<f32>
pub fn calc_fft(&self) -> Vec<f32>
Calculate and get 256 floats of FFT data for visualization. Visualization has to be enabled before use
sourcepub fn wave(&self) -> Vec<f32>
pub fn wave(&self) -> Vec<f32>
Get 256 floats of wave data for visualization. Visualization has to be enabled before use
sourcepub fn approximate_volume(&self, channel: u32) -> f32
pub fn approximate_volume(&self, channel: u32) -> f32
Get approximate volume
sourcepub fn loop_count(&self, voice_handle: Handle) -> u32
pub fn loop_count(&self, voice_handle: Handle) -> u32
Get loop count
sourcepub fn create_voice_group(&self) -> Handle
pub fn create_voice_group(&self) -> Handle
Create a voice group
sourcepub fn destroy_voice_group(
&self,
voice_group_handle: Handle
) -> Result<(), SoloudError>
pub fn destroy_voice_group( &self, voice_group_handle: Handle ) -> Result<(), SoloudError>
Destroy a voice group
sourcepub fn add_voice_to_group(
&self,
voice_group_handle: Handle,
voice_handle: Handle
) -> Result<(), SoloudError>
pub fn add_voice_to_group( &self, voice_group_handle: Handle, voice_handle: Handle ) -> Result<(), SoloudError>
Add a voice handle to a voice group
sourcepub fn is_voice_group(&self, voice_group_handle: Handle) -> bool
pub fn is_voice_group(&self, voice_group_handle: Handle) -> bool
Check whether a handle is of a voice group
sourcepub fn is_voice_group_empty(&self, voice_group_handle: Handle) -> bool
pub fn is_voice_group_empty(&self, voice_group_handle: Handle) -> bool
Check whether a voice group is empty
sourcepub fn update_3d_audio(&self)
pub fn update_3d_audio(&self)
Update 3D audio
sourcepub fn set_3d_sound_speed(&self, speed: f32) -> Result<(), SoloudError>
pub fn set_3d_sound_speed(&self, speed: f32) -> Result<(), SoloudError>
Set 3D sound speed
sourcepub fn get_3d_sound_speed(&self) -> f32
pub fn get_3d_sound_speed(&self) -> f32
Get 3d sound speed
sourcepub fn set_3d_listener_params(
&mut self,
pos_x: f32,
pos_y: f32,
pos_z: f32,
at_x: f32,
at_y: f32,
at_z: f32,
up_x: f32,
up_y: f32,
up_z: f32
)
pub fn set_3d_listener_params( &mut self, pos_x: f32, pos_y: f32, pos_z: f32, at_x: f32, at_y: f32, at_z: f32, up_x: f32, up_y: f32, up_z: f32 )
Set 3D listener parameters
sourcepub fn set_3d_listener_params_ex(
&mut self,
pos_x: f32,
pos_y: f32,
pos_z: f32,
at_x: f32,
at_y: f32,
at_z: f32,
up_x: f32,
up_y: f32,
up_z: f32,
velocity_x: f32,
velocity_y: f32,
velocity_z: f32
)
pub fn set_3d_listener_params_ex( &mut self, pos_x: f32, pos_y: f32, pos_z: f32, at_x: f32, at_y: f32, at_z: f32, up_x: f32, up_y: f32, up_z: f32, velocity_x: f32, velocity_y: f32, velocity_z: f32 )
Set 3D listerner parameters with extra args
sourcepub fn set_3d_listener_position(&mut self, pos_x: f32, pos_y: f32, pos_z: f32)
pub fn set_3d_listener_position(&mut self, pos_x: f32, pos_y: f32, pos_z: f32)
Set 3D listener position
sourcepub fn set_3d_listener_at(&mut self, at_x: f32, at_y: f32, at_z: f32)
pub fn set_3d_listener_at(&mut self, at_x: f32, at_y: f32, at_z: f32)
Set 3D listener position with extra params
sourcepub fn set_3d_listener_up(&mut self, up_x: f32, up_y: f32, up_z: f32)
pub fn set_3d_listener_up(&mut self, up_x: f32, up_y: f32, up_z: f32)
Set up 3D listener
sourcepub fn set_3d_listener_velocity(
&mut self,
velocity_x: f32,
velocity_y: f32,
velocity_z: f32
)
pub fn set_3d_listener_velocity( &mut self, velocity_x: f32, velocity_y: f32, velocity_z: f32 )
Set 3D listener velocity
sourcepub fn set_3d_source_params(
&mut self,
voice_handle: Handle,
pos_x: f32,
pos_y: f32,
pos_z: f32
)
pub fn set_3d_source_params( &mut self, voice_handle: Handle, pos_x: f32, pos_y: f32, pos_z: f32 )
Set 3D source parameters
sourcepub fn set_3d_source_params_ex(
&mut self,
voice_handle: Handle,
pos_x: f32,
pos_y: f32,
pos_z: f32,
velocity_x: f32,
velocity_y: f32,
velocity_z: f32
)
pub fn set_3d_source_params_ex( &mut self, voice_handle: Handle, pos_x: f32, pos_y: f32, pos_z: f32, velocity_x: f32, velocity_y: f32, velocity_z: f32 )
Set 3D source parameters
sourcepub fn set_3d_source_position(
&mut self,
voice_handle: Handle,
pos_x: f32,
pos_y: f32,
pos_z: f32
)
pub fn set_3d_source_position( &mut self, voice_handle: Handle, pos_x: f32, pos_y: f32, pos_z: f32 )
Set 3D source position
sourcepub fn set_3d_source_velocity(
&mut self,
voice_handle: Handle,
velocity_x: f32,
velocity_y: f32,
velocity_z: f32
)
pub fn set_3d_source_velocity( &mut self, voice_handle: Handle, velocity_x: f32, velocity_y: f32, velocity_z: f32 )
Set 3D source velocity
sourcepub fn set_3d_source_minmax_distance(
&mut self,
voice_handle: Handle,
min_distance: f32,
max_distance: f32
)
pub fn set_3d_source_minmax_distance( &mut self, voice_handle: Handle, min_distance: f32, max_distance: f32 )
Set 3D source min and max distances
sourcepub fn set_3d_source_attenuation(
&mut self,
voice_handle: Handle,
model: AttenuationModel,
rolloff_factor: f32
)
pub fn set_3d_source_attenuation( &mut self, voice_handle: Handle, model: AttenuationModel, rolloff_factor: f32 )
Set 3D source attenuation
sourcepub fn set_3d_source_doppler_factor(
&mut self,
voice_handle: Handle,
doppler_factor: f32
)
pub fn set_3d_source_doppler_factor( &mut self, voice_handle: Handle, doppler_factor: f32 )
Set 3D source doppler factor
sourcepub fn mix(&mut self, buffer: &mut [f32])
pub fn mix(&mut self, buffer: &mut [f32])
The back-end can call the mix function to request a number of stereo samples from SoLoud. The samples will be in float format, and the back-end is responsible for converting them to the desired output format.
sourcepub fn mix_signed_16(&mut self, buffer: &mut [i16])
pub fn mix_signed_16(&mut self, buffer: &mut [i16])
Since so many back-ends prefer 16 bit signed data instead of float data, SoLoud also provides a mix call that outputs signed 16 bit data.
sourcepub fn set_filter_param(
&mut self,
voice_handle: Handle,
filter_id: u32,
attr: impl FilterAttr,
val: f32
)
pub fn set_filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr, val: f32 )
Set filter parameters
sourcepub fn filter_param(
&mut self,
voice_handle: Handle,
filter_id: u32,
attr: impl FilterAttr
) -> f32
pub fn filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr ) -> f32
Get filter parameter by filter id
sourcepub fn fade_filter_param(
&mut self,
voice_handle: Handle,
filter_id: u32,
attr: impl FilterAttr,
to: f32,
time: f64
)
pub fn fade_filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr, to: f32, time: f64 )
Get fader filter params
sourcepub fn oscillate_filter_param(
&mut self,
voice_handle: Handle,
filter_id: u32,
attr: impl FilterAttr,
from: f32,
to: f32,
time: f64
)
pub fn oscillate_filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr, from: f32, to: f32, time: f64 )
Get oscillator filter params
sourcepub fn set_global_filter(&mut self, filter_id: u32, filter: impl FilterExt)
pub fn set_global_filter(&mut self, filter_id: u32, filter: impl FilterExt)
Set a global filter