Skip to content

Commit 1c05ebe

Browse files
committed
rename symbols, bump version
1 parent 71b4716 commit 1c05ebe

File tree

38 files changed

+400
-377
lines changed

38 files changed

+400
-377
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "firewheel"
3-
version = "0.2.4-beta.0"
3+
version = "0.3.0"
44
description = "Flexible, high-performance, and libre audio engine for games (WIP)"
55
repository = "https://github.com/BillyDM/firewheel"
66
edition.workspace = true
@@ -84,10 +84,10 @@ stream_nodes = ["firewheel-nodes/stream"]
8484
bevy = ["firewheel-nodes/bevy", "firewheel-core/bevy"]
8585

8686
[dependencies]
87-
firewheel-core = { path = "crates/firewheel-core", version = "0.2.4-beta.0" }
88-
firewheel-graph = { path = "crates/firewheel-graph", version = "0.2.4-beta.0" }
89-
firewheel-cpal = { path = "crates/firewheel-cpal", version = "0.2.4-beta.0", default-features = false, optional = true }
90-
firewheel-nodes = { path = "crates/firewheel-nodes", version = "0.2.4-beta.0", default-features = false }
87+
firewheel-core = { path = "crates/firewheel-core", version = "0.3.0" }
88+
firewheel-graph = { path = "crates/firewheel-graph", version = "0.3.0" }
89+
firewheel-cpal = { path = "crates/firewheel-cpal", version = "0.3.0", default-features = false, optional = true }
90+
firewheel-nodes = { path = "crates/firewheel-nodes", version = "0.3.0", default-features = false }
9191
thunderdome = { workspace = true, optional = true }
9292
smallvec = { workspace = true, optional = true }
9393

crates/firewheel-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "firewheel-core"
3-
version = "0.2.4-beta.0"
3+
version = "0.3.0"
44
description = "Shared types for Firewheel crates"
55
homepage = "https://github.com/BillyDM/firewheel/blob/main/crates/firewheel-core"
66
edition.workspace = true

crates/firewheel-core/src/node.rs

Lines changed: 9 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use crate::{
88
SilenceMask, StreamInfo,
99
};
1010

11+
pub mod dummy;
12+
1113
/// A globally unique identifier for a node.
1214
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
1315
pub struct NodeID(pub thunderdome::Index);
@@ -107,7 +109,7 @@ impl Into<AudioNodeInfoInner> for AudioNodeInfo {
107109
}
108110
}
109111

110-
pub trait AudioNodeConstructor {
112+
pub trait AudioNode: 'static {
111113
/// A type representing this constructor's configuration.
112114
///
113115
/// This is intended as a one-time configuration to be used
@@ -132,26 +134,26 @@ pub trait AudioNodeConstructor {
132134
///
133135
/// This should be preferred over `()` because it implements
134136
/// [`Component`][bevy_ecs::prelude::Component], making the
135-
/// [`AudioNodeConstructor`] implementor trivially Bevy-compatible.
137+
/// [`AudioNode`] implementor trivially Bevy-compatible.
136138
#[derive(Debug, Default, Clone, Copy)]
137139
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
138140
pub struct EmptyConfig;
139141

140-
/// A dyn-compatible [`AudioNodeConstructor`].
141-
pub trait AudioNode {
142+
/// A dyn-compatible [`AudioNode`].
143+
pub trait DynAudioNode: 'static {
142144
fn info(&self) -> AudioNodeInfo;
143145
fn processor(&self, stream_info: &StreamInfo) -> Box<dyn AudioNodeProcessor>;
144146
}
145147

146148
/// Pairs constructors with their configurations.
147149
///
148-
/// This is useful for type-erasing an [`AudioNodeConstructor`].
150+
/// This is useful for type-erasing an [`AudioNode`].
149151
pub struct Constructor<T, C> {
150152
constructor: T,
151153
configuration: C,
152154
}
153155

154-
impl<T: AudioNodeConstructor> Constructor<T, T::Configuration> {
156+
impl<T: AudioNode> Constructor<T, T::Configuration> {
155157
pub fn new(constructor: T, configuration: Option<T::Configuration>) -> Self {
156158
Self {
157159
constructor,
@@ -160,7 +162,7 @@ impl<T: AudioNodeConstructor> Constructor<T, T::Configuration> {
160162
}
161163
}
162164

163-
impl<T: AudioNodeConstructor> AudioNode for Constructor<T, T::Configuration> {
165+
impl<T: AudioNode> DynAudioNode for Constructor<T, T::Configuration> {
164166
fn info(&self) -> AudioNodeInfo {
165167
self.constructor.info(&self.configuration)
166168
}
@@ -334,44 +336,3 @@ impl ProcessStatus {
334336
Self::OutputsModified { out_silence_mask }
335337
}
336338
}
337-
338-
/// The configuration for a "dummy" node, a node which does nothing.
339-
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
340-
pub struct DummyConfig {
341-
pub channel_config: ChannelConfig,
342-
}
343-
344-
impl AudioNodeConstructor for DummyConfig {
345-
type Configuration = ();
346-
347-
fn info(&self, _config: &Self::Configuration) -> AudioNodeInfo {
348-
AudioNodeInfo {
349-
debug_name: "dummy",
350-
channel_config: self.channel_config,
351-
uses_events: false,
352-
}
353-
}
354-
355-
fn processor(
356-
&self,
357-
_config: &Self::Configuration,
358-
_stream_info: &StreamInfo,
359-
) -> impl AudioNodeProcessor {
360-
DummyProcessor
361-
}
362-
}
363-
364-
pub struct DummyProcessor;
365-
366-
impl AudioNodeProcessor for DummyProcessor {
367-
fn process(
368-
&mut self,
369-
_inputs: &[&[f32]],
370-
_outputs: &mut [&mut [f32]],
371-
_events: NodeEventList,
372-
_proc_info: &ProcInfo,
373-
_scratch_buffers: ScratchBuffers,
374-
) -> ProcessStatus {
375-
ProcessStatus::Bypass
376-
}
377-
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
use crate::{channel_config::ChannelConfig, event::NodeEventList, StreamInfo};
2+
3+
use super::{
4+
AudioNode, AudioNodeInfo, AudioNodeProcessor, ProcInfo, ProcessStatus, ScratchBuffers,
5+
};
6+
7+
/// A "dummy" [`AudioNode`], a node which does nothing.
8+
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
9+
pub struct DummyNode;
10+
11+
/// The configuration for a [`DummyNode`], a node which does nothing.
12+
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
13+
pub struct DummyNodeConfig {
14+
pub channel_config: ChannelConfig,
15+
}
16+
17+
impl AudioNode for DummyNode {
18+
type Configuration = DummyNodeConfig;
19+
20+
fn info(&self, config: &Self::Configuration) -> AudioNodeInfo {
21+
AudioNodeInfo::new()
22+
.debug_name("dummy")
23+
.channel_config(config.channel_config)
24+
.uses_events(false)
25+
}
26+
27+
fn processor(
28+
&self,
29+
_config: &Self::Configuration,
30+
_stream_info: &StreamInfo,
31+
) -> impl AudioNodeProcessor {
32+
DummyProcessor
33+
}
34+
}
35+
36+
struct DummyProcessor;
37+
38+
impl AudioNodeProcessor for DummyProcessor {
39+
fn process(
40+
&mut self,
41+
_inputs: &[&[f32]],
42+
_outputs: &mut [&mut [f32]],
43+
_events: NodeEventList,
44+
_proc_info: &ProcInfo,
45+
_scratch_buffers: ScratchBuffers,
46+
) -> ProcessStatus {
47+
ProcessStatus::Bypass
48+
}
49+
}

crates/firewheel-cpal/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "firewheel-cpal"
3-
version = "0.2.4-beta.0"
3+
version = "0.3.0"
44
description = "cpal backend for Firewheel"
55
homepage = "https://github.com/BillyDM/firewheel/blob/main/crates/firewheel-cpal"
66
edition.workspace = true
@@ -19,8 +19,8 @@ input = ["dep:fixed-resample"]
1919
resample_inputs = ["input", "fixed-resample?/fft-resampler"]
2020

2121
[dependencies]
22-
firewheel-core = { path = "../firewheel-core", version = "0.2.4-beta.0" }
23-
firewheel-graph = { path = "../firewheel-graph", version = "0.2.4-beta.0" }
22+
firewheel-core = { path = "../firewheel-core", version = "0.3.0" }
23+
firewheel-graph = { path = "../firewheel-graph", version = "0.3.0" }
2424
cpal = "0.15.3"
2525
log.workspace = true
2626
ringbuf.workspace = true

crates/firewheel-cpal/src/input.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use firewheel_core::{
1111
channel_config::{ChannelConfig, ChannelCount, NonZeroChannelCount},
1212
event::{NodeEventList, NodeEventType},
1313
node::{
14-
AudioNodeConstructor, AudioNodeInfo, AudioNodeProcessor, EmptyConfig, ProcInfo,
15-
ProcessStatus, ScratchBuffers,
14+
AudioNode, AudioNodeInfo, AudioNodeProcessor, EmptyConfig, ProcInfo, ProcessStatus,
15+
ScratchBuffers,
1616
},
1717
sync_wrapper::SyncWrapper,
1818
SilenceMask, StreamInfo,
@@ -112,14 +112,14 @@ impl Default for CpalInputConfig {
112112
}
113113

114114
#[derive(Clone)]
115-
pub struct CpalInputNodeHandle {
115+
pub struct CpalInputNode {
116116
config: CpalInputNodeConfig,
117117
channels: NonZeroChannelCount,
118118
active_state: Option<ActiveHandleState>,
119119
shared_state: Arc<SharedState>,
120120
}
121121

122-
impl CpalInputNodeHandle {
122+
impl CpalInputNode {
123123
pub fn new(config: CpalInputNodeConfig, channels: NonZeroChannelCount) -> Self {
124124
Self {
125125
config,
@@ -426,13 +426,13 @@ impl CpalInputNodeHandle {
426426
}
427427
}
428428

429-
impl Drop for CpalInputNodeHandle {
429+
impl Drop for CpalInputNode {
430430
fn drop(&mut self) {
431431
self.stop_stream();
432432
}
433433
}
434434

435-
impl AudioNodeConstructor for CpalInputNodeHandle {
435+
impl AudioNode for CpalInputNode {
436436
type Configuration = EmptyConfig;
437437

438438
fn info(&self, _config: &Self::Configuration) -> AudioNodeInfo {

crates/firewheel-graph/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "firewheel-graph"
3-
version = "0.2.4-beta.0"
3+
version = "0.3.0"
44
description = "Core audio graph algorithm and executor for Firewheel"
55
homepage = "https://github.com/BillyDM/firewheel/blob/main/crates/firewheel-graph"
66
edition.workspace = true
@@ -15,7 +15,7 @@ exclude.workspace = true
1515
all-features = true
1616

1717
[dependencies]
18-
firewheel-core = { path = "../firewheel-core", version = "0.2.4-beta.0" }
18+
firewheel-core = { path = "../firewheel-core", version = "0.3.0" }
1919
log.workspace = true
2020
ringbuf.workspace = true
2121
smallvec.workspace = true

crates/firewheel-graph/src/context.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use firewheel_core::{
44
clock::{ClockSamples, ClockSeconds, MusicalTime, MusicalTransport},
55
dsp::declick::DeclickValues,
66
event::{NodeEvent, NodeEventType},
7-
node::{AudioNodeConstructor, NodeID},
7+
node::{AudioNode, DynAudioNode, NodeID},
88
StreamInfo,
99
};
1010
use ringbuf::traits::{Consumer, Producer, Split};
@@ -459,21 +459,23 @@ impl<B: AudioBackend> FirewheelCtx<B> {
459459
}
460460

461461
/// The ID of the graph input node
462-
pub fn graph_in_node(&self) -> NodeID {
462+
pub fn graph_in_node_id(&self) -> NodeID {
463463
self.graph.graph_in_node()
464464
}
465465

466466
/// The ID of the graph output node
467-
pub fn graph_out_node(&self) -> NodeID {
467+
pub fn graph_out_node_id(&self) -> NodeID {
468468
self.graph.graph_out_node()
469469
}
470470

471471
/// Add a node to the audio graph.
472-
pub fn add_node<T>(&mut self, constructor: T, config: Option<T::Configuration>) -> NodeID
473-
where
474-
T: AudioNodeConstructor + 'static,
475-
{
476-
self.graph.add_node(constructor, config)
472+
pub fn add_node<T: AudioNode>(&mut self, node: T, config: Option<T::Configuration>) -> NodeID {
473+
self.graph.add_node(node, config)
474+
}
475+
476+
/// Add a node to the audio graph which implements the type-erased [`DynAudioNode`] trait.
477+
pub fn add_dyn_node<T: DynAudioNode>(&mut self, node: T) -> NodeID {
478+
self.graph.add_dyn_node(node)
477479
}
478480

479481
/// Remove the given node from the audio graph.

0 commit comments

Comments
 (0)