From b881c84b3ca532dd417c44d318a0b01f2792c8c8 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 17 Sep 2019 21:43:21 -0400 Subject: [PATCH] Disable absolute mode for Global pitch With the intro of 'absolute' pitch shift for the oscillators the global shift had the mode, which gave it the UI of doing absolute pitch, but not the DSP code. So split the pitch control types and apply correctly. Closes #1188 --- src/common/Parameter.cpp | 7 ++++++- src/common/Parameter.h | 1 + src/common/SurgePatch.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/Parameter.cpp b/src/common/Parameter.cpp index bee2609c8cd..3a1ad237780 100644 --- a/src/common/Parameter.cpp +++ b/src/common/Parameter.cpp @@ -177,7 +177,7 @@ bool Parameter::can_be_absolute() switch (ctrltype) { case ct_oscspread: - case ct_pitch_semi7bp: + case ct_pitch_semi7bp_absolutable: return true; } return false; @@ -256,6 +256,7 @@ void Parameter::set_type(int ctrltype) val_default.i = 2; break; case ct_pitch_semi7bp: + case ct_pitch_semi7bp_absolutable: valtype = vt_float; val_min.f = -7; val_max.f = 7; @@ -746,6 +747,7 @@ float Parameter::get_extended(float f) case ct_freq_shift: return 100.f * f; case ct_pitch_semi7bp: + case ct_pitch_semi7bp_absolutable: return 12.f * f; default: return f; @@ -953,6 +955,9 @@ void Parameter::get_display(char* txt, bool external, float ef) sprintf(txt, "%.2f semitones", f); break; case ct_pitch_semi7bp: + sprintf(txt, "%.2f", get_extended(f)); + break; + case ct_pitch_semi7bp_absolutable: if(absolute) sprintf(txt, "%.1f Hz", 10 * get_extended(f)); else diff --git a/src/common/Parameter.h b/src/common/Parameter.h index f02636bebf0..35fe4bf05a1 100644 --- a/src/common/Parameter.h +++ b/src/common/Parameter.h @@ -26,6 +26,7 @@ enum ctrltypes ct_percent_bidirectional, ct_pitch_octave, ct_pitch_semi7bp, + ct_pitch_semi7bp_absolutable, ct_pitch, ct_fmratio, ct_fmratio_int, diff --git a/src/common/SurgePatch.cpp b/src/common/SurgePatch.cpp index d8aabba3b3c..d1e19d112dd 100644 --- a/src/common/SurgePatch.cpp +++ b/src/common/SurgePatch.cpp @@ -161,7 +161,7 @@ SurgePatch::SurgePatch(SurgeStorage* storage) cg_OSC, osc, false, Surge::ParamConfig::kHorizontal | kNoPopup)); py = gui_mainsec_slider_y; a->push_back(scene[sc].osc[osc].pitch.assign(p_id++, id_s++, "pitch", "Pitch", - ct_pitch_semi7bp, px, py, sc_id, cg_OSC, osc, + ct_pitch_semi7bp_absolutable, px, py, sc_id, cg_OSC, osc, true, Surge::ParamConfig::kHorizontal | kSemitone | sceasy)); py += gui_hfader_dist; for (int i = 0; i < n_osc_params; i++)