1
0
Fork 0

Format the dry level control as decibels

This commit is contained in:
Robbert van der Helm 2022-11-09 22:36:26 +01:00
parent 5b3c327e29
commit ec061cd0e5

View file

@ -45,7 +45,7 @@ struct BuffrGlitchParams {
/// From 0 to 1, how much of the dry signal to mix in. This defaults to 1 but it can be turned /// From 0 to 1, how much of the dry signal to mix in. This defaults to 1 but it can be turned
/// down to use Buffr Glitch as more of a synth. /// down to use Buffr Glitch as more of a synth.
#[id = "dry_mix"] #[id = "dry_mix"]
dry_amount: FloatParam, dry_level: FloatParam,
/// The number of octaves the input signal should be increased or decreased by. Useful to allow /// The number of octaves the input signal should be increased or decreased by. Useful to allow
/// larger grain sizes. /// larger grain sizes.
@ -82,16 +82,19 @@ impl Default for BuffrGlitchParams {
fn default() -> Self { fn default() -> Self {
Self { Self {
normalization_mode: EnumParam::new("Normalization", NormalizationMode::Auto), normalization_mode: EnumParam::new("Normalization", NormalizationMode::Auto),
dry_amount: FloatParam::new( dry_level: FloatParam::new(
"Dry Amount", "Dry Level",
1.0, 1.0,
FloatRange::Linear { min: 0.0, max: 1.0 }, FloatRange::Skewed {
min: 0.0,
max: 1.0,
factor: FloatRange::gain_skew_factor(util::MINUS_INFINITY_DB, 0.0),
},
) )
.with_smoother(SmoothingStyle::Linear(10.0)) .with_smoother(SmoothingStyle::Exponential(10.0))
.with_step_size(0.01) .with_unit(" dB")
.with_unit("%") .with_value_to_string(formatters::v2s_f32_gain_to_db(1))
.with_value_to_string(formatters::v2s_f32_percentage(0)) .with_string_to_value(formatters::s2v_f32_gain_to_db()),
.with_string_to_value(formatters::s2v_f32_percentage()),
octave_shift: IntParam::new( octave_shift: IntParam::new(
"Octave Shift", "Octave Shift",
@ -157,7 +160,7 @@ impl Plugin for BuffrGlitch {
let mut next_event = context.next_event(); let mut next_event = context.next_event();
for (sample_idx, channel_samples) in buffer.iter_samples().enumerate() { for (sample_idx, channel_samples) in buffer.iter_samples().enumerate() {
let dry_amount = self.params.dry_amount.smoothed.next(); let dry_amount = self.params.dry_level.smoothed.next();
// TODO: Split blocks based on events when adding polyphony, this is just a simple proof // TODO: Split blocks based on events when adding polyphony, this is just a simple proof
// of concept // of concept