Add test for opcode normalization
This commit is contained in:
parent
cd8ea73d0a
commit
4063d0e35f
1 changed files with 56 additions and 0 deletions
|
|
@ -158,3 +158,59 @@ TEST_CASE("[Opcode] Derived names")
|
||||||
REQUIRE(sfz::Opcode("noise_level_smoothcc55", "").getDerivedName(sfz::kOpcodeStepCcN) == "noise_level_stepcc55");
|
REQUIRE(sfz::Opcode("noise_level_smoothcc55", "").getDerivedName(sfz::kOpcodeStepCcN) == "noise_level_stepcc55");
|
||||||
REQUIRE(sfz::Opcode("sample", "").getDerivedName(sfz::kOpcodeSmoothCcN, 66) == "sample_smoothcc66");
|
REQUIRE(sfz::Opcode("sample", "").getDerivedName(sfz::kOpcodeSmoothCcN, 66) == "sample_smoothcc66");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("[Opcode] Normalization")
|
||||||
|
{
|
||||||
|
REQUIRE(sfz::Opcode("foo_cc7", "").cleanUp(sfz::kOpcodeScopeGeneric).opcode == "foo_oncc7");
|
||||||
|
REQUIRE(sfz::Opcode("foo_cc7", "").cleanUp(sfz::kOpcodeScopeRegion).opcode == "foo_oncc7");
|
||||||
|
|
||||||
|
static const std::pair<absl::string_view, absl::string_view> regionSpecific[] = {
|
||||||
|
// LFO SFZv1
|
||||||
|
{"amplfo_depthcc1", "amplfo_depth_oncc1"},
|
||||||
|
{"fillfo_freqcc2", "fillfo_freq_oncc2"},
|
||||||
|
{"pitchlfo_fadecc3", "pitchlfo_fade_oncc3"},
|
||||||
|
// EG SFZv1
|
||||||
|
{"ampeg_delaycc4", "ampeg_delay_oncc4"},
|
||||||
|
{"fileg_startcc5", "fileg_start_oncc5"},
|
||||||
|
{"pitcheg_attackcc6", "pitcheg_attack_oncc6"},
|
||||||
|
{"ampeg_holdcc7", "ampeg_hold_oncc7"},
|
||||||
|
{"fileg_decaycc8", "fileg_decay_oncc8"},
|
||||||
|
{"pitcheg_sustaincc9", "pitcheg_sustain_oncc9"},
|
||||||
|
{"ampeg_releasecc10", "ampeg_release_oncc10"},
|
||||||
|
// EQ SFZv1
|
||||||
|
{"eq11_bwcc12", "eq11_bw_oncc12"},
|
||||||
|
{"eq13_freqcc14", "eq13_freq_oncc14"},
|
||||||
|
{"eq15_gaincc16", "eq15_gain_oncc16"},
|
||||||
|
// LFO SFZv2
|
||||||
|
{"lfo17_wave", "lfo17_wave1"},
|
||||||
|
{"lfo18_offset", "lfo18_offset1"},
|
||||||
|
{"lfo19_ratio", "lfo19_ratio1"},
|
||||||
|
{"lfo20_scale", "lfo20_scale1"},
|
||||||
|
// LinuxSampler aliases
|
||||||
|
{"loopmode", "loop_mode"},
|
||||||
|
{"loopstart", "loop_start"},
|
||||||
|
{"loopend", "loop_end"},
|
||||||
|
{"offby", "off_by"},
|
||||||
|
{"offmode", "off_mode"},
|
||||||
|
{"bendup", "bend_up"},
|
||||||
|
{"benddown", "bend_down"},
|
||||||
|
{"filtype", "fil1_type"},
|
||||||
|
{"fil21type", "fil21_type"},
|
||||||
|
// ARIA aliases
|
||||||
|
{"polyphony_group", "group"},
|
||||||
|
{"gain", "volume"},
|
||||||
|
{"gain_foobar", "volume_foobar"},
|
||||||
|
{"tune", "pitch"},
|
||||||
|
{"tune_foobar", "pitch_foobar"},
|
||||||
|
// SFZv2 aliases
|
||||||
|
{"on_hicc22", "start_hicc22"},
|
||||||
|
{"on_locc23", "start_locc23"},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto pair : regionSpecific) {
|
||||||
|
absl::string_view input = pair.first;
|
||||||
|
absl::string_view expected = pair.second;
|
||||||
|
REQUIRE(sfz::Opcode(input, "").cleanUp(sfz::kOpcodeScopeRegion).opcode == expected);
|
||||||
|
REQUIRE(sfz::Opcode(input, "").cleanUp(sfz::kOpcodeScopeGeneric).opcode == input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue