commit ae10cf100f080a34ec1b9b4cfb133afa455a11c8
parent db1802a204799e15b2c4e51b930695b995496999
Author: Friedolino <[email protected]>
Date: Sat, 3 Aug 2024 00:44:26 +0200
change pkeyshift ports to have middle at 0
Diffstat:
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/Misc/Master.cpp b/src/Misc/Master.cpp
@@ -400,13 +400,13 @@ static const Ports master_ports = {
Part7, Part8, Part9, Part10, Part11, Part12,
Part13, Part14, Part15, Part16) rDefault([Off ...]),
"Part to insert part onto"),
- {"Pkeyshift::i", rShort("key shift") rProp(parameter) rLinear(0,127)
- rDefault(64) rDoc("Global Key Shift"), 0, [](const char *m, RtData&d) {
+ {"Pkeyshift::i", rShort("key shift") rProp(parameter) rLinear(-64,63) rUnit(semitones)
+ rDefault(0) rDoc("Global Key Shift"), 0, [](const char *m, RtData&d) {
if(rtosc_narguments(m)==0) {
- d.reply(d.loc, "i", ((Master*)d.obj)->Pkeyshift);
+ d.reply(d.loc, "i", ((Master*)d.obj)->Pkeyshift-64);
} else if(rtosc_narguments(m)==1 && rtosc_type(m,0)=='i') {
- ((Master*)d.obj)->setPkeyshift(limit<char>(rtosc_argument(m,0).i,0,127));
- d.broadcast(d.loc, "i", ((Master*)d.obj)->Pkeyshift);}}},
+ ((Master*)d.obj)->setPkeyshift(limit<char>(rtosc_argument(m,0).i+64,0,127));
+ d.broadcast(d.loc, "i", ((Master*)d.obj)->Pkeyshift-64);}}},
{"echo", rDoc("Hidden port to echo messages"), 0, [](const char *m, RtData&d) {
d.reply(m-1);}},
{"get-vu:", rDoc("Grab VU Data"), 0, [](const char *, RtData &d) {
diff --git a/src/Misc/Part.cpp b/src/Misc/Part.cpp
@@ -88,7 +88,13 @@ static const Ports partPorts = {
#define rChangeCb
rParamZyn(Pminkey, rShort("min"), rDefault(0), "Min Used Key"),
rParamZyn(Pmaxkey, rShort("max"), rDefault(127), "Max Used Key"),
- rParamZyn(Pkeyshift, rShort("shift"), rDefault(64), "Part keyshift"),
+ {"Pkeyshift::i", rShort("shift") rProp(parameter) rLinear(-64,63) rUnit(semitones)
+ rDefault(0) rDoc("Part Key Shift"), 0, [](const char *m, RtData&d) {
+ if(rtosc_narguments(m)==0) {
+ d.reply(d.loc, "i", ((Part*)d.obj)->Pkeyshift-64);
+ } else if(rtosc_narguments(m)==1 && rtosc_type(m,0)=='i') {
+ ((Part*)d.obj)->Pkeyshift=(limit<char>(rtosc_argument(m,0).i+64,0,127));
+ d.broadcast(d.loc, "i", ((Part*)d.obj)->Pkeyshift-64);}}},
rOption(Prcvchn, rOptions(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12, ch13, ch14, ch15, ch16),
rDefaultDepends(partno),
rPresets(ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12, ch13, ch14, ch15, ch16),