Skip to content

Commit

Permalink
Disable absolute mode for Global pitch (surge-synthesizer#1189)
Browse files Browse the repository at this point in the history
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 surge-synthesizer#1188
  • Loading branch information
baconpaul authored Sep 18, 2019
1 parent 4303830 commit a3c5031
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/common/Parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/common/SurgePatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down

0 comments on commit a3c5031

Please sign in to comment.