1
2
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//! 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](https://en.wikipedia.org/wiki/Head-related_transfer_function)).
//! - Reverb effect.
//!
//! ## Examples
//!
//! Here is an example of how to play a sound using fyrox-sound:
//!
//! ```no_run
//! use std::{
//!     thread,
//!     time::Duration
//! };
//! use fyrox_sound::{
//!     source::{
//!         SoundSourceBuilder,
//!         SoundSource,
//!         Status
//!     },
//!     context::SoundContext,
//!     buffer::{
//!         DataSource,
//!         SoundBufferResource
//!     },
//! };
//!
//!  let context = SoundContext::new();
//!
//!  let sound_buffer = SoundBufferResource::new_generic(fyrox_sound::futures::executor::block_on(DataSource::from_file("sound.wav")).unwrap()).unwrap();
//!
//!  let source = SoundSourceBuilder::new()
//!     .with_buffer(sound_buffer)
//!     .with_status(Status::Playing)
//!     .build()
//!     .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](https://github.com/mrDIMAS/hrir_sphere_builder/tree/master/hrtf_base/IRCAM).

#![warn(missing_docs)]

// Platform-dependent crates
#[macro_use]
#[cfg(target_os = "windows")]
extern crate winapi;

pub mod buffer;
pub mod context;

pub mod dsp;
pub mod effects;
pub mod engine;
pub mod error;
pub mod listener;
pub mod renderer;
pub mod source;

// Reexport some modules because there some types of them in public API.
pub use fyrox_core::algebra;
pub use fyrox_core::futures;
pub use fyrox_core::math;
pub use fyrox_core::pool;
pub use hrtf;

mod decoder;
mod device;