rawdio/
lib.rs

1#![feature(portable_simd)]
2#![warn(missing_docs)]
3
4//! rawdio is an audio engine that is inspired by the Web Audio API
5//!  
6//! You can use it to:
7//! - Create a context
8//! - Create DSP nodes
9//! - Connect the nodes together
10//! - Accurately schedule 'events'
11//! - Process the graph with an input and an output
12//!
13//! # Example
14//!
15//! ```rust
16//! use rawdio::{connect_nodes, create_engine, AudioProcess, Context, Oscillator, OwnedAudioBuffer};
17//!
18//! let (mut context, mut process) = create_engine();
19//!
20//! let frequency = 1_000.0;
21//! let channel_count = 2;
22//! let oscillator = Oscillator::sine(context.as_ref(), frequency, channel_count);
23//!
24//! connect_nodes!(oscillator => "output");
25//!
26//! context.start();
27//!
28//! // Call `process.process(...)`, passing in the input samples, and using the output
29//! // If you wish to use with your sound card, you could use something like cpal (see the examples)
30//! ```
31
32#[macro_use]
33extern crate approx;
34
35mod buffer;
36mod commands;
37mod dsp;
38mod effects;
39mod engine;
40mod graph;
41mod parameter;
42mod realtime;
43mod utility;
44
45pub use buffer::AudioBuffer;
46pub use buffer::BorrowedAudioBuffer;
47pub use buffer::MutableBorrowedAudioBuffer;
48pub use buffer::OwnedAudioBuffer;
49pub use buffer::SampleLocation;
50
51pub use effects::Adsr;
52pub use effects::Biquad;
53pub use effects::BiquadFilterType;
54pub use effects::Compressor;
55pub use effects::Convolution;
56pub use effects::Envelope;
57pub use effects::Gain;
58pub use effects::Mixer;
59pub use effects::Oscillator;
60pub use effects::Pan;
61pub use effects::Recorder;
62pub use effects::Sampler;
63pub use effects::Waveshaper;
64
65pub use engine::create_engine;
66pub use engine::create_engine_with_options;
67pub use engine::AudioProcess;
68pub(crate) use engine::CommandQueue;
69pub use engine::Context;
70pub use engine::EngineOptions;
71
72pub(crate) use graph::DspNode;
73pub use graph::GraphNode;
74pub use graph::ProcessContext;
75
76pub use parameter::AudioParameter;
77pub(crate) use parameter::Parameters;
78
79pub use utility::Level;
80pub use utility::Timestamp;
81
82/// Module to re-export commonly used types
83pub mod prelude {
84    pub use crate::{
85        connect_nodes, create_engine, create_engine_with_options, AudioBuffer, AudioParameter,
86        AudioProcess, BorrowedAudioBuffer, Context, EngineOptions, GraphNode, Level,
87        MutableBorrowedAudioBuffer, OwnedAudioBuffer, SampleLocation, Timestamp,
88    };
89}