Skip to content

Commit 30446e0

Browse files
authored
Merge pull request #92 from piedoom/derive_normalization
Normalized derives for bevy/serde features
2 parents 00db880 + edf3794 commit 30446e0

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

crates/firewheel-nodes/src/convolution.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ use firewheel_core::{
2424
///
2525
/// Convolution is often used to achieve reverb effects, but is more
2626
/// computationally expensive than algorithmic reverb.
27-
#[derive(Clone, Copy, Patch, Diff, PartialEq)]
27+
#[derive(Patch, Diff, Debug, Clone, Copy, PartialEq)]
2828
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
29+
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
30+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2931
pub struct ConvolutionNode<const CHANNELS: usize> {
3032
/// Pause the convolution processing.
3133
///
@@ -65,6 +67,7 @@ pub struct ConvolutionNode<const CHANNELS: usize> {
6567
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6668
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
6769
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
70+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6871
pub struct ConvolutionNodeConfig<const CHANNELS: usize> {
6972
/// The maximum number of supported IR channels (must be
7073
/// `ChannelCount::MONO` or `ChannelCount::STEREO`). This determines the

crates/firewheel-nodes/src/fast_rms.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ use num_traits::Float;
2323
/// algorithm using a sliding window.) But it should be good enough for games that
2424
/// simply wish to react to player audio.
2525
#[derive(Debug, Diff, Patch, Clone, Copy, PartialEq)]
26+
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
27+
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
28+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2629
pub struct FastRmsNode {
2730
/// Whether or not this node is enabled.
2831
pub enabled: bool,

crates/firewheel-nodes/src/freeverb/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ mod freeverb;
2525
///
2626
/// Freeverb tends to have a somewhat metallic sound, but
2727
/// its minimal computational cost makes it highly versatile.
28-
#[derive(Diff, Patch, Clone, Debug, PartialEq)]
28+
#[derive(Diff, Patch, Clone, Copy, Debug, PartialEq)]
2929
#[cfg_attr(feature = "bevy", derive(bevy_ecs::component::Component))]
3030
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
31+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3132
pub struct FreeverbNode {
3233
/// Set the size of the emulated room, expressed from 0 to 1.
3334
///
@@ -51,6 +52,7 @@ pub struct FreeverbNode {
5152
pub pause: bool,
5253

5354
/// Reset the reverb, clearing its internal state.
55+
#[cfg_attr(feature = "serde", serde(skip))]
5456
pub reset: Notify<()>,
5557

5658
/// Adjusts the time in seconds over which parameters are smoothed.

crates/firewheel-nodes/src/peak_meter.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use firewheel_core::{
1717

1818
/// The configuration for a [`PeakMeterSmoother`]
1919
#[derive(Debug, Clone, Copy, PartialEq)]
20+
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
2021
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
2122
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2223
pub struct PeakMeterSmootherConfig {
@@ -160,6 +161,7 @@ impl<const NUM_CHANNELS: usize> PeakMeterSmoother<NUM_CHANNELS> {
160161
/// A node that calculates the peak amplitude of a signal, and then sends that value
161162
/// to [`PeakMeterState`].
162163
#[derive(Diff, Patch, Debug, Clone, Copy, PartialEq, Eq)]
164+
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
163165
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
164166
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
165167
pub struct PeakMeterNode<const NUM_CHANNELS: usize> {

crates/firewheel-nodes/src/sampler.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ pub enum PlaybackSpeedQuality {
9494
/// It supports pausing, resuming, looping, and changing the playback speed.
9595
#[derive(Clone, Diff, Patch, PartialEq)]
9696
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Component))]
97+
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
98+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9799
pub struct SamplerNode {
98100
/// The sample resource to use.
101+
#[cfg_attr(feature = "bevy_reflect", reflect(ignore))]
102+
#[cfg_attr(feature = "serde", serde(skip))]
99103
pub sample: Option<ArcGc<dyn SampleResource>>,
100104

101105
/// The volume to play the sample at.
@@ -109,6 +113,7 @@ pub struct SamplerNode {
109113

110114
/// Whether or not the current sample should start/restart playing (true), or be
111115
/// paused/stopped (false).
116+
#[cfg_attr(feature = "serde", serde(skip))]
112117
pub play: Notify<bool>,
113118

114119
/// Defines where the sampler should start playing from when
@@ -453,6 +458,7 @@ impl SamplerState {
453458
/// [`SamplerNode::play`] is set to `true`.
454459
#[derive(Debug, Clone, Copy, PartialEq, RealtimeClone)]
455460
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
461+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
456462
pub enum PlayFrom {
457463
/// When [`SamplerNode::play`] is set to `true`, the sampler will resume
458464
/// playing from where it last left off.
@@ -525,6 +531,7 @@ impl Patch for PlayFrom {
525531
/// How many times a sample should be repeated.
526532
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Diff, Patch)]
527533
#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))]
534+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
528535
pub enum RepeatMode {
529536
/// Play the sample once and then stop.
530537
#[default]

0 commit comments

Comments
 (0)