firewheel_core/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(not(feature = "std"))]
4use bevy_platform::prelude::String;
5
6pub mod atomic_float;
7pub mod channel_config;
8pub mod clock;
9pub mod diff;
10pub mod dsp;
11pub mod event;
12pub mod log;
13pub mod mask;
14pub mod node;
15pub mod param;
16pub mod sample_resource;
17pub mod vector;
18
19pub use rtgc as collector;
20
21use core::num::NonZeroU32;
22
23extern crate self as firewheel_core;
24
25/// Information about a running audio stream.
26#[derive(Debug, Clone, PartialEq)]
27pub struct StreamInfo {
28    pub sample_rate: NonZeroU32,
29    /// The reciprocal of the sample rate.
30    pub sample_rate_recip: f64,
31    /// The sample rate of the previous stream. (If this is the first stream, then this
32    /// will just be a copy of [`StreamInfo::sample_rate`]).
33    pub prev_sample_rate: NonZeroU32,
34    pub max_block_frames: NonZeroU32,
35    pub num_stream_in_channels: u32,
36    pub num_stream_out_channels: u32,
37    /// The latency of the input to output stream in seconds.
38    pub input_to_output_latency_seconds: f64,
39    pub declick_frames: NonZeroU32,
40    /// The name of the input audio device.
41    pub input_device_name: Option<String>,
42    /// The name of the output audio device.
43    pub output_device_name: Option<String>,
44}
45
46impl Default for StreamInfo {
47    fn default() -> Self {
48        Self {
49            sample_rate: NonZeroU32::new(44100).unwrap(),
50            sample_rate_recip: 44100.0f64.recip(),
51            prev_sample_rate: NonZeroU32::new(44100).unwrap(),
52            max_block_frames: NonZeroU32::new(1024).unwrap(),
53            num_stream_in_channels: 0,
54            num_stream_out_channels: 2,
55            input_to_output_latency_seconds: 0.0,
56            declick_frames: NonZeroU32::MIN,
57            input_device_name: None,
58            output_device_name: None,
59        }
60    }
61}
62
63#[cfg(feature = "symphonium")]
64pub use sample_resource::{load_audio_file, load_audio_file_from_source};