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?
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let sl = Soloud::default()?;
5
6 let mut wav = audio::Wav::default();
7
8 let bytes = std::fs::read("sample.wav")?;
9
10 wav.load_mem(&bytes)?;
11
12 sl.play(&wav);
13 while sl.voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 Ok(())
18}
More examples
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8 let mut filt = filter::EchoFilter::default();
9 filt.set_params(0.2)?; // Here sets the delay by default for echo filters
10
11 wav.load("sample.wav")?;
12 wav.set_filter(0, Some(&filt));
13
14 sl.play(&wav);
15 while sl.voice_count() > 0 {
16 std::thread::sleep(std::time::Duration::from_millis(100));
17 }
18
19 Ok(())
20}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8
9 wav.load("song.mp3")?;
10
11 sl.play(&wav);
12 while sl.voice_count() > 0 {
13 // calls to play are non-blocking, so we put the thread to sleep
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 // wav.load("Recording.mp3")?;
18
19 // sl.play(&wav);
20 // while sl.voice_count() > 0 {
21 // std::thread::sleep(std::time::Duration::from_millis(100));
22 // }
23
24 Ok(())
25}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6
7 let mut speech = audio::Speech::default();
8
9 speech.set_text("Hello World")?;
10
11 sl.play(&speech);
12 while sl.active_voice_count() > 0 {
13 std::thread::sleep(std::time::Duration::from_millis(100));
14 }
15
16 speech.set_text("1 2 3")?;
17
18 sl.play(&speech);
19 while sl.active_voice_count() > 0 {
20 std::thread::sleep(std::time::Duration::from_millis(100));
21 }
22
23 speech.set_text("Can you hear me?")?;
24
25 sl.play(&speech);
26 while sl.active_voice_count() > 0 {
27 std::thread::sleep(std::time::Duration::from_millis(100));
28 }
29
30 Ok(())
31}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6 let mut speech = audio::Speech::default();
7
8 let strings: Vec<String> = std::env::args().collect();
9
10 if strings.len() < 2 {
11 speech.set_text("Please provide command line arguments!")?;
12 sl.play(&speech);
13 while sl.active_voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16 } else {
17 for i in strings.iter().skip(1) {
18 speech.set_text(i)?;
19
20 sl.play(&speech);
21 while sl.active_voice_count() > 0 {
22 std::thread::sleep(std::time::Duration::from_millis(100));
23 }
24 }
25 }
26
27 Ok(())
28}
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?
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let sl = Soloud::default()?;
5
6 let mut wav = audio::Wav::default();
7
8 let bytes = std::fs::read("sample.wav")?;
9
10 wav.load_mem(&bytes)?;
11
12 sl.play(&wav);
13 while sl.voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 Ok(())
18}
More examples
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8 let mut filt = filter::EchoFilter::default();
9 filt.set_params(0.2)?; // Here sets the delay by default for echo filters
10
11 wav.load("sample.wav")?;
12 wav.set_filter(0, Some(&filt));
13
14 sl.play(&wav);
15 while sl.voice_count() > 0 {
16 std::thread::sleep(std::time::Duration::from_millis(100));
17 }
18
19 Ok(())
20}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8
9 wav.load("song.mp3")?;
10
11 sl.play(&wav);
12 while sl.voice_count() > 0 {
13 // calls to play are non-blocking, so we put the thread to sleep
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 // wav.load("Recording.mp3")?;
18
19 // sl.play(&wav);
20 // while sl.voice_count() > 0 {
21 // std::thread::sleep(std::time::Duration::from_millis(100));
22 // }
23
24 Ok(())
25}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6
7 let mut speech = audio::Speech::default();
8
9 speech.set_text("Hello World")?;
10
11 sl.play(&speech);
12 while sl.active_voice_count() > 0 {
13 std::thread::sleep(std::time::Duration::from_millis(100));
14 }
15
16 speech.set_text("1 2 3")?;
17
18 sl.play(&speech);
19 while sl.active_voice_count() > 0 {
20 std::thread::sleep(std::time::Duration::from_millis(100));
21 }
22
23 speech.set_text("Can you hear me?")?;
24
25 sl.play(&speech);
26 while sl.active_voice_count() > 0 {
27 std::thread::sleep(std::time::Duration::from_millis(100));
28 }
29
30 Ok(())
31}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6 let mut speech = audio::Speech::default();
7
8 let strings: Vec<String> = std::env::args().collect();
9
10 if strings.len() < 2 {
11 speech.set_text("Please provide command line arguments!")?;
12 sl.play(&speech);
13 while sl.active_voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16 } else {
17 for i in strings.iter().skip(1) {
18 speech.set_text(i)?;
19
20 sl.play(&speech);
21 while sl.active_voice_count() > 0 {
22 std::thread::sleep(std::time::Duration::from_millis(100));
23 }
24 }
25 }
26
27 Ok(())
28}
Sourcepub fn active_voice_count(&self) -> u32
pub fn active_voice_count(&self) -> u32
Get active voice count
Examples found in repository?
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6
7 let mut speech = audio::Speech::default();
8
9 speech.set_text("Hello World")?;
10
11 sl.play(&speech);
12 while sl.active_voice_count() > 0 {
13 std::thread::sleep(std::time::Duration::from_millis(100));
14 }
15
16 speech.set_text("1 2 3")?;
17
18 sl.play(&speech);
19 while sl.active_voice_count() > 0 {
20 std::thread::sleep(std::time::Duration::from_millis(100));
21 }
22
23 speech.set_text("Can you hear me?")?;
24
25 sl.play(&speech);
26 while sl.active_voice_count() > 0 {
27 std::thread::sleep(std::time::Duration::from_millis(100));
28 }
29
30 Ok(())
31}
More examples
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6 let mut speech = audio::Speech::default();
7
8 let strings: Vec<String> = std::env::args().collect();
9
10 if strings.len() < 2 {
11 speech.set_text("Please provide command line arguments!")?;
12 sl.play(&speech);
13 while sl.active_voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16 } else {
17 for i in strings.iter().skip(1) {
18 speech.set_text(i)?;
19
20 sl.play(&speech);
21 while sl.active_voice_count() > 0 {
22 std::thread::sleep(std::time::Duration::from_millis(100));
23 }
24 }
25 }
26
27 Ok(())
28}
Sourcepub fn voice_count(&self) -> u32
pub fn voice_count(&self) -> u32
Get voice count
Examples found in repository?
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let sl = Soloud::default()?;
5
6 let mut wav = audio::Wav::default();
7
8 let bytes = std::fs::read("sample.wav")?;
9
10 wav.load_mem(&bytes)?;
11
12 sl.play(&wav);
13 while sl.voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 Ok(())
18}
More examples
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8 let mut filt = filter::EchoFilter::default();
9 filt.set_params(0.2)?; // Here sets the delay by default for echo filters
10
11 wav.load("sample.wav")?;
12 wav.set_filter(0, Some(&filt));
13
14 sl.play(&wav);
15 while sl.voice_count() > 0 {
16 std::thread::sleep(std::time::Duration::from_millis(100));
17 }
18
19 Ok(())
20}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8
9 wav.load("song.mp3")?;
10
11 sl.play(&wav);
12 while sl.voice_count() > 0 {
13 // calls to play are non-blocking, so we put the thread to sleep
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 // wav.load("Recording.mp3")?;
18
19 // sl.play(&wav);
20 // while sl.voice_count() > 0 {
21 // std::thread::sleep(std::time::Duration::from_millis(100));
22 // }
23
24 Ok(())
25}
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?
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8 let mut filt = filter::EchoFilter::default();
9 filt.set_params(0.2)?; // Here sets the delay by default for echo filters
10
11 wav.load("sample.wav")?;
12 wav.set_filter(0, Some(&filt));
13
14 sl.play(&wav);
15 while sl.voice_count() > 0 {
16 std::thread::sleep(std::time::Duration::from_millis(100));
17 }
18
19 Ok(())
20}
More examples
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(3.0);
6
7 let mut wav = audio::Wav::default();
8
9 wav.load("song.mp3")?;
10
11 sl.play(&wav);
12 while sl.voice_count() > 0 {
13 // calls to play are non-blocking, so we put the thread to sleep
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16
17 // wav.load("Recording.mp3")?;
18
19 // sl.play(&wav);
20 // while sl.voice_count() > 0 {
21 // std::thread::sleep(std::time::Duration::from_millis(100));
22 // }
23
24 Ok(())
25}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6
7 let mut speech = audio::Speech::default();
8
9 speech.set_text("Hello World")?;
10
11 sl.play(&speech);
12 while sl.active_voice_count() > 0 {
13 std::thread::sleep(std::time::Duration::from_millis(100));
14 }
15
16 speech.set_text("1 2 3")?;
17
18 sl.play(&speech);
19 while sl.active_voice_count() > 0 {
20 std::thread::sleep(std::time::Duration::from_millis(100));
21 }
22
23 speech.set_text("Can you hear me?")?;
24
25 sl.play(&speech);
26 while sl.active_voice_count() > 0 {
27 std::thread::sleep(std::time::Duration::from_millis(100));
28 }
29
30 Ok(())
31}
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let mut sl = Soloud::default()?;
5 sl.set_global_volume(4.0);
6 let mut speech = audio::Speech::default();
7
8 let strings: Vec<String> = std::env::args().collect();
9
10 if strings.len() < 2 {
11 speech.set_text("Please provide command line arguments!")?;
12 sl.play(&speech);
13 while sl.active_voice_count() > 0 {
14 std::thread::sleep(std::time::Duration::from_millis(100));
15 }
16 } else {
17 for i in strings.iter().skip(1) {
18 speech.set_text(i)?;
19
20 sl.play(&speech);
21 while sl.active_voice_count() > 0 {
22 std::thread::sleep(std::time::Duration::from_millis(100));
23 }
24 }
25 }
26
27 Ok(())
28}
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