fix 'det' parameter of MidiP

This commit is contained in:
Weird Constructor 2022-08-13 11:33:50 +02:00
parent a40cc226fd
commit 1d595fe52f
4 changed files with 20 additions and 3 deletions

View file

@ -8,6 +8,7 @@ parameter was changed or modulated at runtime.
* Bugfix: Found a bug in cubic interpolation in the sample player and * Bugfix: Found a bug in cubic interpolation in the sample player and
similar bugs in the delay line (and all-pass & comb filters). Refactored similar bugs in the delay line (and all-pass & comb filters). Refactored
the cubic interpolation and tested it seperately now. the cubic interpolation and tested it seperately now.
* Change: Moved DSP code over to `synfx-dsp` crate.
* Feature: Matrix::get\_connections() returns information about the connections * Feature: Matrix::get\_connections() returns information about the connections
to the adjacent cells. to the adjacent cells.
* Feature: Added the MatrixCellChain abstraction for easy creation of DSP * Feature: Added the MatrixCellChain abstraction for easy creation of DSP
@ -15,5 +16,4 @@ chains on the hexagonal Matrix.
* Feature: Added Scope DSP node and NodeConfigurator/Matrix API for retrieving * Feature: Added Scope DSP node and NodeConfigurator/Matrix API for retrieving
the scope handles for access to it's capture buffers. the scope handles for access to it's capture buffers.
* Feature: Added WBlockDSP visual programming language utilizing the `synfx-dsp-jit` crate. * Feature: Added WBlockDSP visual programming language utilizing the `synfx-dsp-jit` crate.
* Change: Moved DSP code over to `synfx-dsp` crate.
* Feature: Added the `FormFM` node that was contributed by Dimas Leenman (aka Skythedragon). * Feature: Added the `FormFM` node that was contributed by Dimas Leenman (aka Skythedragon).

View file

@ -120,6 +120,23 @@ impl MatrixCellChain {
self self
} }
/// Sets the normalized value of the current parameter cell's parameter.
///
/// The current parameter cell is set automatically when a new node is added.
/// Alternatively you can use [MatrixCellChain::params_for_idx] to set the current
/// parameter cell.
pub fn set_norm(&mut self, param: &str, norm: f32) -> &mut Self {
let link = self.chain.get_mut(self.param_idx).expect("Correct parameter idx");
if let Some(pid) = link.cell.node_id().inp_param(param) {
link.params.push((pid, SAtom::param(norm as f32)));
} else {
self.error = Some(ChainError::UnknownInput(link.cell.node_id(), param.to_string()));
}
self
}
/// Sets the atom value of the current parameter cell's parameter. /// Sets the atom value of the current parameter cell's parameter.
/// ///
/// The current parameter cell is set automatically when a new node is added. /// The current parameter cell is set automatically when a new node is added.

View file

@ -112,7 +112,7 @@ impl DspNode for MidiP {
let chan = ectx.note_buffer.get_chan_at(channel, frame as u8); let chan = ectx.note_buffer.get_chan_at(channel, frame as u8);
let note = (chan.note as f32 - 69.0) / 120.0; let note = (chan.note as f32 - 69.0) / 120.0;
let note = note + denorm::MidiP::det(det, frame); let note = note + det.read(frame);
freq.write(frame, note); freq.write(frame, note);
if chan.gate & 0x10 > 0 { if chan.gate & 0x10 > 0 {

View file

@ -75,7 +75,7 @@ fn check_node_midip_pitch_det() {
let mut chain = MatrixCellChain::new(CellDir::B); let mut chain = MatrixCellChain::new(CellDir::B);
chain chain
.node_out("midip", "freq") .node_out("midip", "freq")
.set_denorm("det", 0.1) .set_norm("det", 0.1)
.node_inp("out", "ch1") .node_inp("out", "ch1")
.place(&mut matrix, 0, 0) .place(&mut matrix, 0, 0)
.unwrap(); .unwrap();