add alternate option
parent
3cce56550e
commit
34caf19fdd
|
@ -10,12 +10,18 @@ baseplug::model! {
|
|||
#[model(min = 0.0, max = 1.0)]
|
||||
#[parameter(name = "offset")]
|
||||
offset: f32,
|
||||
#[model(min = 0.0, max = 1.0)]
|
||||
#[parameter(name = "alternate")]
|
||||
alternate: f32,
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GainModel {
|
||||
fn default() -> Self {
|
||||
Self { offset: 0.0 }
|
||||
Self {
|
||||
offset: 0.0,
|
||||
alternate: 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,8 +48,13 @@ impl Plugin for Gain {
|
|||
let output = &mut ctx.outputs[0].buffers;
|
||||
|
||||
for i in 0..ctx.nframes {
|
||||
if model.alternate[i] < 0.5 {
|
||||
output[0][i] = input[0][i] + model.offset[i];
|
||||
output[1][i] = input[1][i] - model.offset[i];
|
||||
} else {
|
||||
output[0][i] = input[0][i] - model.offset[i];
|
||||
output[1][i] = input[1][i] + model.offset[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue