Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 78 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
name: PR

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings

jobs:
# Run tests.
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev cmake libpulse-dev

- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true

- name: Run tests
run: |
cargo test --locked --workspace --all-features --all-targets

- name: Test realtime audio garbage collector
run: |
cd crates/firewheel-core && cargo test --locked -- --ignored && cd ../../

- name: Check no_std build
run: |
cargo build --locked --no-default-features --features "libm, scheduled_events, musical_transport, all_nodes_no_std, pool, node_profiling, glam-29, glam-30, glam-31"

# Check formatting.
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Run cargo fmt
run: cargo fmt --all -- --check

# Check documentation.
doc:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev cmake libpulse-dev

- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true

- name: Check documentation
run: cargo doc --locked --workspace --all-features --no-deps
# Run tests.
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev cmake libpulse-dev

- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true

- name: Run tests
run: |
cargo test --locked --workspace --all-features --all-targets

- name: Test realtime audio garbage collector
run: |
cd crates/firewheel-core && cargo test --locked -- --ignored && cd ../../

- name: Check no_std build
run: |
cargo build --locked --no-default-features --features "libm, scheduled_events, musical_transport, all_nodes_no_std, node_profiling, glam-29, glam-30, glam-31"

# Check formatting.
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: Run cargo fmt
run: cargo fmt --all -- --check

# Check documentation.
doc:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev cmake libpulse-dev

- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
sweep-cache: true

- name: Check documentation
run: cargo doc --locked --workspace --all-features --no-deps
16 changes: 3 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ std = [
"firewheel-core/std",
"firewheel-graph/std",
"firewheel-nodes/std",
"firewheel-pool?/std",
]
# Enable this if "std" is disabled.
libm = ["firewheel-core/libm", "firewheel-nodes/libm"]
Expand All @@ -53,7 +52,6 @@ scheduled_events = [
"firewheel-core/scheduled_events",
"firewheel-graph/scheduled_events",
"firewheel-nodes/scheduled_events",
"firewheel-pool?/scheduled_events",
]
# Enables the musical transport feature
musical_transport = [
Expand All @@ -76,9 +74,6 @@ rtaudio = ["std", "firewheel-rtaudio"]
symphonium = ["dep:firewheel-symphonium"]
# Enables performance profiling for each individual node.
node_profiling = ["firewheel-graph/node_profiling"]
# Enables the `AudioNodePool` helper type for constructing a pool of
# audio node chains that can dynamically be assigned work.
pool = ["dep:firewheel-pool"]
# Enables all built-in factory nodes
all_nodes = ["firewheel-nodes/all_nodes"]
# Enables all built-in factory nodes which are no_std compatible
Expand All @@ -88,11 +83,10 @@ beep_test_node = ["firewheel-nodes/beep_test"]
# Enables the peak meter node
peak_meter_node = ["firewheel-nodes/peak_meter"]
# Enables the sampler node
sampler_node = ["firewheel-nodes/sampler", "firewheel-pool?/sampler"]
sampler_node = ["firewheel-nodes/sampler"]
# Enables the basic 3D spatial positioning node
spatial_basic_node = [
"firewheel-nodes/spatial_basic",
"firewheel-pool?/spatial_basic",
]
# Enables the triple buffer node for sending raw audio data from the
# audio graph to another thread. Useful for cases where you only care
Expand Down Expand Up @@ -171,15 +165,13 @@ members = [
"crates/firewheel-graph",
"crates/firewheel-nodes",
"crates/firewheel-macros",
"crates/firewheel-pool",
"crates/firewheel-rtaudio",
"crates/firewheel-symphonium",
"examples/beep_test",
"examples/cpal_input",
"examples/custom_nodes",
"examples/play_sample",
"examples/rtaudio_beep_test",
"examples/sampler_pool",
"examples/sampler_test",
"examples/spatial_basic",
"examples/stream_nodes",
Expand All @@ -197,7 +189,6 @@ ringbuf = { version = "0.4", default-features = false, features = [
"alloc",
] }
triple_buffer = "9"
triple_buf_64 = { version = "0.1.1", features = ["portable-atomic"] }
thiserror = { version = "2", default-features = false }
smallvec = "1"
arrayvec = { version = "0.7", default-features = false }
Expand Down Expand Up @@ -227,11 +218,10 @@ eframe = { version = "0.33.3", default-features = false, features = [
] }

[dependencies]
firewheel-core = { path = "crates/firewheel-core", version = "0.10.0", default-features = false }
firewheel-graph = { path = "crates/firewheel-graph", version = "0.10.0", default-features = false }
firewheel-core = { path = "crates/firewheel-core", version = "0.10.1", default-features = false }
firewheel-graph = { path = "crates/firewheel-graph", version = "0.10.2", default-features = false }
firewheel-cpal = { path = "crates/firewheel-cpal", version = "0.10.0", default-features = false, optional = true }
firewheel-nodes = { path = "crates/firewheel-nodes", version = "0.10.0", default-features = false }
firewheel-pool = { path = "crates/firewheel-pool", version = "0.10.0", default-features = false, optional = true }
firewheel-symphonium = { path = "crates/firewheel-symphonium", version = "0.10.0", default-features = false, optional = true }
firewheel-rtaudio = { path = "crates/firewheel-rtaudio", version = "0.10.0", default-features = false, optional = true }
thunderdome = { workspace = true, optional = true }
Expand Down
24 changes: 12 additions & 12 deletions crates/firewheel-core/src/diff/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{Diff, EventQueue, Patch, PatchError, PathBuilder};
use crate::{
clock::{DurationSamples, DurationSeconds, InstantSamples, InstantSeconds},
collector::ArcGc,
diff::{Notify, RealtimeClone},
diff::{Notify, RealtimeClone, notify::NotifyID},
dsp::volume::Volume,
event::{NodeEventType, ParamData},
vector::{Vec2, Vec3},
Expand Down Expand Up @@ -221,7 +221,7 @@ impl<T: Send + Sync + RealtimeClone + PartialEq + 'static> Patch for Option<T> {
impl Diff for Notify<()> {
fn diff<E: EventQueue>(&self, baseline: &Self, path: PathBuilder, event_queue: &mut E) {
if self != baseline {
event_queue.push_param(ParamData::U64(self.id()), path);
event_queue.push_param(ParamData::U64(self.id().0), path);
}
}
}
Expand All @@ -231,7 +231,7 @@ impl Patch for Notify<()> {

fn patch(data: &ParamData, _: &[u32]) -> Result<Self::Patch, PatchError> {
match data {
ParamData::U64(counter) => Ok(Notify::from_raw((), *counter)),
ParamData::U64(id) => Ok(Notify::from_raw((), NotifyID(*id))),
_ => Err(PatchError::InvalidData),
}
}
Expand All @@ -245,8 +245,8 @@ impl Diff for Notify<bool> {
fn diff<E: EventQueue>(&self, baseline: &Self, path: PathBuilder, event_queue: &mut E) {
if self != baseline {
let mut bytes: [u8; 20] = [0; 20];
bytes[0..8].copy_from_slice(&self.id().to_ne_bytes());
bytes[8] = (**self) as u8;
bytes[0..size_of::<u64>()].copy_from_slice(&self.id().0.to_ne_bytes());
bytes[size_of::<u64>()] = if **self { 1 } else { 0 };

event_queue.push_param(ParamData::CustomBytes(bytes), path);
}
Expand All @@ -259,12 +259,12 @@ impl Patch for Notify<bool> {
fn patch(data: &ParamData, _path: &[u32]) -> Result<Self::Patch, PatchError> {
match data {
ParamData::CustomBytes(bytes) => {
let (counter_bytes, rest_bytes) = bytes.split_at(size_of::<u64>());
let counter = u64::from_ne_bytes(counter_bytes.try_into().unwrap());
let (id_bytes, rest_bytes) = bytes.split_at(size_of::<u64>());
let id = u64::from_ne_bytes(id_bytes.try_into().unwrap());

let value = rest_bytes[0] != 0;

Ok(Notify::from_raw(value, counter))
Ok(Notify::from_raw(value, NotifyID(id)))
}
_ => Err(PatchError::InvalidData),
}
Expand All @@ -281,7 +281,7 @@ macro_rules! trivial_notify {
fn diff<E: EventQueue>(&self, baseline: &Self, path: PathBuilder, event_queue: &mut E) {
if self != baseline {
let mut bytes: [u8; 20] = [0; 20];
bytes[0..8].copy_from_slice(&self.id().to_ne_bytes());
bytes[0..8].copy_from_slice(&self.id().0.to_ne_bytes());
let value_bytes = self.to_ne_bytes();
bytes[8..8 + value_bytes.len()].copy_from_slice(&value_bytes);

Expand All @@ -296,13 +296,13 @@ macro_rules! trivial_notify {
fn patch(data: &ParamData, _path: &[u32]) -> Result<Self::Patch, PatchError> {
match data {
ParamData::CustomBytes(bytes) => {
let (counter_bytes, rest_bytes) = bytes.split_at(size_of::<u64>());
let counter = u64::from_ne_bytes(counter_bytes.try_into().unwrap());
let (id_bytes, rest_bytes) = bytes.split_at(size_of::<u64>());
let id = u64::from_ne_bytes(id_bytes.try_into().unwrap());

let (value_bytes, _) = rest_bytes.split_at(size_of::<$ty>());
let value = <$ty>::from_ne_bytes(value_bytes.try_into().unwrap());

Ok(Notify::from_raw(value, counter))
Ok(Notify::from_raw(value, NotifyID(id)))
}
_ => Err(PatchError::InvalidData),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/firewheel-core/src/diff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ mod memo;
mod notify;

pub use memo::Memo;
pub use notify::Notify;
pub use notify::{Notify, NotifyID};

/// Derive macros for diffing and patching.
pub use firewheel_macros::{Diff, Patch, RealtimeClone};
Expand Down
Loading
Loading