Skip to content

Commit

Permalink
PitchShiftEffect: remove range mode and wide range
Browse files Browse the repository at this point in the history
This commit removes the Range Mode option and Wide Range option
for the Pitch shift effect. These options should be replaced with
only one option which will handle the Range of the Pitch knob.
  • Loading branch information
davidchocholaty committed Aug 22, 2022
1 parent c49712a commit af71fea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 56 deletions.
55 changes: 1 addition & 54 deletions src/effects/backends/builtin/pitchshifteffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,6 @@ EffectManifestPointer PitchShiftEffect::getManifest() {
pitch->setNeutralPointOnScale(0.0);
pitch->setRange(-1.0, 0.0, 1.0);

EffectManifestParameterPointer rangeMode = pManifest->addParameter();
rangeMode->setId("rangeMode");
rangeMode->setName(QObject::tr("Mode"));
rangeMode->setShortName(QObject::tr("Mode"));
rangeMode->setDescription(QObject::tr(
"Set the range mode. There are three possible options "
"based on the knob position:\n"
"neutral:\n"
"\t - knob: default\n"
"\t - range: from the lowest pitch to the highest pitch\n"
"positive:\n"
"\t - knob: maximum\n"
"\t - range: from the default pitch to the highest pitch\n"
"negative:\n"
"\t - knob: minimum\n"
"\t - range: from the default pitch to the lowest pitch"));
rangeMode->setValueScaler(EffectManifestParameter::ValueScaler::Linear);
rangeMode->setDefaultLinkType(EffectManifestParameter::LinkType::Linked);
rangeMode->setNeutralPointOnScale(0.0);
rangeMode->setRange(-1.0, 0.0, 1.0);

EffectManifestParameterPointer semitonesMode = pManifest->addParameter();
semitonesMode->setId("semitonesMode");
semitonesMode->setName(QObject::tr("Semitones"));
Expand All @@ -102,16 +81,6 @@ EffectManifestPointer PitchShiftEffect::getManifest() {
semitonesMode->setUnitsHint(EffectManifestParameter::UnitsHint::Unknown);
semitonesMode->setRange(0, 1, 1);

EffectManifestParameterPointer wideRange = pManifest->addParameter();
wideRange->setId("wideRange");
wideRange->setName(QObject::tr("Wide Range"));
wideRange->setShortName(QObject::tr("Wide Range"));
wideRange->setDescription(QObject::tr(
"Double the pitch scale range."));
wideRange->setValueScaler(EffectManifestParameter::ValueScaler::Toggle);
wideRange->setUnitsHint(EffectManifestParameter::UnitsHint::Unknown);
wideRange->setRange(0, 0, 1);

EffectManifestParameterPointer formant = pManifest->addParameter();
formant->setId("formant");
formant->setName(QObject::tr("Formant"));
Expand All @@ -128,9 +97,7 @@ EffectManifestPointer PitchShiftEffect::getManifest() {
void PitchShiftEffect::loadEngineEffectParameters(
const QMap<QString, EngineEffectParameterPointer>& parameters) {
m_pPitchParameter = parameters.value("pitch");
m_pRangeModeParameter = parameters.value("rangeMode");
m_pSemitonesModeParameter = parameters.value("semitonesMode");
m_pWideRangeParameter = parameters.value("wideRange");
m_pFormantParameter = parameters.value("formant");
}

Expand All @@ -154,27 +121,7 @@ void PitchShiftEffect::processChannel(
OptionFormantShifted);
}

const double rangeModeParameter = m_pRangeModeParameter->value();

double pitchParameter = [=, this] {
if (std::abs(rangeModeParameter) < 0.5) {
if (m_pWideRangeParameter->toBool()) {
return m_pPitchParameter->value() * kWideRangeOctaves;
} else {
return m_pPitchParameter->value();
}
} else {
if (m_pWideRangeParameter->toBool()) {
return sgn(rangeModeParameter) * kWideRangeOctaves *
(m_pPitchParameter->value() + 1) /
kDefaultNorm;
} else {
return sgn(rangeModeParameter) *
(m_pPitchParameter->value() + 1) /
kDefaultNorm;
}
}
}();
double pitchParameter = m_pPitchParameter->value();

if (m_pSemitonesModeParameter->toBool()) {
pitchParameter = roundToFraction(pitchParameter, kSemitones);
Expand Down
2 changes: 0 additions & 2 deletions src/effects/backends/builtin/pitchshifteffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ class PitchShiftEffect final : public EffectProcessorImpl<PitchShiftGroupState>

bool m_currentFormant;
EngineEffectParameterPointer m_pPitchParameter;
EngineEffectParameterPointer m_pRangeModeParameter;
EngineEffectParameterPointer m_pSemitonesModeParameter;
EngineEffectParameterPointer m_pWideRangeParameter;
EngineEffectParameterPointer m_pFormantParameter;

DISALLOW_COPY_AND_ASSIGN(PitchShiftEffect);
Expand Down

0 comments on commit af71fea

Please sign in to comment.