Struct Soloud

Source
pub struct Soloud { /* private fields */ }
Expand description

Wrapper around the Soloud native object

Implementations§

Source§

impl Soloud

Source

pub unsafe fn default_uninit() -> MaybeUninit<Self>

Creates an uninitialized instance of a Soloud engine

§Safety

Creates an uninitialized instance of Soloud

Source

pub unsafe fn init(&mut self) -> Result<(), SoloudError>

initialize an uninitialized instance of Soloud

§Safety

initializes an uninitialized instance of Soloud

Source

pub fn default() -> Result<Self, SoloudError>

Creates a default initialized instance of soloud

Examples found in repository?
examples/load_mem.rs (line 4)
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
Hide additional examples
examples/filter.rs (line 4)
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}
examples/simple.rs (line 4)
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}
examples/speech.rs (line 4)
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}
examples/recho.rs (line 4)
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}
Source

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

Source

pub fn new( flags: SoloudFlag, backend: Backend, samplerate: u32, buf_size: u32, channels: u32, ) -> Result<Self, SoloudError>

Creates a default initialized instance of soloud

Source

pub fn version(&self) -> u32

Gets the current version of the Soloud library

Source

pub fn backend_id(&self) -> u32

Gets the backend id

Source

pub fn backend_string(&self) -> String

Gets the backend name

Source

pub fn backend_channels(&self) -> u32

Get the backend channels

Source

pub fn backend_samplerate(&self) -> u32

Get the backend samplerate

Source

pub fn backend_buffer_size(&self) -> u32

Get the backend buffer size

Source

pub fn set_speaker_position( &mut self, channel: u32, x: f32, y: f32, z: f32, ) -> Result<(), SoloudError>

Set speaker position

Source

pub fn speaker_position( &self, channel: u32, ) -> Result<(f32, f32, f32), SoloudError>

Get the speaker position

Source

pub fn play_ex<AS: AudioExt>( &self, sound: &AS, volume: f32, pan: f32, paused: bool, bus: Handle, ) -> Handle

Play audio with extra args

Source

pub fn play_clocked<AS: AudioExt>(&self, sound_time: f64, sound: &AS) -> Handle

Play clocked

Source

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

Source

pub fn play_3d<AS: AudioExt>( &self, sound: &AS, pos_x: f32, pos_y: f32, pos_z: f32, ) -> Handle

Play 3D

Source

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

Source

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

Source

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

Source

pub fn play_background<AS: AudioExt>(&self, sound: &AS) -> Handle

Play in the background

Source

pub fn play_background_ex<AS: AudioExt>( &self, sound: &AS, volume: f32, paused: bool, bus: Handle, ) -> Handle

Play in the background with extra args

Source

pub fn seek( &self, voice_handle: Handle, seconds: f64, ) -> Result<(), SoloudError>

Seek in seconds

Source

pub fn stop(&self, voice_handle: Handle)

Stop audio by handle

Source

pub fn stop_all(&self)

Stop all audio

Source

pub unsafe fn deinit(&mut self)

Deinitialize the soloud engine

§Safety

Deinitializing will require correct reinitialization

Source

pub fn play<T: AudioExt>(&self, sound: &T) -> Handle

Play audio, returns a handle identifying the played audio

Examples found in repository?
examples/load_mem.rs (line 12)
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
Hide additional examples
examples/filter.rs (line 14)
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}
examples/simple.rs (line 11)
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}
examples/speech.rs (line 11)
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}
examples/recho.rs (line 12)
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}
Source

pub fn active_voice_count(&self) -> u32

Get active voice count

Examples found in repository?
examples/speech.rs (line 12)
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
Hide additional examples
examples/recho.rs (line 13)
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}
Source

pub fn voice_count(&self) -> u32

Get voice count

Examples found in repository?
examples/load_mem.rs (line 13)
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
Hide additional examples
examples/filter.rs (line 15)
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}
examples/simple.rs (line 12)
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}
Source

pub fn set_global_volume(&mut self, val: f32)

Set global volume

Examples found in repository?
examples/filter.rs (line 5)
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
Hide additional examples
examples/simple.rs (line 5)
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}
examples/speech.rs (line 5)
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}
examples/recho.rs (line 5)
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}
Source

pub fn stop_audio_source<AS: AudioExt>(&self, sound: &AS)

Stop audio source

Source

pub fn count_audio_source<AS: AudioExt>(&self, sound: &AS) -> i32

Count audio source

Source

pub fn stream_time(&self, voice_handle: Handle) -> f64

Get stream time

Source

pub fn stream_position(&self, voice_handle: Handle) -> f64

Get stream position

Source

pub fn pause(&self, voice_handle: Handle) -> bool

Pause audio

Source

pub fn volume(&self, voice_handle: Handle) -> f32

Get audio volume

Source

pub fn overall_volume(&self, voice_handle: Handle) -> f32

Get overall volume

Source

pub fn pan(&self, voice_handle: Handle) -> f32

Get pan value

Source

pub fn samplerate(&self, voice_handle: Handle) -> f32

Get samplerate of audio

Source

pub fn protect_voice(&self, voice_handle: Handle) -> bool

Return whether protect voice is set

Source

pub fn is_valid_voice_handle(&self, voice_handle: Handle) -> bool

Check whether a handle is a valid voice handle

Source

pub fn relative_play_speed(&self, voice_handle: Handle) -> f32

Get relative play speed

Source

pub fn post_clip_scaler(&self) -> f32

Get post clip scaler

Source

pub fn main_resampler(&self) -> Resampler

Get main resampler

Source

pub fn global_volume(&self) -> f32

Get global volume

Source

pub fn max_active_voice_count(&self) -> u32

Get max active voice count

Source

pub fn looping(&self, voice_handle: Handle) -> bool

Return whether an audio is looping

Source

pub fn auto_stop(&self, voice_handle: Handle) -> bool

Check whether an audio auto stops

Source

pub fn loop_point(&self, voice_handle: Handle) -> f64

Get loop point

Source

pub fn set_loop_point(&mut self, voice_handle: Handle, loop_point: f64)

Set loop point

Source

pub fn set_looping(&mut self, voice_handle: Handle, flag: bool)

Set whether audio is looping

Source

pub fn set_auto_stop(&mut self, voice_handle: Handle, flag: bool)

Set auto stop

Source

pub fn set_max_active_voice_count( &mut self, count: u32, ) -> Result<(), SoloudError>

Set max active voice count

Source

pub fn set_inaudible_behavior( &mut self, voice_handle: Handle, must_tick: bool, kill: bool, )

Set inaudible behaviour

Source

pub fn set_post_clip_scaler(&mut self, scaler: f32)

Set post clip scaler

Source

pub fn set_main_resampler(&mut self, resampler: Resampler)

Set main resampler

Source

pub fn set_pause(&mut self, voice_handle: Handle, flag: bool)

Set whether a handle pauses

Source

pub fn set_pause_all(&mut self, flag: bool)

Set pause for all handles

Source

pub fn set_relative_play_speed( &mut self, voice_handle: Handle, speed: f32, ) -> Result<(), SoloudError>

Set relative play speed

Source

pub fn set_protect_voice(&mut self, voice_handle: Handle, flag: bool)

Set whether an audio source has protect voice

Source

pub fn set_samplerate(&mut self, voice_handle: Handle, samplerate: f32)

Set samplerate

Source

pub fn set_pan(&mut self, voice_handle: Handle, pan: f32)

Set pan

Source

pub fn set_pan_absolute( &mut self, voice_handle: Handle, lvolume: f32, rvolume: f32, )

Set pan absolute

Source

pub fn set_channel_volume( &mut self, voice_handle: Handle, channel: u32, volume: f32, )

Set channel volume

Source

pub fn set_volume(&mut self, voice_handle: Handle, volume: f32)

Set volume by handle

Source

pub fn set_delay_samples(&mut self, voice_handle: Handle, samples: u32)

Set delay samples

Source

pub fn fade_volume(&self, voice_handle: Handle, to: f32, time: f64)

Set up volume fader

Source

pub fn fade_pan(&self, voice_handle: Handle, to: f32, time: f64)

Set up panning fader

Source

pub fn fade_relative_play_speed(&self, voice_handle: Handle, to: f32, time: f64)

Set fader relative play speed

Source

pub fn fade_global_volume(&self, to: f32, time: f64)

Set fader global volume

Source

pub fn schedule_pause(&self, voice_handle: Handle, time: f64)

Schedule a pause

Source

pub fn schedule_stop(&self, voice_handle: Handle, time: f64)

Schedule a stop

Source

pub fn oscillate_volume( &self, voice_handle: Handle, from: f32, to: f32, time: f64, )

Set up volume oscillator

Source

pub fn oscillate_pan(&self, voice_handle: Handle, from: f32, to: f32, time: f64)

Set up panning oscillator

Source

pub fn oscillate_relative_play_speed( &self, voice_handle: Handle, from: f32, to: f32, time: f64, )

Oscillator relative play speed

Source

pub fn oscillate_global_volume(&self, from: f32, to: f32, time: f64)

Get oscillator global volume

Source

pub fn set_visualize_enable(&self, flag: bool)

Enable visualizations

Source

pub fn calc_fft(&self) -> Vec<f32>

Calculate and get 256 floats of FFT data for visualization. Visualization has to be enabled before use

Source

pub fn wave(&self) -> Vec<f32>

Get 256 floats of wave data for visualization. Visualization has to be enabled before use

Source

pub fn approximate_volume(&self, channel: u32) -> f32

Get approximate volume

Source

pub fn loop_count(&self, voice_handle: Handle) -> u32

Get loop count

Source

pub fn info(&self, voice_handle: Handle, key: u32) -> f32

get info by key

Source

pub fn create_voice_group(&self) -> Handle

Create a voice group

Source

pub fn destroy_voice_group( &self, voice_group_handle: Handle, ) -> Result<(), SoloudError>

Destroy a voice group

Source

pub fn add_voice_to_group( &self, voice_group_handle: Handle, voice_handle: Handle, ) -> Result<(), SoloudError>

Add a voice handle to a voice group

Source

pub fn is_voice_group(&self, voice_group_handle: Handle) -> bool

Check whether a handle is of a voice group

Source

pub fn is_voice_group_empty(&self, voice_group_handle: Handle) -> bool

Check whether a voice group is empty

Source

pub fn update_3d_audio(&self)

Update 3D audio

Source

pub fn set_3d_sound_speed(&self, speed: f32) -> Result<(), SoloudError>

Set 3D sound speed

Source

pub fn get_3d_sound_speed(&self) -> f32

Get 3d sound speed

Source

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

Source

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

Source

pub fn set_3d_listener_position(&mut self, pos_x: f32, pos_y: f32, pos_z: f32)

Set 3D listener position

Source

pub fn set_3d_listener_at(&mut self, at_x: f32, at_y: f32, at_z: f32)

Set 3D listener position with extra params

Source

pub fn set_3d_listener_up(&mut self, up_x: f32, up_y: f32, up_z: f32)

Set up 3D listener

Source

pub fn set_3d_listener_velocity( &mut self, velocity_x: f32, velocity_y: f32, velocity_z: f32, )

Set 3D listener velocity

Source

pub fn set_3d_source_params( &mut self, voice_handle: Handle, pos_x: f32, pos_y: f32, pos_z: f32, )

Set 3D source parameters

Source

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

Source

pub fn set_3d_source_position( &mut self, voice_handle: Handle, pos_x: f32, pos_y: f32, pos_z: f32, )

Set 3D source position

Source

pub fn set_3d_source_velocity( &mut self, voice_handle: Handle, velocity_x: f32, velocity_y: f32, velocity_z: f32, )

Set 3D source velocity

Source

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

Source

pub fn set_3d_source_attenuation( &mut self, voice_handle: Handle, model: AttenuationModel, rolloff_factor: f32, )

Set 3D source attenuation

Source

pub fn set_3d_source_doppler_factor( &mut self, voice_handle: Handle, doppler_factor: f32, )

Set 3D source doppler factor

Source

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.

Source

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.

Source

pub fn set_filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr, val: f32, )

Set filter parameters

Source

pub fn filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr, ) -> f32

Get filter parameter by filter id

Source

pub fn fade_filter_param( &mut self, voice_handle: Handle, filter_id: u32, attr: impl FilterAttr, to: f32, time: f64, )

Get fader filter params

Source

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

Source

pub fn set_global_filter(&mut self, filter_id: u32, filter: impl FilterExt)

Set a global filter

Source

pub unsafe fn inner(&self) -> *mut Soloud

Get the inner pointer of the Soloud engine

§Safety

The pointer must remain valid

Source

pub unsafe fn delete(this: Soloud)

Deletes the Soloud instance

§Safety

Calling this before any wav instance are dropped will cause memory violation

Trait Implementations§

Source§

impl Debug for Soloud

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Send for Soloud

Source§

impl Sync for Soloud

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.