rg3d_sound/
lib.rs

1//! Sound library for games and interactive applications.
2//!
3//! ## Features
4//!
5//! - Generic and spatial sounds.
6//! - WAV and OGG/Vorbis formats support.
7//! - Streaming.
8//! - Head-related transfer function support ([HRTF](https://en.wikipedia.org/wiki/Head-related_transfer_function)).
9//! - Reverb effect.
10//!
11//! ## Examples
12//!
13//! Here is an example of how to play a sound using rg3d-sound:
14//!
15//! ```no_run
16//! use std::{
17//!     thread,
18//!     time::Duration
19//! };
20//! use rg3d_sound::{
21//!     source::{
22//!         generic::GenericSourceBuilder,
23//!         SoundSource,
24//!         Status
25//!     },
26//!     context::SoundContext,
27//!     buffer::{
28//!         DataSource,
29//!         SoundBufferResource
30//!     },
31//! };
32//!
33//!  let context = SoundContext::new();
34//!
35//!  let sound_buffer = SoundBufferResource::new_generic(rg3d_sound::futures::executor::block_on(DataSource::from_file("sound.wav")).unwrap()).unwrap();
36//!
37//!  let source = GenericSourceBuilder::new()
38//!     .with_buffer(sound_buffer)
39//!     .with_status(Status::Playing)
40//!     .build_source()
41//!     .unwrap();
42//!
43//!  context.state()
44//!     .add_source(source);
45//!
46//!  thread::sleep(Duration::from_secs(3));
47//!
48//! ```
49//!
50//! Other examples can be found in `./examples` folder. Make sure you run them with `--release` flag.
51//!
52//! ## Supported OS
53//!
54//! Currently only Windows and Linux are supported.
55//!
56//! ## HRTF
57//!
58//! Library uses special HRIR Spheres which were composed from IRCAM HRIR database. Since
59//! HRTF is very specific to each person, you should try some of them to find best for you.
60//! They can be found [here](https://github.com/mrDIMAS/hrir_sphere_builder/tree/master/hrtf_base/IRCAM).
61
62#![warn(missing_docs)]
63
64// Platform-dependent crates
65#[macro_use]
66#[cfg(target_os = "windows")]
67extern crate winapi;
68
69pub mod buffer;
70pub mod context;
71
72pub mod dsp;
73pub mod effects;
74pub mod engine;
75pub mod error;
76pub mod listener;
77pub mod renderer;
78pub mod source;
79
80// Reexport some modules because there some types of them in public API.
81pub use hrtf;
82pub use rg3d_core::algebra;
83pub use rg3d_core::futures;
84pub use rg3d_core::math;
85pub use rg3d_core::pool;
86
87mod decoder;
88mod device;