From 5fd5a5a8085269a885256488d97252564dde1fca Mon Sep 17 00:00:00 2001 From: Paul Fd Date: Thu, 20 May 2021 16:26:15 +0200 Subject: [PATCH] Fill gaps on opcodes related to vel and AT triggers --- src/sfizz/Defaults.cpp | 16 ++++++++-------- src/sfizz/Defaults.h | 8 ++++---- src/sfizz/Region.cpp | 16 ++++++++-------- tests/RegionValuesT.cpp | 32 ++++++++++++++++---------------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/sfizz/Defaults.cpp b/src/sfizz/Defaults.cpp index dece22d5..5908a340 100644 --- a/src/sfizz/Defaults.cpp +++ b/src/sfizz/Defaults.cpp @@ -50,18 +50,18 @@ UInt8Spec loKey { 0, {0, 127}, kCanBeNote }; UInt8Spec hiKey { 127, {0, 127}, kCanBeNote }; FloatSpec loCC { 0, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; FloatSpec hiCC { 127, {0.0f, 127.0f}, kNormalizeMidi|kFillGap|kPermissiveBounds }; -FloatSpec xfoutLoCC { 127.0f, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; -FloatSpec xfoutHiCC { 127.0f, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; -FloatSpec xfinLoCC { 0.0f, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; -FloatSpec xfinHiCC { 0.0f, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; +FloatSpec xfoutLo { 127.0f, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; +FloatSpec xfoutHi { 127.0f, {0.0f, 127.0f}, kNormalizeMidi|kFillGap|kPermissiveBounds }; +FloatSpec xfinLo { 0.0f, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; +FloatSpec xfinHi { 0.0f, {0.0f, 127.0f}, kNormalizeMidi|kFillGap|kPermissiveBounds }; FloatSpec loVel { 0, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; -FloatSpec hiVel { 127, {0.0f, 127.0f}, kNormalizeMidi|kPermissiveBounds }; +FloatSpec hiVel { 127, {0.0f, 127.0f}, kNormalizeMidi|kFillGap|kPermissiveBounds }; FloatSpec loChannelAftertouch { 0, {0, 127}, kNormalizeMidi|kPermissiveBounds }; -FloatSpec hiChannelAftertouch { 127, {0, 127}, kNormalizeMidi|kPermissiveBounds }; +FloatSpec hiChannelAftertouch { 127, {0, 127}, kNormalizeMidi|kFillGap|kPermissiveBounds }; FloatSpec loPolyAftertouch { 0, {0, 127}, kNormalizeMidi|kPermissiveBounds }; -FloatSpec hiPolyAftertouch { 127, {0, 127}, kNormalizeMidi|kPermissiveBounds }; +FloatSpec hiPolyAftertouch { 127, {0, 127}, kNormalizeMidi|kFillGap|kPermissiveBounds }; FloatSpec loBend { -8191, {-8192.0f, 8191.0f}, kNormalizeBend|kPermissiveBounds }; -FloatSpec hiBend { 8191, {-8192.0f, 8191.0f}, kNormalizeBend|kPermissiveBounds }; +FloatSpec hiBend { 8191, {-8192.0f, 8191.0f}, kNormalizeBend|kFillGap|kPermissiveBounds }; FloatSpec loNormalized { 0.0f, {0.0f, 1.0f}, kPermissiveBounds }; FloatSpec hiNormalized { 1.0f, {0.0f, 1.0f}, kPermissiveBounds }; FloatSpec loBipolar { -1.0f, {-1.0f, 1.0f}, kPermissiveBounds }; diff --git a/src/sfizz/Defaults.h b/src/sfizz/Defaults.h index 7b7183ce..71e3b029 100644 --- a/src/sfizz/Defaults.h +++ b/src/sfizz/Defaults.h @@ -164,10 +164,10 @@ namespace Default extern const OpcodeSpec hiVel; extern const OpcodeSpec loCC; extern const OpcodeSpec hiCC; - extern const OpcodeSpec xfoutLoCC; - extern const OpcodeSpec xfoutHiCC; - extern const OpcodeSpec xfinHiCC; - extern const OpcodeSpec xfinLoCC; + extern const OpcodeSpec xfoutLo; + extern const OpcodeSpec xfoutHi; + extern const OpcodeSpec xfinHi; + extern const OpcodeSpec xfinLo; extern const OpcodeSpec loBend; extern const OpcodeSpec hiBend; extern const OpcodeSpec loNormalized; diff --git a/src/sfizz/Region.cpp b/src/sfizz/Region.cpp index 481cf0c8..dc069413 100644 --- a/src/sfizz/Region.cpp +++ b/src/sfizz/Region.cpp @@ -474,16 +474,16 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode, bool cleanOpcode) crossfadeKeyOutRange.setEnd(opcode.read(Default::hiKey)); break; case hash("xfin_lovel"): - crossfadeVelInRange.setStart(opcode.read(Default::loVel)); + crossfadeVelInRange.setStart(opcode.read(Default::xfinLo)); break; case hash("xfin_hivel"): - crossfadeVelInRange.setEnd(opcode.read(Default::loVel)); // loVel for the proper default + crossfadeVelInRange.setEnd(opcode.read(Default::xfinHi)); break; case hash("xfout_lovel"): - crossfadeVelOutRange.setStart(opcode.read(Default::hiVel)); // hiVel for the proper default + crossfadeVelOutRange.setStart(opcode.read(Default::xfoutLo)); break; case hash("xfout_hivel"): - crossfadeVelOutRange.setEnd(opcode.read(Default::hiVel)); + crossfadeVelOutRange.setEnd(opcode.read(Default::xfoutHi)); break; case hash("xf_keycurve"): crossfadeKeyCurve = opcode.read(Default::crossfadeCurve); @@ -495,28 +495,28 @@ bool sfz::Region::parseOpcode(const Opcode& rawOpcode, bool cleanOpcode) if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCInRange[opcode.parameters.back()].setStart( - opcode.read(Default::xfinLoCC) + opcode.read(Default::xfinLo) ); break; case hash("xfin_hicc&"): if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCInRange[opcode.parameters.back()].setEnd( - opcode.read(Default::xfinHiCC) + opcode.read(Default::xfinHi) ); break; case hash("xfout_locc&"): if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCOutRange[opcode.parameters.back()].setStart( - opcode.read(Default::xfoutLoCC) + opcode.read(Default::xfoutLo) ); break; case hash("xfout_hicc&"): if (opcode.parameters.back() >= config::numCCs) return false; crossfadeCCOutRange[opcode.parameters.back()].setEnd( - opcode.read(Default::xfoutHiCC) + opcode.read(Default::xfoutHi) ); break; case hash("xf_cccurve"): diff --git a/tests/RegionValuesT.cpp b/tests/RegionValuesT.cpp index d9402d9d..a6fc4dd7 100644 --- a/tests/RegionValuesT.cpp +++ b/tests/RegionValuesT.cpp @@ -599,8 +599,8 @@ TEST_CASE("[Values] Velocity range") synth.dispatchMessage(client, 0, "/region3/vel_range", "", nullptr); std::vector expected { "/region0/vel_range,ff : { 0, 1 }", - "/region1/vel_range,ff : { 0.267717, 0.472441 }", - "/region2/vel_range,ff : { -0.023622, 0.472441 }", + "/region1/vel_range,ff : { 0.267717, 0.480315 }", + "/region2/vel_range,ff : { -0.023622, 0.480315 }", "/region3/vel_range,ff : { 0, -0.00787402 }", }; REQUIRE(messageList == expected); @@ -914,10 +914,10 @@ TEST_CASE("[Values] Aftertouch range") synth.dispatchMessage(client, 0, "/region4/chanaft_range", "", nullptr); std::vector expected { "/region0/chanaft_range,ff : { 0, 1 }", - "/region1/chanaft_range,ff : { 0.267717, 0.472441 }", - "/region2/chanaft_range,ff : { -0.023622, 0.472441 }", + "/region1/chanaft_range,ff : { 0.267717, 0.480315 }", + "/region2/chanaft_range,ff : { -0.023622, 0.480315 }", "/region3/chanaft_range,ff : { 0.15748, -0.00787402 }", - "/region4/chanaft_range,ff : { 0.15748, 0.0787402 }", + "/region4/chanaft_range,ff : { 0.15748, 0.0866142 }", }; REQUIRE(messageList == expected); } @@ -942,10 +942,10 @@ TEST_CASE("[Values] Polyaftertouch range") synth.dispatchMessage(client, 0, "/region4/polyaft_range", "", nullptr); std::vector expected { "/region0/polyaft_range,ff : { 0, 1 }", - "/region1/polyaft_range,ff : { 0.267717, 0.472441 }", - "/region2/polyaft_range,ff : { -0.023622, 0.472441 }", + "/region1/polyaft_range,ff : { 0.267717, 0.480315 }", + "/region2/polyaft_range,ff : { -0.023622, 0.480315 }", "/region3/polyaft_range,ff : { 0.15748, -0.00787402 }", - "/region4/polyaft_range,ff : { 0.15748, 0.0787402 }", + "/region4/polyaft_range,ff : { 0.15748, 0.0866142 }", }; REQUIRE(messageList == expected); } @@ -1747,8 +1747,8 @@ TEST_CASE("[Values] Crossfade velocity range") synth.dispatchMessage(client, 0, "/region3/xfin_vel_range", "", nullptr); std::vector expected { "/region0/xfin_vel_range,ff : { 0, 0 }", - "/region1/xfin_vel_range,ff : { 0.0787402, 0.314961 }", - "/region2/xfin_vel_range,ff : { -0.0787402, 0.314961 }", + "/region1/xfin_vel_range,ff : { 0.0787402, 0.322835 }", + "/region2/xfin_vel_range,ff : { -0.0787402, 0.322835 }", "/region3/xfin_vel_range,ff : { 0.0787402, 1.10236 }", }; REQUIRE(messageList == expected); @@ -1768,8 +1768,8 @@ TEST_CASE("[Values] Crossfade velocity range") synth.dispatchMessage(client, 0, "/region3/xfout_vel_range", "", nullptr); std::vector expected { "/region0/xfout_vel_range,ff : { 1, 1 }", - "/region1/xfout_vel_range,ff : { 0.0787402, 0.314961 }", - "/region2/xfout_vel_range,ff : { -0.0787402, 0.314961 }", + "/region1/xfout_vel_range,ff : { 0.0787402, 0.322835 }", + "/region2/xfout_vel_range,ff : { -0.0787402, 0.322835 }", "/region3/xfout_vel_range,ff : { 0.0787402, 1.10236 }", }; REQUIRE(messageList == expected); @@ -1868,8 +1868,8 @@ TEST_CASE("[Values] Crossfade CC range") synth.dispatchMessage(client, 0, "/region3/xfin_cc_range4", "", nullptr); std::vector expected { "/region0/xfin_cc_range4,N : { }", - "/region1/xfin_cc_range4,ff : { 0.0787402, 0.314961 }", - "/region2/xfin_cc_range4,ff : { -0.0787402, 0.314961 }", + "/region1/xfin_cc_range4,ff : { 0.0787402, 0.322835 }", + "/region2/xfin_cc_range4,ff : { -0.0787402, 0.322835 }", "/region3/xfin_cc_range4,ff : { 0.0787402, 1.10236 }", }; REQUIRE(messageList == expected); @@ -1889,8 +1889,8 @@ TEST_CASE("[Values] Crossfade CC range") synth.dispatchMessage(client, 0, "/region3/xfout_cc_range4", "", nullptr); std::vector expected { "/region0/xfout_cc_range4,N : { }", - "/region1/xfout_cc_range4,ff : { 0.0787402, 0.314961 }", - "/region2/xfout_cc_range4,ff : { -0.0787402, 0.314961 }", + "/region1/xfout_cc_range4,ff : { 0.0787402, 0.322835 }", + "/region2/xfout_cc_range4,ff : { -0.0787402, 0.322835 }", "/region3/xfout_cc_range4,ff : { 0.0787402, 1.10236 }", }; REQUIRE(messageList == expected);