Struct soloud::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)
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
Hide additional examples
examples/filter.rs (line 4)
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(())
}
examples/simple.rs (line 4)
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(())
}
examples/speech.rs (line 4)
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(())
}
examples/recho.rs (line 4)
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(())
}
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)
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
Hide additional examples
examples/filter.rs (line 14)
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(())
}
examples/simple.rs (line 11)
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(())
}
examples/speech.rs (line 11)
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(())
}
examples/recho.rs (line 12)
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(())
}
source

pub fn active_voice_count(&self) -> u32

Get active voice count

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

pub fn voice_count(&self) -> u32

Get voice count

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

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

Set global volume

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

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 Drop for Soloud

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Soloud

source§

impl Sync for Soloud

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.