Implement some oncc for EGv2
This commit is contained in:
parent
ea7bb1cf6c
commit
1052025072
4 changed files with 67 additions and 36 deletions
|
|
@ -1345,6 +1345,19 @@ bool sfz::Region::parseEGOpcodeV2(const Opcode& opcode)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return &eg.points[pointNumber];
|
return &eg.points[pointNumber];
|
||||||
};
|
};
|
||||||
|
auto EG_target = [this, &opcode, egNumber](ModId targetId, ModId depthId, const OpcodeSpec<float>& spec) -> bool {
|
||||||
|
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
||||||
|
const ModKey target = ModKey::createNXYZ(targetId, id);
|
||||||
|
Connection& conn = getOrCreateConnection(source, target);
|
||||||
|
if (depthId == ModId::Undefined)
|
||||||
|
conn.sourceDepth = opcode.read(spec);
|
||||||
|
else {
|
||||||
|
const ModKey depth = ModKey::createNXYZ(depthId, id, egNumber);
|
||||||
|
conn.sourceDepthMod = depth;
|
||||||
|
processGenericCc(opcode, spec, depth);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
auto LFO_EG_filter_EQ_target = [this, &opcode, egNumber](ModId sourceId, ModId targetId, const OpcodeSpec<float>& spec) -> bool {
|
auto LFO_EG_filter_EQ_target = [this, &opcode, egNumber](ModId sourceId, ModId targetId, const OpcodeSpec<float>& spec) -> bool {
|
||||||
const unsigned index = opcode.parameters.size() == 2 ? opcode.parameters.back() - 1 : 0;
|
const unsigned index = opcode.parameters.size() == 2 ? opcode.parameters.back() - 1 : 0;
|
||||||
if (!extendIfNecessary(filters, index + 1, Default::numFilters))
|
if (!extendIfNecessary(filters, index + 1, Default::numFilters))
|
||||||
|
|
@ -1386,52 +1399,40 @@ bool sfz::Region::parseEGOpcodeV2(const Opcode& opcode)
|
||||||
|
|
||||||
// Modulation: Flex EG (targets)
|
// Modulation: Flex EG (targets)
|
||||||
case hash("eg&_amplitude"):
|
case hash("eg&_amplitude"):
|
||||||
{
|
EG_target(ModId::Amplitude, {}, Default::amplitudeMod);
|
||||||
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
break;
|
||||||
const ModKey target = ModKey::createNXYZ(ModId::Amplitude, id);
|
case_any_ccN("eg&_amplitude"):
|
||||||
getOrCreateConnection(source, target).sourceDepth =
|
EG_target(ModId::Amplitude, ModId::EGAmplitudeDepth, Default::amplitudeMod);
|
||||||
opcode.read(Default::amplitudeMod);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case hash("eg&_pan"):
|
case hash("eg&_pan"):
|
||||||
{
|
EG_target(ModId::Pan, {}, Default::panMod);
|
||||||
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
break;
|
||||||
const ModKey target = ModKey::createNXYZ(ModId::Pan, id);
|
case_any_ccN("eg&_pan"):
|
||||||
getOrCreateConnection(source, target).sourceDepth =
|
EG_target(ModId::Pan, ModId::EGPanDepth, Default::panMod);
|
||||||
opcode.read(Default::panMod);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case hash("eg&_width"):
|
case hash("eg&_width"):
|
||||||
{
|
EG_target(ModId::Width, {}, Default::widthMod);
|
||||||
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
break;
|
||||||
const ModKey target = ModKey::createNXYZ(ModId::Width, id);
|
case_any_ccN("eg&_width"):
|
||||||
getOrCreateConnection(source, target).sourceDepth =
|
EG_target(ModId::Width, ModId::EGWidthDepth, Default::widthMod);
|
||||||
opcode.read(Default::widthMod);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case hash("eg&_position"): // sfizz extension
|
case hash("eg&_position"): // sfizz extension
|
||||||
{
|
EG_target(ModId::Position, {}, Default::positionMod);
|
||||||
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
break;
|
||||||
const ModKey target = ModKey::createNXYZ(ModId::Position, id);
|
case_any_ccN("eg&_position"): // sfizz extension
|
||||||
getOrCreateConnection(source, target).sourceDepth =
|
EG_target(ModId::Position, ModId::EGPositionDepth, Default::positionMod);
|
||||||
opcode.read(Default::positionMod);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case hash("eg&_pitch"):
|
case hash("eg&_pitch"):
|
||||||
{
|
EG_target(ModId::Pitch, {}, Default::pitchMod);
|
||||||
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
break;
|
||||||
const ModKey target = ModKey::createNXYZ(ModId::Pitch, id);
|
case_any_ccN("eg&_pitch"):
|
||||||
getOrCreateConnection(source, target).sourceDepth =
|
EG_target(ModId::Pitch, ModId::EGPitchDepth, Default::pitchMod);
|
||||||
opcode.read(Default::pitchMod);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case hash("eg&_volume"):
|
case hash("eg&_volume"):
|
||||||
{
|
EG_target(ModId::Volume, {}, Default::volumeMod);
|
||||||
const ModKey source = ModKey::createNXYZ(ModId::Envelope, id, egNumber);
|
break;
|
||||||
const ModKey target = ModKey::createNXYZ(ModId::Volume, id);
|
case_any_ccN("eg&_volume"):
|
||||||
getOrCreateConnection(source, target).sourceDepth =
|
EG_target(ModId::Volume, ModId::EGVolumeDepth, Default::volumeMod);
|
||||||
opcode.read(Default::volumeMod);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case hash("eg&_cutoff&"):
|
case hash("eg&_cutoff&"):
|
||||||
LFO_EG_filter_EQ_target(ModId::Envelope, ModId::FilCutoff, Default::filterCutoffMod);
|
LFO_EG_filter_EQ_target(ModId::Envelope, ModId::FilCutoff, Default::filterCutoffMod);
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,18 @@ int ModIds::flags(ModId id) noexcept
|
||||||
return kModIsPerVoice|kModIsAdditive;
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
case ModId::LFOVolumeDepth:
|
case ModId::LFOVolumeDepth:
|
||||||
return kModIsPerVoice|kModIsAdditive;
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
|
case ModId::EGAmplitudeDepth:
|
||||||
|
return kModIsPerVoice|kModIsMultiplicative;
|
||||||
|
case ModId::EGPanDepth:
|
||||||
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
|
case ModId::EGWidthDepth:
|
||||||
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
|
case ModId::EGPositionDepth:
|
||||||
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
|
case ModId::EGPitchDepth:
|
||||||
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
|
case ModId::EGVolumeDepth:
|
||||||
|
return kModIsPerVoice|kModIsAdditive;
|
||||||
|
|
||||||
// unknown
|
// unknown
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,12 @@ enum class ModId : int {
|
||||||
LFOPositionDepth,
|
LFOPositionDepth,
|
||||||
LFOPitchDepth,
|
LFOPitchDepth,
|
||||||
LFOVolumeDepth,
|
LFOVolumeDepth,
|
||||||
|
EGAmplitudeDepth,
|
||||||
|
EGPanDepth,
|
||||||
|
EGWidthDepth,
|
||||||
|
EGPositionDepth,
|
||||||
|
EGPitchDepth,
|
||||||
|
EGVolumeDepth,
|
||||||
|
|
||||||
_TargetsEnd,
|
_TargetsEnd,
|
||||||
// [/targets] --------------------------------------------------------------
|
// [/targets] --------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,18 @@ std::string ModKey::toString() const
|
||||||
return absl::StrCat("LFOPitchDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
return absl::StrCat("LFOPitchDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
case ModId::LFOVolumeDepth:
|
case ModId::LFOVolumeDepth:
|
||||||
return absl::StrCat("LFOVolumeDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
return absl::StrCat("LFOVolumeDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
case ModId::EGAmplitudeDepth:
|
||||||
|
return absl::StrCat("EGAmplitudeDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
case ModId::EGPanDepth:
|
||||||
|
return absl::StrCat("EGPanDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
case ModId::EGWidthDepth:
|
||||||
|
return absl::StrCat("EGWidthDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
case ModId::EGPositionDepth:
|
||||||
|
return absl::StrCat("EGPositionDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
case ModId::EGPitchDepth:
|
||||||
|
return absl::StrCat("EGPitchDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
case ModId::EGVolumeDepth:
|
||||||
|
return absl::StrCat("EGVolumeDepth {", region_.number(), ", N=", 1 + params_.N, "}");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue