Expand description
Sound library for games and interactive applications.
§Features
- Generic and spatial sounds.
- WAV and OGG/Vorbis formats support.
- Streaming.
- Head-related transfer function support (HRTF).
- Reverb effect.
§Examples
Here is an example of how to play a sound using rg3d-sound:
use std::{
thread,
time::Duration
};
use rg3d_sound::{
source::{
generic::GenericSourceBuilder,
SoundSource,
Status
},
context::SoundContext,
buffer::{
DataSource,
SoundBufferResource
},
};
let context = SoundContext::new();
let sound_buffer = SoundBufferResource::new_generic(rg3d_sound::futures::executor::block_on(DataSource::from_file("sound.wav")).unwrap()).unwrap();
let source = GenericSourceBuilder::new()
.with_buffer(sound_buffer)
.with_status(Status::Playing)
.build_source()
.unwrap();
context.state()
.add_source(source);
thread::sleep(Duration::from_secs(3));
Other examples can be found in ./examples
folder. Make sure you run them with --release
flag.
§Supported OS
Currently only Windows and Linux are supported.
§HRTF
Library uses special HRIR Spheres which were composed from IRCAM HRIR database. Since HRTF is very specific to each person, you should try some of them to find best for you. They can be found here.
Re-exports§
Modules§
- This module provides all needed types and methods to create/load sound buffers from different sources.
- Context module.
- Digital signal processing module. Provides basic elements to process signal sample-by-sample.
- Effects module
- Sound engine module
- Contains all possible errors that can occur in the engine.
- Listener module.
- A generational arena - a contiguous growable array type which allows removing from the middle without shifting and therefore without invalidating other indices.
- Renderer module.
- Sound source module.