Skip to content

Commit

Permalink
Merge pull request #1103 from paulfd/eg-lfo-target
Browse files Browse the repository at this point in the history
Add LFO frequency as an EG target
  • Loading branch information
paulfd authored Jul 20, 2022
2 parents 1eb728c + 935be2e commit 03dda27
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/sfizz/Region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,19 @@ bool sfz::Region::parseEGOpcodeV2(const Opcode& opcode)
break;
}

case hash("eg&_freq_lfo&"):
if (lfos.size() < opcode.parameters[1] - 1)
return false;
EG_target(ModKey::createNXYZ(ModId::LFOFrequency, id, opcode.parameters[1] - 1), Default::lfoFreqMod);
break;

case_any_ccN("eg&_freq_lfo&"):
if (lfos.size() < opcode.parameters[1] - 1)
return false;
EG_target_cc(ModKey::createNXYZ(ModId::LFOFrequency, id, opcode.parameters[1] - 1), Default::lfoFreqMod);
break;


default:
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/sfizz/modulations/ModId.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ int ModIds::flags(ModId id) noexcept
return kModIsPerVoice|kModIsAdditive;
case ModId::EGEqBandwidthDepth:
return kModIsPerVoice|kModIsAdditive;
case ModId::EGLFOFreqDepth:
return kModIsPerVoice|kModIsAdditive;

// unknown
default:
Expand Down
1 change: 1 addition & 0 deletions src/sfizz/modulations/ModId.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ enum class ModId : int {
EGEqGainDepth,
EGEqFrequencyDepth,
EGEqBandwidthDepth,
EGLFOFreqDepth,

_TargetsEnd,
// [/targets] --------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions src/sfizz/modulations/ModKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ std::string ModKey::toString() const
return absl::StrCat("EGEqFrequencyDepth {", region_.number(), ", N=", 1 + params_.N, ", X=", 1 + params_.X, "}");
case ModId::EGEqBandwidthDepth:
return absl::StrCat("EGEqBandwidthDepth {", region_.number(), ", N=", 1 + params_.N, ", X=", 1 + params_.X, "}");
case ModId::EGLFOFreqDepth:
return absl::StrCat("EGLFOFreqDepth {", region_.number(), ", N=", 1 + params_.N, ", X=", 1 + params_.X, "}");

default:
return {};
Expand Down Expand Up @@ -334,6 +336,8 @@ ModKey ModKey::getSourceDepthKey(ModKey source, ModKey target)
return ModKey::createNXYZ(ModId::EGEqFrequencyDepth, region, tp.N, tp.X);
case ModId::EqBandwidth:
return ModKey::createNXYZ(ModId::EGEqBandwidthDepth, region, tp.N, tp.X);
case ModId:: LFOFrequency:
return ModKey::createNXYZ(ModId::EGLFOFreqDepth, region, tp.N, tp.X);
default:
break;
}
Expand Down

0 comments on commit 03dda27

Please sign in to comment.