Working tests

This commit is contained in:
Paul Fd 2021-02-04 00:19:11 +01:00 committed by Paul Ferrand
parent 49d749e354
commit cb2caf4b15
6 changed files with 79 additions and 85 deletions

View file

@ -21,8 +21,7 @@ Curve Curve::buildCurveFromHeader(
{ {
Curve curve; Curve curve;
bool fillStatus[NumValues] = {}; bool fillStatus[NumValues] = {};
const OpcodeSpec<float> fullRange {0.0f, Range<float>(-HUGE_VALF, +HUGE_VALF), 0 }; const OpcodeSpec<float> fullRange {0.0f, Range<float>{ -1e16, 1e16 }, 0 };
auto setPoint = [&curve, &fillStatus](int i, float x) { auto setPoint = [&curve, &fillStatus](int i, float x) {
curve._points[i] = x; curve._points[i] = x;
fillStatus[i] = true; fillStatus[i] = true;

View file

@ -16,13 +16,13 @@ extern const OpcodeSpec<uint32_t> loopStart { 0, Range<uint32_t>(0, uint32_t_max
extern const OpcodeSpec<uint32_t> loopEnd { uint32_t_max, Range<uint32_t>(0, uint32_t_max), 0 }; extern const OpcodeSpec<uint32_t> loopEnd { uint32_t_max, Range<uint32_t>(0, uint32_t_max), 0 };
extern const OpcodeSpec<float> loopCrossfade { 1e-3, Range<float>(1e-3, 1.0f), 0 }; extern const OpcodeSpec<float> loopCrossfade { 1e-3, Range<float>(1e-3, 1.0f), 0 };
extern const OpcodeSpec<OscillatorEnabled> oscillator { OscillatorEnabled::Auto, Range<OscillatorEnabled>(OscillatorEnabled::Auto, OscillatorEnabled::On), 0 }; extern const OpcodeSpec<OscillatorEnabled> oscillator { OscillatorEnabled::Auto, Range<OscillatorEnabled>(OscillatorEnabled::Auto, OscillatorEnabled::On), 0 };
extern const OpcodeSpec<float> oscillatorPhase { 0.0f, Range<float>(0.0f, 1.0f), 0 }; extern const OpcodeSpec<float> oscillatorPhase { 0.0f, Range<float>(-1000.0f, 1000.0f), 0 };
extern const OpcodeSpec<int> oscillatorMode { 0, Range<int>(0, 2), 0 }; extern const OpcodeSpec<int> oscillatorMode { 0, Range<int>(0, 2), 0 };
extern const OpcodeSpec<int> oscillatorMulti { 1, Range<int>(1, config::oscillatorsPerVoice), 0 }; extern const OpcodeSpec<int> oscillatorMulti { 1, Range<int>(1, config::oscillatorsPerVoice), 0 };
extern const OpcodeSpec<float> oscillatorDetune { 0.0f, Range<float>(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec<float> oscillatorDetune { 0.0f, Range<float>(-12000.0f, 12000.0f), 0 };
extern const OpcodeSpec<float> oscillatorDetuneMod { 0.0f, Range<float>(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec<float> oscillatorDetuneMod { 0.0f, Range<float>(-12000.0f, 12000.0f), 0 };
extern const OpcodeSpec<float> oscillatorModDepth { 0.0f, Range<float>(0.0f, 10000.0f), 0 }; extern const OpcodeSpec<float> oscillatorModDepth { 0.0f, Range<float>(0.0f, 10000.0f), kNormalizePercent };
extern const OpcodeSpec<float> oscillatorModDepthMod { 0.0f, Range<float>(0.0f, 10000.0f), 0 }; extern const OpcodeSpec<float> oscillatorModDepthMod { 0.0f, Range<float>(0.0f, 10000.0f), kNormalizePercent };
extern const OpcodeSpec<int> oscillatorQuality { 1, Range<int>(0, 3), 0 }; extern const OpcodeSpec<int> oscillatorQuality { 1, Range<int>(0, 3), 0 };
extern const OpcodeSpec<uint32_t> group { 0, Range<uint32_t>(0, uint32_t_max), 0 }; extern const OpcodeSpec<uint32_t> group { 0, Range<uint32_t>(0, uint32_t_max), 0 };
extern const OpcodeSpec<float> offTime { 6e-3f, Range<float>(0.0f, 100.0f), 0 }; extern const OpcodeSpec<float> offTime { 6e-3f, Range<float>(0.0f, 100.0f), 0 };
@ -47,7 +47,7 @@ extern const OpcodeSpec<uint16_t> ccNumber { 0, Range<uint16_t>(0, config::numCC
extern const OpcodeSpec<uint8_t> smoothCC { 0, Range<uint8_t>(0, 100), 0 }; extern const OpcodeSpec<uint8_t> smoothCC { 0, Range<uint8_t>(0, 100), 0 };
extern const OpcodeSpec<uint8_t> curveCC { 0, Range<uint8_t>(0, 255), 0 }; extern const OpcodeSpec<uint8_t> curveCC { 0, Range<uint8_t>(0, 255), 0 };
extern const OpcodeSpec<uint8_t> sustainCC { 64, Range<uint8_t>(0, 127), 0 }; extern const OpcodeSpec<uint8_t> sustainCC { 64, Range<uint8_t>(0, 127), 0 };
extern const OpcodeSpec<float> sustainThreshold { 1, Range<float>(0.0f, 127.0f), kNormalizeMidi }; extern const OpcodeSpec<float> sustainThreshold { 1.0f, Range<float>(0.0f, 127.0f), kNormalizeMidi };
extern const OpcodeSpec<bool> checkSustain { true, Range<bool>(0, 1), 0 }; extern const OpcodeSpec<bool> checkSustain { true, Range<bool>(0, 1), 0 };
extern const OpcodeSpec<bool> checkSostenuto { true, Range<bool>(0, 1), 0 }; extern const OpcodeSpec<bool> checkSostenuto { true, Range<bool>(0, 1), 0 };
extern const OpcodeSpec<float> loBPM { 0.0f, Range<float>(0.0f, 500.0f), 0 }; extern const OpcodeSpec<float> loBPM { 0.0f, Range<float>(0.0f, 500.0f), 0 };
@ -94,8 +94,8 @@ extern const OpcodeSpec<int> pitchKeytrack { 100, Range<int>(-1200, 1200), 0 };
extern const OpcodeSpec<float> pitchRandom { 0.0f, Range<float>(0.0f, 12000.0f), 0 }; extern const OpcodeSpec<float> pitchRandom { 0.0f, Range<float>(0.0f, 12000.0f), 0 };
extern const OpcodeSpec<int> pitchVeltrack { 0, Range<int>(-12000, 12000), 0 }; extern const OpcodeSpec<int> pitchVeltrack { 0, Range<int>(-12000, 12000), 0 };
extern const OpcodeSpec<int> transpose { 0, Range<int>(-127, 127), 0 }; extern const OpcodeSpec<int> transpose { 0, Range<int>(-127, 127), 0 };
extern const OpcodeSpec<float> pitch { 0.0f, Range<float>(-100.0f, 100.0f), 0 }; extern const OpcodeSpec<float> pitch { 0.0f, Range<float>(-2400.0f, 2400.0f), 0 };
extern const OpcodeSpec<float> pitchMod { 0.0f, Range<float>(-100.0f, 100.0f), 0 }; extern const OpcodeSpec<float> pitchMod { 0.0f, Range<float>(-2400.0f, 2400.0f), 0 };
extern const OpcodeSpec<float> bendUp { 200.0f, Range<float>(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec<float> bendUp { 200.0f, Range<float>(-12000.0f, 12000.0f), 0 };
extern const OpcodeSpec<float> bendDown { -200.0f, Range<float>(-12000.0f, 12000.0f), 0 }; extern const OpcodeSpec<float> bendDown { -200.0f, Range<float>(-12000.0f, 12000.0f), 0 };
extern const OpcodeSpec<float> bendStep { 1.0f, Range<float>(1.0f, 1200.0f), 0 }; extern const OpcodeSpec<float> bendStep { 1.0f, Range<float>(1.0f, 1200.0f), 0 };

View file

@ -142,12 +142,12 @@ absl::optional<T> readInt_(OpcodeSpec<T> spec, absl::string_view v)
if (spec.flags & kEnforceUpperBound) if (spec.flags & kEnforceUpperBound)
return spec.bounds.getEnd(); return spec.bounds.getEnd();
return {}; return absl::nullopt;
} else if (returnedValue < static_cast<int64_t>(spec.bounds.getStart())) { } else if (returnedValue < static_cast<int64_t>(spec.bounds.getStart())) {
if (spec.flags & kEnforceLowerBound) if (spec.flags & kEnforceLowerBound)
return spec.bounds.getStart(); return spec.bounds.getStart();
return {}; return absl::nullopt;
} }
return returnedValue; return returnedValue;
@ -273,13 +273,19 @@ absl::optional<bool> readBooleanFromOpcode(const Opcode& opcode)
// Cakewalk-style booleans, case-insensitive // Cakewalk-style booleans, case-insensitive
if (absl::EqualsIgnoreCase(opcode.value, "off")) if (absl::EqualsIgnoreCase(opcode.value, "off"))
return false; return false;
if (absl::EqualsIgnoreCase(opcode.value, "on")) if (absl::EqualsIgnoreCase(opcode.value, "on"))
return true; return true;
// ARIA-style booleans? (seen in egN_dynamic=1 for example) // ARIA-style booleans? (seen in egN_dynamic=1 for example)
// TODO check this // TODO check this
const OpcodeSpec<int64_t> fullInt64 { 0, Range<int64_t>::wholeRange(), 0 }; const OpcodeSpec<int64_t> fullInt64 { 0, Range<int64_t>::wholeRange(), 0 };
return opcode.read(fullInt64); const auto v = opcode.readOptional(fullInt64);
if (v)
return v != 0;
return absl::nullopt;
} }
template <> template <>

View file

@ -177,7 +177,7 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
ModKey::createNXYZ(ModId::OscillatorModDepth, id)); ModKey::createNXYZ(ModId::OscillatorModDepth, id));
break; break;
case hash("oscillator_quality"): case hash("oscillator_quality"):
oscillatorQuality = opcode.read(Default::oscillatorQuality); oscillatorQuality = opcode.readOptional(Default::oscillatorQuality);
break; break;
// Instrument settings: voice lifecycle // Instrument settings: voice lifecycle
@ -334,7 +334,7 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
sustainCC = opcode.read(Default::sustainCC); sustainCC = opcode.read(Default::sustainCC);
break; break;
case hash("sustain_lo"): case hash("sustain_lo"):
sustainThreshold = normalizeCC(opcode.read(Default::sustainThreshold)); sustainThreshold = opcode.read(Default::sustainThreshold);
break; break;
case hash("sustain_sw"): case hash("sustain_sw"):
checkSustain = opcode.read(Default::checkSustain); checkSustain = opcode.read(Default::checkSustain);
@ -460,10 +460,10 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
crossfadeKeyInRange.setStart(opcode.read(Default::loKey)); crossfadeKeyInRange.setStart(opcode.read(Default::loKey));
break; break;
case hash("xfin_hikey"): case hash("xfin_hikey"):
crossfadeKeyInRange.setEnd(opcode.read(Default::hiKey)); crossfadeKeyInRange.setEnd(opcode.read(Default::loKey)); // loKey for the proper default
break; break;
case hash("xfout_lokey"): case hash("xfout_lokey"):
crossfadeKeyOutRange.setStart(opcode.read(Default::loKey)); crossfadeKeyOutRange.setStart(opcode.read(Default::hiKey)); // hiKey for the proper default
break; break;
case hash("xfout_hikey"): case hash("xfout_hikey"):
crossfadeKeyOutRange.setEnd(opcode.read(Default::hiKey)); crossfadeKeyOutRange.setEnd(opcode.read(Default::hiKey));
@ -472,10 +472,10 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
crossfadeVelInRange.setStart(opcode.read(Default::loVel)); crossfadeVelInRange.setStart(opcode.read(Default::loVel));
break; break;
case hash("xfin_hivel"): case hash("xfin_hivel"):
crossfadeVelInRange.setEnd(opcode.read(Default::hiVel)); crossfadeVelInRange.setEnd(opcode.read(Default::loVel)); // loVel for the proper default
break; break;
case hash("xfout_lovel"): case hash("xfout_lovel"):
crossfadeVelOutRange.setStart(opcode.read(Default::loVel)); crossfadeVelOutRange.setStart(opcode.read(Default::hiVel)); // hiVel for the proper default
break; break;
case hash("xfout_hivel"): case hash("xfout_hivel"):
crossfadeVelOutRange.setEnd(opcode.read(Default::hiVel)); crossfadeVelOutRange.setEnd(opcode.read(Default::hiVel));
@ -497,21 +497,21 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode)
if (opcode.parameters.back() >= config::numCCs) if (opcode.parameters.back() >= config::numCCs)
return false; return false;
crossfadeCCInRange[opcode.parameters.back()].setEnd( crossfadeCCInRange[opcode.parameters.back()].setEnd(
opcode.read(Default::loCC) opcode.read(Default::loCC) // loCC for the proper default
); );
break; break;
case hash("xfout_locc&"): case hash("xfout_locc&"):
if (opcode.parameters.back() >= config::numCCs) if (opcode.parameters.back() >= config::numCCs)
return false; return false;
crossfadeCCOutRange[opcode.parameters.back()].setStart( crossfadeCCOutRange[opcode.parameters.back()].setStart(
opcode.read(Default::loCC) opcode.read(Default::hiCC) // hiCC for the proper default
); );
break; break;
case hash("xfout_hicc&"): case hash("xfout_hicc&"):
if (opcode.parameters.back() >= config::numCCs) if (opcode.parameters.back() >= config::numCCs)
return false; return false;
crossfadeCCOutRange[opcode.parameters.back()].setEnd( crossfadeCCOutRange[opcode.parameters.back()].setEnd(
opcode.read(Default::loCC) opcode.read(Default::hiCC)
); );
break; break;
case hash("xf_cccurve"): case hash("xf_cccurve"):

View file

@ -353,7 +353,8 @@ TEST_CASE("[Opcode] opcode read (uint8_t)")
{ {
Opcode opcode { "", "garbage10" }; Opcode opcode { "", "garbage10" };
OpcodeSpec<uint8_t> spec { 0, Range<uint8_t>(0, 100), 0 }; OpcodeSpec<uint8_t> spec { 0, Range<uint8_t>(0, 100), 0 };
REQUIRE( opcode.read(spec) == spec.defaultInputValue ); REQUIRE( !opcode.readOptional(spec) );
REQUIRE( opcode.read(spec) == 0 );
} }
SECTION("Can be note") SECTION("Can be note")
@ -411,15 +412,16 @@ TEST_CASE("[Opcode] opcode read (int)")
SECTION("Text after") SECTION("Text after")
{ {
Opcode opcode { "", "10garbage" }; Opcode opcode { "", "10garbage" };
OpcodeSpec<int> spec { 0, Range<int>(20, 100), 0 }; OpcodeSpec<int> spec { 0, Range<int>(0, 100), 0 };
REQUIRE( opcode.read(spec) == 20 ); REQUIRE( opcode.read(spec) == 10 );
} }
SECTION("Text before") SECTION("Text before")
{ {
Opcode opcode { "", "garbage10" }; Opcode opcode { "", "garbage10" };
OpcodeSpec<int> spec { 0, Range<int>(20, 100), 0 }; OpcodeSpec<int> spec { 0, Range<int>(20, 100), 0 };
REQUIRE( !opcode.read(spec) ); REQUIRE( !opcode.readOptional(spec) );
REQUIRE( opcode.read(spec) == 0 );
} }
SECTION("Can be note") SECTION("Can be note")
@ -486,7 +488,8 @@ TEST_CASE("[Opcode] opcode read (float)")
{ {
Opcode opcode { "", "garbage10" }; Opcode opcode { "", "garbage10" };
OpcodeSpec<float> spec { 0.0f, Range<float>(0.0f, 100.0f), 0 }; OpcodeSpec<float> spec { 0.0f, Range<float>(0.0f, 100.0f), 0 };
REQUIRE( !opcode.read(spec) ); REQUIRE( !opcode.readOptional(spec) );
REQUIRE( opcode.read(spec) == 0.0f );
} }
} }

View file

@ -481,8 +481,7 @@ TEST_CASE("[Values] Key range")
synth.dispatchMessage(client, 0, "/region4/key_range", "", nullptr); synth.dispatchMessage(client, 0, "/region4/key_range", "", nullptr);
synth.dispatchMessage(client, 0, "/region0/pitch_keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region0/pitch_keycenter", "", nullptr);
synth.dispatchMessage(client, 0, "/region5/pitch_keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region5/pitch_keycenter", "", nullptr);
// TODO: activate for the new region parser ; ignore the second value synth.dispatchMessage(client, 0, "/region6/pitch_keycenter", "", nullptr);
// synth.dispatchMessage(client, 0, "/region6/pitch_keycenter", "", nullptr);
synth.dispatchMessage(client, 0, "/region7/key_range", "", nullptr); synth.dispatchMessage(client, 0, "/region7/key_range", "", nullptr);
synth.dispatchMessage(client, 0, "/region7/pitch_keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region7/pitch_keycenter", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
@ -493,7 +492,7 @@ TEST_CASE("[Values] Key range")
"/region4/key_range,ii : { 0, 127 }", "/region4/key_range,ii : { 0, 127 }",
"/region0/pitch_keycenter,i : { 60 }", "/region0/pitch_keycenter,i : { 60 }",
"/region5/pitch_keycenter,i : { 32 }", "/region5/pitch_keycenter,i : { 32 }",
// "/region6/pitch_keycenter,i : { 60 }", "/region6/pitch_keycenter,i : { 60 }",
"/region7/key_range,ii : { 26, 26 }", "/region7/key_range,ii : { 26, 26 }",
"/region7/pitch_keycenter,i : { 26 }", "/region7/pitch_keycenter,i : { 26 }",
}; };
@ -1612,7 +1611,7 @@ TEST_CASE("[Values] Crossfade key range")
"/region1/xfin_key_range,ii : { 10, 40 }", "/region1/xfin_key_range,ii : { 10, 40 }",
"/region2/xfin_key_range,ii : { 60, 83 }", "/region2/xfin_key_range,ii : { 60, 83 }",
"/region3/xfin_key_range,ii : { 0, 40 }", "/region3/xfin_key_range,ii : { 0, 40 }",
"/region4/xfin_key_range,ii : { 10, 10 }", "/region4/xfin_key_range,ii : { 0, 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -1666,7 +1665,7 @@ TEST_CASE("[Values] Crossfade velocity range")
"/region0/xfin_vel_range,ff : { 0, 0 }", "/region0/xfin_vel_range,ff : { 0, 0 }",
"/region1/xfin_vel_range,ff : { 0.0787402, 0.314961 }", "/region1/xfin_vel_range,ff : { 0.0787402, 0.314961 }",
"/region2/xfin_vel_range,ff : { 0, 0.314961 }", "/region2/xfin_vel_range,ff : { 0, 0.314961 }",
"/region3/xfin_vel_range,ff : { 0.0787402, 1 }", "/region3/xfin_vel_range,ff : { 0, 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -1686,7 +1685,7 @@ TEST_CASE("[Values] Crossfade velocity range")
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/xfout_vel_range,ff : { 1, 1 }", "/region0/xfout_vel_range,ff : { 1, 1 }",
"/region1/xfout_vel_range,ff : { 0.0787402, 0.314961 }", "/region1/xfout_vel_range,ff : { 0.0787402, 0.314961 }",
"/region2/xfout_vel_range,ff : { 0, 0.314961 }", "/region2/xfout_vel_range,ff : { 0.314961, 0.314961 }",
"/region3/xfout_vel_range,ff : { 0.0787402, 1 }", "/region3/xfout_vel_range,ff : { 0.0787402, 1 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
@ -1787,7 +1786,7 @@ TEST_CASE("[Values] Crossfade CC range")
"/region0/xfin_cc_range4,N : { }", "/region0/xfin_cc_range4,N : { }",
"/region1/xfin_cc_range4,ff : { 0.0787402, 0.314961 }", "/region1/xfin_cc_range4,ff : { 0.0787402, 0.314961 }",
"/region2/xfin_cc_range4,ff : { 0, 0.314961 }", "/region2/xfin_cc_range4,ff : { 0, 0.314961 }",
"/region3/xfin_cc_range4,ff : { 0.0787402, 1 }", "/region3/xfin_cc_range4,ff : { 0, 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -1807,7 +1806,7 @@ TEST_CASE("[Values] Crossfade CC range")
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/xfout_cc_range4,N : { }", "/region0/xfout_cc_range4,N : { }",
"/region1/xfout_cc_range4,ff : { 0.0787402, 0.314961 }", "/region1/xfout_cc_range4,ff : { 0.0787402, 0.314961 }",
"/region2/xfout_cc_range4,ff : { 0, 0.314961 }", "/region2/xfout_cc_range4,ff : { 0.314961, 0.314961 }",
"/region3/xfout_cc_range4,ff : { 0.0787402, 1 }", "/region3/xfout_cc_range4,ff : { 0.0787402, 1 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
@ -1934,12 +1933,11 @@ TEST_CASE("[Values] Pitch Random")
)"); )");
synth.dispatchMessage(client, 0, "/region0/pitch_random", "", nullptr); synth.dispatchMessage(client, 0, "/region0/pitch_random", "", nullptr);
synth.dispatchMessage(client, 0, "/region1/pitch_random", "", nullptr); synth.dispatchMessage(client, 0, "/region1/pitch_random", "", nullptr);
// TODO: activate for the new region parser ; ignore oob synth.dispatchMessage(client, 0, "/region2/pitch_random", "", nullptr);
// synth.dispatchMessage(client, 0, "/region2/pitch_random", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/pitch_random,f : { 0 }", "/region0/pitch_random,f : { 0 }",
"/region1/pitch_random,f : { 10 }", "/region1/pitch_random,f : { 10 }",
// "/region2/pitch_random,f : { 0 }", "/region2/pitch_random,f : { 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -1961,15 +1959,14 @@ TEST_CASE("[Values] Transpose")
synth.dispatchMessage(client, 0, "/region0/transpose", "", nullptr); synth.dispatchMessage(client, 0, "/region0/transpose", "", nullptr);
synth.dispatchMessage(client, 0, "/region1/transpose", "", nullptr); synth.dispatchMessage(client, 0, "/region1/transpose", "", nullptr);
synth.dispatchMessage(client, 0, "/region2/transpose", "", nullptr); synth.dispatchMessage(client, 0, "/region2/transpose", "", nullptr);
// TODO: activate for the new region parser ; ignore oob synth.dispatchMessage(client, 0, "/region3/transpose", "", nullptr);
// synth.dispatchMessage(client, 0, "/region3/transpose", "", nullptr); synth.dispatchMessage(client, 0, "/region4/transpose", "", nullptr);
// synth.dispatchMessage(client, 0, "/region4/transpose", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/transpose,i : { 0 }", "/region0/transpose,i : { 0 }",
"/region1/transpose,i : { 10 }", "/region1/transpose,i : { 10 }",
"/region2/transpose,i : { -4 }", "/region2/transpose,i : { -4 }",
// "/region3/transpose,i : { 0 }", "/region3/transpose,i : { 0 }",
// "/region4/transpose,i : { 0 }", "/region4/transpose,i : { 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2320,7 +2317,7 @@ TEST_CASE("[Values] RT dead")
"/region0/rt_dead,F : { }", "/region0/rt_dead,F : { }",
"/region1/rt_dead,T : { }", "/region1/rt_dead,T : { }",
"/region2/rt_dead,F : { }", "/region2/rt_dead,F : { }",
"/region3/rt_dead,T : { }", "/region3/rt_dead,F : { }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2346,7 +2343,7 @@ TEST_CASE("[Values] Sustain switch")
"/region0/sustain_sw,T : { }", "/region0/sustain_sw,T : { }",
"/region1/sustain_sw,F : { }", "/region1/sustain_sw,F : { }",
"/region2/sustain_sw,T : { }", "/region2/sustain_sw,T : { }",
"/region3/sustain_sw,F : { }", "/region3/sustain_sw,T : { }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2372,7 +2369,7 @@ TEST_CASE("[Values] Sostenuto switch")
"/region0/sostenuto_sw,T : { }", "/region0/sostenuto_sw,T : { }",
"/region1/sostenuto_sw,F : { }", "/region1/sostenuto_sw,F : { }",
"/region2/sostenuto_sw,T : { }", "/region2/sostenuto_sw,T : { }",
"/region3/sostenuto_sw,F : { }", "/region3/sostenuto_sw,T : { }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2391,12 +2388,11 @@ TEST_CASE("[Values] Sustain CC")
)"); )");
synth.dispatchMessage(client, 0, "/region0/sustain_cc", "", nullptr); synth.dispatchMessage(client, 0, "/region0/sustain_cc", "", nullptr);
synth.dispatchMessage(client, 0, "/region1/sustain_cc", "", nullptr); synth.dispatchMessage(client, 0, "/region1/sustain_cc", "", nullptr);
// TODO: activate for the new region parser ; ignore oob synth.dispatchMessage(client, 0, "/region2/sustain_cc", "", nullptr);
// synth.dispatchMessage(client, 0, "/region2/sustain_cc", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/sustain_cc,i : { 64 }", "/region0/sustain_cc,i : { 64 }",
"/region1/sustain_cc,i : { 10 }", "/region1/sustain_cc,i : { 10 }",
// "/region2/sustain_cc,i : { 20 }", "/region2/sustain_cc,i : { 64 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2415,12 +2411,11 @@ TEST_CASE("[Values] Sustain low")
)"); )");
synth.dispatchMessage(client, 0, "/region0/sustain_lo", "", nullptr); synth.dispatchMessage(client, 0, "/region0/sustain_lo", "", nullptr);
synth.dispatchMessage(client, 0, "/region1/sustain_lo", "", nullptr); synth.dispatchMessage(client, 0, "/region1/sustain_lo", "", nullptr);
// TODO: activate for the new region parser ; ignore oob synth.dispatchMessage(client, 0, "/region2/sustain_lo", "", nullptr);
// synth.dispatchMessage(client, 0, "/region2/sustain_lo", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/sustain_lo,f : { 0.0039 }", "/region0/sustain_lo,f : { 0.00787402 }",
"/region1/sustain_lo,f : { 0.0787402 }", "/region1/sustain_lo,f : { 0.0787402 }",
// "/region2/sustain_lo,f : { 0.0787402 }", "/region2/sustain_lo,f : { 0.00787402 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2469,7 +2464,7 @@ TEST_CASE("[Values] Oscillator quality")
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/oscillator_quality,N : { }", "/region0/oscillator_quality,N : { }",
"/region1/oscillator_quality,i : { 2 }", "/region1/oscillator_quality,i : { 2 }",
"/region2/oscillator_quality,i : { 0 }", "/region2/oscillator_quality,N : { }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2497,7 +2492,7 @@ TEST_CASE("[Values] Oscillator mode/multi")
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/oscillator_mode,i : { 0 }", "/region0/oscillator_mode,i : { 0 }",
"/region1/oscillator_mode,i : { 2 }", "/region1/oscillator_mode,i : { 2 }",
"/region2/oscillator_mode,i : { 1 }", "/region2/oscillator_mode,i : { 0 }",
"/region0/oscillator_multi,i : { 1 }", "/region0/oscillator_multi,i : { 1 }",
"/region3/oscillator_multi,i : { 9 }", "/region3/oscillator_multi,i : { 9 }",
"/region4/oscillator_multi,i : { 1 }", "/region4/oscillator_multi,i : { 1 }",
@ -2553,14 +2548,13 @@ TEST_CASE("[Values] Effect sends")
synth.dispatchMessage(client, 0, "/region1/effect1", "", nullptr); synth.dispatchMessage(client, 0, "/region1/effect1", "", nullptr);
synth.dispatchMessage(client, 0, "/region2/effect1", "", nullptr); synth.dispatchMessage(client, 0, "/region2/effect1", "", nullptr);
synth.dispatchMessage(client, 0, "/region2/effect2", "", nullptr); synth.dispatchMessage(client, 0, "/region2/effect2", "", nullptr);
// TODO: activate for the new region parser ; ignore oob synth.dispatchMessage(client, 0, "/region4/effect1", "", nullptr);
// synth.dispatchMessage(client, 0, "/region4/effect1", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
// No reply to the first question // No reply to the first question
"/region1/effect1,f : { 10 }", "/region1/effect1,f : { 10 }",
"/region2/effect1,f : { 0 }", "/region2/effect1,f : { 0 }",
"/region2/effect2,f : { 50.4 }", "/region2/effect2,f : { 50.4 }",
// "/region4/effect1,f : { 100 }", // No reply to the last question
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2578,8 +2572,6 @@ TEST_CASE("[Values] Support floating point for int values")
)"); )");
synth.dispatchMessage(client, 0, "/region0/offset", "", nullptr); synth.dispatchMessage(client, 0, "/region0/offset", "", nullptr);
synth.dispatchMessage(client, 0, "/region1/pitch_keytrack", "", nullptr); synth.dispatchMessage(client, 0, "/region1/pitch_keytrack", "", nullptr);
// TODO: activate for the new region parser ; ignore oob
// synth.dispatchMessage(client, 0, "/region4/effect1", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/offset,h : { 1042 }", "/region0/offset,h : { 1042 }",
"/region1/pitch_keytrack,i : { -2 }", "/region1/pitch_keytrack,i : { -2 }",
@ -2899,15 +2891,14 @@ TEST_CASE("[Values] Filter value bounds")
SECTION("Cutoff") SECTION("Cutoff")
{ {
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
<region> sample=kick.wav cutoff=20000000 // Bound this to 20k <region> sample=kick.wav cutoff=20000000 // Ignore the value
<region> sample=kick.wav cutoff=50 cutoff=-100 <region> sample=kick.wav cutoff=50 cutoff=-100
)"); )");
synth.dispatchMessage(client, 0, "/region0/filter0/cutoff", "", nullptr); synth.dispatchMessage(client, 0, "/region0/filter0/cutoff", "", nullptr);
// TODO: activate after new parser; ignore OOB synth.dispatchMessage(client, 0, "/region1/filter0/cutoff", "", nullptr);
// synth.dispatchMessage(client, 0, "/region0/filter0/cutoff", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/filter0/cutoff,f : { 20000 }", "/region0/filter0/cutoff,f : { 0 }",
// "/region0/filter0/cutoff,f : { 50 }", "/region1/filter0/cutoff,f : { 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2917,10 +2908,9 @@ TEST_CASE("[Values] Filter value bounds")
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
<region> sample=kick.wav resonance=5 resonance=-5 <region> sample=kick.wav resonance=5 resonance=-5
)"); )");
// TODO: activate after new parser; ignore OOB synth.dispatchMessage(client, 0, "/region0/filter0/resonance", "", nullptr);
// synth.dispatchMessage(client, 0, "/region0/filter0/resonance", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
// "/region0/filter0/resonance,f : { 5 }", "/region0/filter0/resonance,f : { 0 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -2928,19 +2918,17 @@ TEST_CASE("[Values] Filter value bounds")
SECTION("Keycenter") SECTION("Keycenter")
{ {
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
<region> sample=kick.wav keycenter=40 keycenter=-5 <region> sample=kick.wav fil_keycenter=40
<region> sample=kick.wav keycenter=40 keycenter=1000 <region> sample=kick.wav fil_keycenter=40 fil_keycenter=1000
<region> sample=kick.wav keycenter=c3 <region> sample=kick.wav fil_keycenter=c3
)"); )");
// TODO: activate after new parser; ignore OOB synth.dispatchMessage(client, 0, "/region0/filter0/keycenter", "", nullptr);
// synth.dispatchMessage(client, 0, "/region0/filter0/keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region1/filter0/keycenter", "", nullptr);
// synth.dispatchMessage(client, 0, "/region1/filter0/keycenter", "", nullptr); synth.dispatchMessage(client, 0, "/region2/filter0/keycenter", "", nullptr);
// TODO: activate after new parser; parse note
// synth.dispatchMessage(client, 0, "/region2/filter0/keycenter", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
// "/region0/filter0/keycenter,i : { 40 }", "/region0/filter0/keycenter,i : { 40 }",
// "/region1/filter0/keycenter,i : { 40 }", "/region1/filter0/keycenter,i : { 60 }",
// "/region2/filter0/keycenter,i : { 48 }", "/region2/filter0/keycenter,i : { 48 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -3109,15 +3097,14 @@ TEST_CASE("[Values] EQ value bounds")
SECTION("Frequency") SECTION("Frequency")
{ {
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
<region> sample=kick.wav eq1_freq=20000000 // Bound this to 30k <region> sample=kick.wav eq1_freq=20000000 // Ignore
<region> sample=kick.wav eq1_freq=50 eq1_freq=-100 <region> sample=kick.wav eq1_freq=50 eq1_freq=-100
)"); )");
synth.dispatchMessage(client, 0, "/region0/eq0/frequency", "", nullptr); synth.dispatchMessage(client, 0, "/region0/eq0/frequency", "", nullptr);
// TODO: activate after new parser; ignore OOB synth.dispatchMessage(client, 0, "/region1/eq0/frequency", "", nullptr);
// synth.dispatchMessage(client, 0, "/region0/eq0/frequency", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
"/region0/eq0/frequency,f : { 30000 }", "/region0/eq0/frequency,f : { 50 }",
// "/region0/eq0/frequency,f : { 50 }", "/region1/eq0/frequency,f : { 50 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }
@ -3127,10 +3114,9 @@ TEST_CASE("[Values] EQ value bounds")
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"( synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
<region> sample=kick.wav eq1_bw=5 eq1_bw=-5 <region> sample=kick.wav eq1_bw=5 eq1_bw=-5
)"); )");
// TODO: activate after new parser; ignore OOB synth.dispatchMessage(client, 0, "/region0/eq0/bandwidth", "", nullptr);
// synth.dispatchMessage(client, 0, "/region0/eq0/bandwidth", "", nullptr);
std::vector<std::string> expected { std::vector<std::string> expected {
// "/region0/eq0/bandwidth,f : { 5 }", "/region0/eq0/bandwidth,f : { 1 }",
}; };
REQUIRE(messageList == expected); REQUIRE(messageList == expected);
} }