Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
russellmcc authored Oct 21, 2024
2 parents 49fb350 + 647cf86 commit 6508541
Show file tree
Hide file tree
Showing 19 changed files with 652 additions and 265 deletions.
25 changes: 13 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/p61/component/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
itertools = "0.13.0"
num-derive = "0.4.2"
num-traits = "0.2.19"
conformal_component = "0.2.0"
conformal_component = "0.3.0"
poly = { path = "../../shared/poly" }
util = { path = "../../shared/util" }
iir = { path = "../../shared/iir" }
Expand Down
9 changes: 8 additions & 1 deletion rust/p61/component/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const fn percentage(default: f32) -> TypeSpecificInfoRef<'static, &'static str>
}
}

static PARAMETERS: [InfoRef<'static, &'static str>; 26] = [
static PARAMETERS: [InfoRef<'static, &'static str>; 27] = [
InfoRef {
title: "DCO1 Shape",
short_title: "DCO1Shape",
Expand Down Expand Up @@ -133,6 +133,13 @@ static PARAMETERS: [InfoRef<'static, &'static str>; 26] = [
flags: Flags { automatable: true },
type_specific: percentage(0.0),
},
InfoRef {
title: "VCF Timbre Control",
short_title: "VCF Timbre",
unique_id: "timbre_vcf",
flags: Flags { automatable: true },
type_specific: percentage(0.0),
},
InfoRef {
title: "Attack Time",
short_title: "Attack",
Expand Down
6 changes: 4 additions & 2 deletions rust/p61/component/src/synth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@ impl SynthT for Synth {
Data::NoteOff { .. } => {
self.mg_env.off();
}
Data::NoteExpression { .. } => {}
}
}
}

fn process<E: IntoIterator<Item = Event> + Clone, P: parameters::BufferStates, O: BufferMut>(
fn process<E: Iterator<Item = Event> + Clone, P: parameters::BufferStates, O: BufferMut>(
&mut self,
events: Events<E>,
parameters: P,
Expand Down Expand Up @@ -133,6 +134,7 @@ impl SynthT for Synth {
Data::NoteOff { .. } => {
self.mg_env.off();
}
Data::NoteExpression { .. } => {}
}
mg_events.next();
}
Expand All @@ -155,7 +157,7 @@ impl SynthT for Synth {
*wheel_sample = self.wheel_mg.generate(wheel_incr);
}
self.poly.render_audio(
events,
events.into_iter(),
&parameters,
&SharedData {
mg_data: mg_scratch,
Expand Down
16 changes: 7 additions & 9 deletions rust/p61/component/src/synth/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ fn generate_snapshot_with_params(
params: ConstantBufferStates<StatesMap>,
) -> Vec<f32> {
let mut output = BufferData::new(ChannelLayout::Mono, num_samples);
let events = vec![
let events = [
Event {
sample_offset: 0,
data: Data::NoteOn {
data: NoteData {
channel: 0,
id: NoteID::from_pitch(60),
pitch: 60,
velocity: 1.0,
Expand All @@ -61,7 +60,6 @@ fn generate_snapshot_with_params(
sample_offset: (num_samples as f32 * 0.8) as usize,
data: Data::NoteOff {
data: NoteData {
channel: 0,
id: NoteID::from_pitch(60),
pitch: 60,
velocity: 1.0,
Expand Down Expand Up @@ -198,35 +196,35 @@ fn snapshot_separate_events() {
synth.handle_events(
vec![Data::NoteOn {
data: NoteData {
channel: 0,
id: NoteID::from_pitch(60),
pitch: 60,
velocity: 1.0,
tuning: 0.0,
},
}],
}]
.into_iter(),
dummy_params_map(),
);
synth.process(
Events::new([], note_on_samples).unwrap(),
Events::new([].into_iter(), note_on_samples).unwrap(),
dummy_params(),
&mut slice_buffer_mut(&mut output, ..note_on_samples),
);
synth.handle_events(
vec![Data::NoteOff {
data: NoteData {
channel: 0,
id: NoteID::from_pitch(60),
pitch: 60,
velocity: 1.0,
tuning: 0.0,
},
}],
}]
.into_iter(),
dummy_params_map(),
);

synth.process(
Events::new([], num_samples - note_on_samples).unwrap(),
Events::new([].into_iter(), num_samples - note_on_samples).unwrap(),
dummy_params(),
&mut slice_buffer_mut(&mut output, note_on_samples..),
);
Expand Down
Loading

0 comments on commit 6508541

Please sign in to comment.