@@ -47,10 +47,13 @@ impl Default for PeakMeterSmootherConfig {
4747 }
4848}
4949
50+ pub type PeakMeterSmootherMono = PeakMeterSmoother < 1 > ;
51+ pub type PeakMeterSmootherStereo = PeakMeterSmoother < 2 > ;
52+
5053/// A helper struct to smooth out the output of [`PeakMeterNode`]. This
5154/// can be used to drive the animation of a peak meter in a GUI.
5255#[ derive( Debug , Clone , Copy ) ]
53- pub struct PeakMeterSmoother < const NUM_CHANNELS : usize > {
56+ pub struct PeakMeterSmoother < const NUM_CHANNELS : usize = 2 > {
5457 /// The current smoothed peak value of each channel, in decibels.
5558 smoothed_peaks : [ f32 ; NUM_CHANNELS ] ,
5659 clipped_frames_left : [ usize ; NUM_CHANNELS ] ,
@@ -158,19 +161,25 @@ impl<const NUM_CHANNELS: usize> PeakMeterSmoother<NUM_CHANNELS> {
158161 }
159162}
160163
164+ pub type PeakMeterNodeMono = PeakMeterNode < 1 > ;
165+ pub type PeakMeterNodeStereo = PeakMeterNode < 2 > ;
166+
161167/// A node that calculates the peak amplitude of a signal, and then sends that value
162168/// to [`PeakMeterState`].
163169#[ derive( Diff , Patch , Debug , Clone , Copy , PartialEq , Eq ) ]
164170#[ cfg_attr( feature = "bevy" , derive( bevy_ecs:: prelude:: Component ) ) ]
165171#[ cfg_attr( feature = "bevy_reflect" , derive( bevy_reflect:: Reflect ) ) ]
166172#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
167- pub struct PeakMeterNode < const NUM_CHANNELS : usize > {
173+ pub struct PeakMeterNode < const NUM_CHANNELS : usize = 2 > {
168174 pub enabled : bool ,
169175}
170176
177+ pub type PeakMeterStateMono = PeakMeterState < 1 > ;
178+ pub type PeakMeterStateStereo = PeakMeterState < 2 > ;
179+
171180/// The state of a [`PeakMeterNode`]. This contains the calculated peak values.
172181#[ derive( Clone ) ]
173- pub struct PeakMeterState < const NUM_CHANNELS : usize > {
182+ pub struct PeakMeterState < const NUM_CHANNELS : usize = 2 > {
174183 shared_state : ArcGc < SharedState < NUM_CHANNELS > > ,
175184}
176185
0 commit comments