Skip to content

Commit 6693ef6

Browse files
committed
remove #[derive(Smooth)] macro for now
1 parent 984521c commit 6693ef6

File tree

5 files changed

+6
-384
lines changed

5 files changed

+6
-384
lines changed

coupler-derive/src/lib.rs

-12
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ use syn::{parse_macro_input, DeriveInput};
33

44
mod enum_;
55
mod params;
6-
mod smooth;
76

87
use enum_::expand_enum;
98
use params::expand_params;
10-
use smooth::expand_smooth;
119

1210
#[proc_macro_derive(Params, attributes(param))]
1311
pub fn derive_params(input: TokenStream) -> TokenStream {
@@ -28,13 +26,3 @@ pub fn derive_enum(input: TokenStream) -> TokenStream {
2826
Err(err) => return err.into_compile_error().into(),
2927
}
3028
}
31-
32-
#[proc_macro_derive(Smooth, attributes(param, smooth))]
33-
pub fn derive_smooth(input: TokenStream) -> TokenStream {
34-
let input: DeriveInput = parse_macro_input!(input as DeriveInput);
35-
36-
match expand_smooth(&input) {
37-
Ok(expanded) => expanded.into(),
38-
Err(err) => return err.into_compile_error().into(),
39-
}
40-
}

coupler-derive/src/smooth.rs

-233
This file was deleted.

examples/gain/src/lib.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ use serde::{Deserialize, Serialize};
44

55
use coupler::format::clap::*;
66
use coupler::format::vst3::*;
7-
use coupler::{
8-
buffers::*, bus::*, editor::*, events::*, params::smooth::*, params::*, plugin::*, process::*,
9-
};
7+
use coupler::{buffers::*, bus::*, editor::*, events::*, params::*, plugin::*, process::*};
108

11-
#[derive(Params, Smooth, Serialize, Deserialize, Clone)]
9+
#[derive(Params, Serialize, Deserialize, Clone)]
1210
struct GainParams {
1311
#[param(id = 0, name = "Gain", range = 0.0..1.0, format = "{:.2}")]
14-
#[smooth(Exp, ms = 10.0)]
1512
gain: f32,
1613
}
1714

@@ -81,7 +78,7 @@ impl Plugin for Gain {
8178

8279
fn processor(&self, config: Config) -> Self::Processor {
8380
GainProcessor {
84-
params: self.params.smoothed(config.sample_rate),
81+
params: self.params.clone(),
8582
}
8683
}
8784

@@ -107,17 +104,15 @@ impl ClapPlugin for Gain {
107104
}
108105

109106
pub struct GainProcessor {
110-
params: Smoothed<GainParams>,
107+
params: GainParams,
111108
}
112109

113110
impl Processor for GainProcessor {
114111
fn set_param(&mut self, id: ParamId, value: ParamValue) {
115112
self.params.set_param(id, value);
116113
}
117114

118-
fn reset(&mut self) {
119-
self.params.reset();
120-
}
115+
fn reset(&mut self) {}
121116

122117
fn process(&mut self, buffers: Buffers, events: Events) {
123118
let buffer: BufferMut = buffers.try_into().unwrap();
@@ -132,9 +127,8 @@ impl Processor for GainProcessor {
132127
}
133128

134129
for sample in buffer.samples() {
135-
let gain = self.params.gain.next();
136130
for channel in sample {
137-
*channel *= gain;
131+
*channel *= self.params.gain;
138132
}
139133
}
140134
}

src/params.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::str::FromStr;
55
pub use coupler_derive::{Enum, Params};
66

77
mod range;
8-
pub mod smooth;
98

109
pub use range::{Encode, Log, Range};
1110

0 commit comments

Comments
 (0)