Skip to content

Commit

Permalink
Initialise nodes inline
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Noël committed Dec 16, 2023
1 parent f91ac62 commit dcdce3c
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 90 deletions.
18 changes: 8 additions & 10 deletions src/effects/adsr/adsr_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ impl Adsr {
context.maximum_frame_count(),
));

let node = GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
DspParameters::empty(),
);

Self {
node,
node: GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
DspParameters::empty(),
),
event_transmitter,
}
}
Expand Down
18 changes: 8 additions & 10 deletions src/effects/biquad/biquad_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,15 @@ impl Biquad {
filter_type,
));

let node = GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
realtime_params,
);

Self {
node,
node: GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
realtime_params,
),
parameters: params,
}
}
Expand Down
21 changes: 11 additions & 10 deletions src/effects/compressor/compressor_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@ impl Compressor {
context.maximum_frame_count(),
));

let node = GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
realtime_params,
);

Self { node, params }
Self {
node: GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
realtime_params,
),
params,
}
}

/// Get the attack parameter
Expand Down
21 changes: 11 additions & 10 deletions src/effects/convolution/convolution_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ impl Convolution {
context.maximum_frame_count(),
));

let node = GraphNode::new(
id,
context,
input_count,
output_count,
processor,
realtime_params,
);

Self { node, params }
Self {
node: GraphNode::new(
id,
context,
input_count,
output_count,
processor,
realtime_params,
),
params,
}
}

/// Get the wet parameter
Expand Down
18 changes: 8 additions & 10 deletions src/effects/mixer/mixer_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ impl Mixer {

let processor = Box::new(MixerProcessor::new(event_receiver));

let node = GraphNode::new(
id,
context,
input_count,
output_count,
processor,
DspParameters::empty(),
);

Self {
node,
node: GraphNode::new(
id,
context,
input_count,
output_count,
processor,
DspParameters::empty(),
),
gain_matrix,
event_transmitter,
}
Expand Down
21 changes: 11 additions & 10 deletions src/effects/oscillator/oscillator_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,17 @@ impl Oscillator {

let processor = Box::new(OscillatorProcessor::new(wavetable));

let node = GraphNode::new(
id,
context,
input_count,
output_count,
processor,
realtime_params,
);

Self { node, params }
Self {
node: GraphNode::new(
id,
context,
input_count,
output_count,
processor,
realtime_params,
),
params,
}
}

/// Get the frequency parameter
Expand Down
21 changes: 11 additions & 10 deletions src/effects/pan/pan_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ impl Pan {

let processor = Box::new(PanProcessor::new());

let node = GraphNode::new(
id,
context,
input_count,
output_count,
processor,
realtime_params,
);

Self { node, params }
Self {
node: GraphNode::new(
id,
context,
input_count,
output_count,
processor,
realtime_params,
),
params,
}
}

/// Get the pan parameter
Expand Down
18 changes: 8 additions & 10 deletions src/effects/sampler/sampler_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,15 @@ impl Sampler {
let sample_rate = sample.sample_rate();
let processor = Box::new(SamplerDspProcess::new(sample_rate, sample, event_receiver));

let node = GraphNode::new(
id,
context,
input_count,
output_count,
processor,
DspParameters::empty(),
);

Self {
node,
node: GraphNode::new(
id,
context,
input_count,
output_count,
processor,
DspParameters::empty(),
),
event_transmitter,
}
}
Expand Down
22 changes: 12 additions & 10 deletions src/effects/waveshaper/waveshaper_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,24 @@ impl Waveshaper {
context.maximum_frame_count(),
));

let node = GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
realtime_params,
);

Self { node, params }
Self {
node: GraphNode::new(
id,
context,
channel_count,
channel_count,
processor,
realtime_params,
),
params,
}
}

/// Get the overdrive parameter
pub fn overdrive(&mut self) -> &mut AudioParameter {
self.get_parameter_mut("overdrive")
}

/// Get the mix parameter
pub fn mix(&mut self) -> &mut AudioParameter {
self.get_parameter_mut("mix")
Expand Down

0 comments on commit dcdce3c

Please sign in to comment.