Add parsing tests
This commit is contained in:
parent
4b45dcc70c
commit
49699de043
2 changed files with 377 additions and 43 deletions
|
|
@ -1224,84 +1224,98 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
|
|||
|
||||
MATCH("/region&/pitcheg_attack_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccAttack.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_decay_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccDecay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_delay_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccDelay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_hold_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccHold.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_release_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccRelease.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_start_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccStart.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier * 100.0f);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_sustain_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccSustain.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier * 100.0f);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_attack_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccAttack.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_decay_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccDecay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_delay_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccDelay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_hold_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccHold.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_release_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccRelease.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_start_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccStart.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/pitcheg_sustain_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
if (!region.pitchEG) break;
|
||||
const auto& cc = region.pitchEG->ccSustain.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
|
@ -1621,101 +1635,101 @@ void sfz::Synth::dispatchMessage(Client& client, int delay, const char* path, co
|
|||
}
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_attack_cc&", "") {
|
||||
MATCH("/region&/fileg_attack_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccAttack.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccAttack.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_decay_cc&", "") {
|
||||
MATCH("/region&/fileg_decay_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccDecay.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccDecay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_delay_cc&", "") {
|
||||
MATCH("/region&/fileg_delay_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccDelay.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccDelay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_hold_cc&", "") {
|
||||
MATCH("/region&/fileg_hold_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccHold.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccHold.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_release_cc&", "") {
|
||||
MATCH("/region&/fileg_release_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccRelease.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccRelease.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_start_cc&", "") {
|
||||
MATCH("/region&/fileg_start_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccStart.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccStart.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier * 100.0f);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_sustain_cc&", "") {
|
||||
MATCH("/region&/fileg_sustain_cc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccSustain.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccSustain.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.modifier * 100.0f);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_attack_curvecc&", "") {
|
||||
MATCH("/region&/fileg_attack_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccAttack.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccAttack.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_decay_curvecc&", "") {
|
||||
MATCH("/region&/fileg_decay_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccDecay.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccDecay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_delay_curvecc&", "") {
|
||||
MATCH("/region&/fileg_delay_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccDelay.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccDelay.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_hold_curvecc&", "") {
|
||||
MATCH("/region&/fileg_hold_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccHold.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccHold.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_release_curvecc&", "") {
|
||||
MATCH("/region&/fileg_release_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccRelease.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccRelease.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_start_curvecc&", "") {
|
||||
MATCH("/region&/fileg_start_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccStart.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccStart.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
MATCH("/region&/filter&/fileg_sustain_curvecc&", "") {
|
||||
MATCH("/region&/fileg_sustain_curvecc&", "") {
|
||||
GET_REGION_OR_BREAK(indices[0])
|
||||
GET_FILTER_OR_BREAK(indices[1])
|
||||
const auto& cc = region.filterEG->ccSustain.getWithDefault(indices[2]);
|
||||
if (!region.filterEG) break;
|
||||
const auto& cc = region.filterEG->ccSustain.getWithDefault(indices[1]);
|
||||
client.receive<'f'>(delay, path, cc.curve);
|
||||
} break;
|
||||
|
||||
|
|
|
|||
|
|
@ -2954,7 +2954,7 @@ TEST_CASE("[Values] ampeg CC")
|
|||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Basic")
|
||||
SECTION("Negative values")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
|
|
@ -2982,6 +2982,326 @@ TEST_CASE("[Values] ampeg CC")
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE("[Values] fileg CC")
|
||||
{
|
||||
Synth synth;
|
||||
std::vector<std::string> messageList;
|
||||
Client client(&messageList);
|
||||
client.setReceiveCallback(&simpleMessageReceiver);
|
||||
|
||||
SECTION("Basic")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_attack_cc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_delay_cc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_decay_cc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_hold_cc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_release_cc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_start_cc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_sustain_cc7", "", nullptr);
|
||||
std::vector<std::string> expected { };
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Positive values")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
fileg_attack_oncc1=1 fileg_delay_oncc2=2 fileg_decay_oncc3=3
|
||||
fileg_hold_oncc4=4 fileg_release_oncc5=5 fileg_start_oncc6=6
|
||||
fileg_sustain_oncc7=7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_attack_cc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_delay_cc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_decay_cc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_hold_cc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_release_cc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_start_cc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_sustain_cc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/fileg_attack_cc1,f : { 1 }",
|
||||
"/region0/fileg_delay_cc2,f : { 2 }",
|
||||
"/region0/fileg_decay_cc3,f : { 3 }",
|
||||
"/region0/fileg_hold_cc4,f : { 4 }",
|
||||
"/region0/fileg_release_cc5,f : { 5 }",
|
||||
"/region0/fileg_start_cc6,f : { 6 }",
|
||||
"/region0/fileg_sustain_cc7,f : { 7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Negative values")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
fileg_attack_cc1=-1 fileg_delay_cc2=-2 fileg_decay_cc3=-3
|
||||
fileg_hold_cc4=-4 fileg_release_cc5=-5 fileg_start_cc6=-6
|
||||
fileg_sustain_cc7=-7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_attack_cc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_delay_cc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_decay_cc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_hold_cc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_release_cc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_start_cc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_sustain_cc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/fileg_attack_cc1,f : { -1 }",
|
||||
"/region0/fileg_delay_cc2,f : { -2 }",
|
||||
"/region0/fileg_decay_cc3,f : { -3 }",
|
||||
"/region0/fileg_hold_cc4,f : { -4 }",
|
||||
"/region0/fileg_release_cc5,f : { -5 }",
|
||||
"/region0/fileg_start_cc6,f : { -6 }",
|
||||
"/region0/fileg_sustain_cc7,f : { -7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("[Values] pitcheg CC")
|
||||
{
|
||||
Synth synth;
|
||||
std::vector<std::string> messageList;
|
||||
Client client(&messageList);
|
||||
client.setReceiveCallback(&simpleMessageReceiver);
|
||||
|
||||
SECTION("Basic")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_attack_cc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_delay_cc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_decay_cc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_hold_cc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_release_cc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_start_cc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_sustain_cc7", "", nullptr);
|
||||
std::vector<std::string> expected { };
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Positive values")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
pitcheg_attack_oncc1=1 pitcheg_delay_oncc2=2 pitcheg_decay_oncc3=3
|
||||
pitcheg_hold_oncc4=4 pitcheg_release_oncc5=5 pitcheg_start_oncc6=6
|
||||
pitcheg_sustain_oncc7=7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_attack_cc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_delay_cc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_decay_cc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_hold_cc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_release_cc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_start_cc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_sustain_cc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/pitcheg_attack_cc1,f : { 1 }",
|
||||
"/region0/pitcheg_delay_cc2,f : { 2 }",
|
||||
"/region0/pitcheg_decay_cc3,f : { 3 }",
|
||||
"/region0/pitcheg_hold_cc4,f : { 4 }",
|
||||
"/region0/pitcheg_release_cc5,f : { 5 }",
|
||||
"/region0/pitcheg_start_cc6,f : { 6 }",
|
||||
"/region0/pitcheg_sustain_cc7,f : { 7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Negative values")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
pitcheg_attack_cc1=-1 pitcheg_delay_cc2=-2 pitcheg_decay_cc3=-3
|
||||
pitcheg_hold_cc4=-4 pitcheg_release_cc5=-5 pitcheg_start_cc6=-6
|
||||
pitcheg_sustain_cc7=-7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_attack_cc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_delay_cc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_decay_cc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_hold_cc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_release_cc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_start_cc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_sustain_cc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/pitcheg_attack_cc1,f : { -1 }",
|
||||
"/region0/pitcheg_delay_cc2,f : { -2 }",
|
||||
"/region0/pitcheg_decay_cc3,f : { -3 }",
|
||||
"/region0/pitcheg_hold_cc4,f : { -4 }",
|
||||
"/region0/pitcheg_release_cc5,f : { -5 }",
|
||||
"/region0/pitcheg_start_cc6,f : { -6 }",
|
||||
"/region0/pitcheg_sustain_cc7,f : { -7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("[Values] ampeg curve CC")
|
||||
{
|
||||
Synth synth;
|
||||
std::vector<std::string> messageList;
|
||||
Client client(&messageList);
|
||||
client.setReceiveCallback(&simpleMessageReceiver);
|
||||
|
||||
SECTION("Basic")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_attack_curvecc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_delay_curvecc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_decay_curvecc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_hold_curvecc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_release_curvecc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_start_curvecc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_sustain_curvecc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/ampeg_attack_curvecc1,f : { 0 }",
|
||||
"/region0/ampeg_delay_curvecc2,f : { 0 }",
|
||||
"/region0/ampeg_decay_curvecc3,f : { 0 }",
|
||||
"/region0/ampeg_hold_curvecc4,f : { 0 }",
|
||||
"/region0/ampeg_release_curvecc5,f : { 0 }",
|
||||
"/region0/ampeg_start_curvecc6,f : { 0 }",
|
||||
"/region0/ampeg_sustain_curvecc7,f : { 0 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Change curves")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
ampeg_attack_curvecc1=1 ampeg_delay_curvecc2=2 ampeg_decay_curvecc3=3
|
||||
ampeg_hold_curvecc4=4 ampeg_release_curvecc5=5 ampeg_start_curvecc6=6
|
||||
ampeg_sustain_curvecc7=7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_attack_curvecc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_delay_curvecc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_decay_curvecc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_hold_curvecc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_release_curvecc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_start_curvecc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/ampeg_sustain_curvecc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/ampeg_attack_curvecc1,f : { 1 }",
|
||||
"/region0/ampeg_delay_curvecc2,f : { 2 }",
|
||||
"/region0/ampeg_decay_curvecc3,f : { 3 }",
|
||||
"/region0/ampeg_hold_curvecc4,f : { 4 }",
|
||||
"/region0/ampeg_release_curvecc5,f : { 5 }",
|
||||
"/region0/ampeg_start_curvecc6,f : { 6 }",
|
||||
"/region0/ampeg_sustain_curvecc7,f : { 7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("[Values] fileg curve CC")
|
||||
{
|
||||
Synth synth;
|
||||
std::vector<std::string> messageList;
|
||||
Client client(&messageList);
|
||||
client.setReceiveCallback(&simpleMessageReceiver);
|
||||
|
||||
SECTION("Basic")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_attack_curvecc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_delay_curvecc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_decay_curvecc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_hold_curvecc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_release_curvecc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_start_curvecc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_sustain_curvecc7", "", nullptr);
|
||||
std::vector<std::string> expected { };
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Change curves")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
fileg_attack_curvecc1=1 fileg_delay_curvecc2=2 fileg_decay_curvecc3=3
|
||||
fileg_hold_curvecc4=4 fileg_release_curvecc5=5 fileg_start_curvecc6=6
|
||||
fileg_sustain_curvecc7=7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_attack_curvecc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_delay_curvecc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_decay_curvecc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_hold_curvecc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_release_curvecc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_start_curvecc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/fileg_sustain_curvecc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/fileg_attack_curvecc1,f : { 1 }",
|
||||
"/region0/fileg_delay_curvecc2,f : { 2 }",
|
||||
"/region0/fileg_decay_curvecc3,f : { 3 }",
|
||||
"/region0/fileg_hold_curvecc4,f : { 4 }",
|
||||
"/region0/fileg_release_curvecc5,f : { 5 }",
|
||||
"/region0/fileg_start_curvecc6,f : { 6 }",
|
||||
"/region0/fileg_sustain_curvecc7,f : { 7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("[Values] pitcheg curve CC")
|
||||
{
|
||||
Synth synth;
|
||||
std::vector<std::string> messageList;
|
||||
Client client(&messageList);
|
||||
client.setReceiveCallback(&simpleMessageReceiver);
|
||||
|
||||
SECTION("Basic")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_attack_curvecc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_delay_curvecc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_decay_curvecc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_hold_curvecc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_release_curvecc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_start_curvecc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_sustain_curvecc7", "", nullptr);
|
||||
std::vector<std::string> expected { };
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
SECTION("Change curves")
|
||||
{
|
||||
synth.loadSfzString(fs::current_path() / "tests/TestFiles/value_tests.sfz", R"(
|
||||
<region> sample=kick.wav
|
||||
pitcheg_attack_curvecc1=1 pitcheg_delay_curvecc2=2 pitcheg_decay_curvecc3=3
|
||||
pitcheg_hold_curvecc4=4 pitcheg_release_curvecc5=5 pitcheg_start_curvecc6=6
|
||||
pitcheg_sustain_curvecc7=7
|
||||
)");
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_attack_curvecc1", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_delay_curvecc2", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_decay_curvecc3", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_hold_curvecc4", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_release_curvecc5", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_start_curvecc6", "", nullptr);
|
||||
synth.dispatchMessage(client, 0, "/region0/pitcheg_sustain_curvecc7", "", nullptr);
|
||||
std::vector<std::string> expected {
|
||||
"/region0/pitcheg_attack_curvecc1,f : { 1 }",
|
||||
"/region0/pitcheg_delay_curvecc2,f : { 2 }",
|
||||
"/region0/pitcheg_decay_curvecc3,f : { 3 }",
|
||||
"/region0/pitcheg_hold_curvecc4,f : { 4 }",
|
||||
"/region0/pitcheg_release_curvecc5,f : { 5 }",
|
||||
"/region0/pitcheg_start_curvecc6,f : { 6 }",
|
||||
"/region0/pitcheg_sustain_curvecc7,f : { 7 }",
|
||||
};
|
||||
REQUIRE(messageList == expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("[Values] Filter stacking and cutoffs")
|
||||
{
|
||||
Synth synth;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue