From 48901cfc265f4c4152c5847c8b81da31d494f03d Mon Sep 17 00:00:00 2001 From: Stanislav Shtin Date: Sun, 28 Jun 2020 18:46:39 +0300 Subject: [PATCH 1/2] Use optional flag for parameter inversion on legacy firmware --- LibSource/Control.h | 9 ++++++--- LibSource/Patch.cpp | 11 +++++++---- Source/PatchProcessor.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/LibSource/Control.h b/LibSource/Control.h index 71661a9a..4532b145 100644 --- a/LibSource/Control.h +++ b/LibSource/Control.h @@ -13,17 +13,20 @@ class Control { set(value); } void set(const float value){ +#ifdef USE_LEGACY_FIRMWARE if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4) doSetPatchParameter(PID, 4095 - (int16_t)(value*4096.0f)); else +#endif doSetPatchParameter(PID, (int16_t)(value*4096)); } float get(){ - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4){ +#ifdef USE_LEGACY_FIRMWARE + if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4) return (4095 - getProgramVector()->parameters[PID])/4096.0f; - }else{ + else +#endif return getProgramVector()->parameters[PID]/4096.0f; - } } Control& operator=(const float value){ set(value); diff --git a/LibSource/Patch.cpp b/LibSource/Patch.cpp index d29530fc..a0417ad1 100644 --- a/LibSource/Patch.cpp +++ b/LibSource/Patch.cpp @@ -32,19 +32,22 @@ float Patch::getParameterValue(PatchParameterId pid){ // return getInitialisingPatchProcessor()->getParameterValue(pid); // if(pid < getProgramVector()->parameters_size) if(pid < getProgramVector()->parameters_size){ - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && pid < 4){ +#ifdef USE_LEGACY_FIRMWARE + if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && pid < 4) return (4095 - getProgramVector()->parameters[pid])/4096.0f; - }else{ + else +#endif return getProgramVector()->parameters[pid]/4096.0f; - } } return 0.0f; } void Patch::setParameterValue(PatchParameterId pid, float value){ +#ifdef USE_LEGACY_FIRMWARE if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && pid < 4) doSetPatchParameter(pid, 4095 - (int16_t)(value*4096.0f)); else +#endif doSetPatchParameter(pid, (int16_t)(value*4096)); } @@ -82,7 +85,7 @@ int Patch::getElapsedCycles(){ screen.setTextSize(1); screen.setTextWrap(true); screen.print(0, 26, pv->message); - } + } } void drawTitle(const char* title, ScreenBuffer& screen){ // draw title diff --git a/Source/PatchProcessor.cpp b/Source/PatchProcessor.cpp index 29a83062..176c8774 100644 --- a/Source/PatchProcessor.cpp +++ b/Source/PatchProcessor.cpp @@ -48,15 +48,17 @@ AudioBuffer* PatchProcessor::createMemoryBuffer(int channels, int size){ } void PatchProcessor::setParameterValues(int16_t *params){ +#ifdef USE_LEGACY_FIRMWARE if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE){ for(int i=0; i<4 && iupdate(4095 - params[i]); for(int i=4; iupdate(params[i]); - }else{ + } + else +#endif for(int i=0; iupdate(params[i]); - } } template From e3e72610fd166b8f26adf4a367483bb07504f56e Mon Sep 17 00:00:00 2001 From: Stanislav Shtin Date: Wed, 15 Jul 2020 22:23:58 +0300 Subject: [PATCH 2/2] Added separate device ID to differentia FW --- LibSource/Control.h | 4 ++-- LibSource/Patch.cpp | 4 ++-- Makefile | 2 +- README.md | 2 +- Source/PatchProcessor.cpp | 2 +- Source/ProgramVector.h | 31 ++++++++++++++++++++++++++----- compile.mk | 2 ++ 7 files changed, 35 insertions(+), 12 deletions(-) diff --git a/LibSource/Control.h b/LibSource/Control.h index 4532b145..65ee6fcb 100644 --- a/LibSource/Control.h +++ b/LibSource/Control.h @@ -14,7 +14,7 @@ class Control { } void set(const float value){ #ifdef USE_LEGACY_FIRMWARE - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4) + if(getProgramVector()->isLegacyFirmware() && PID < 4) doSetPatchParameter(PID, 4095 - (int16_t)(value*4096.0f)); else #endif @@ -22,7 +22,7 @@ class Control { } float get(){ #ifdef USE_LEGACY_FIRMWARE - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && PID < 4) + if(getProgramVector()->isLegacyFirmware() && PID < 4) return (4095 - getProgramVector()->parameters[PID])/4096.0f; else #endif diff --git a/LibSource/Patch.cpp b/LibSource/Patch.cpp index a0417ad1..a99572bc 100644 --- a/LibSource/Patch.cpp +++ b/LibSource/Patch.cpp @@ -33,7 +33,7 @@ float Patch::getParameterValue(PatchParameterId pid){ // if(pid < getProgramVector()->parameters_size) if(pid < getProgramVector()->parameters_size){ #ifdef USE_LEGACY_FIRMWARE - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && pid < 4) + if(getProgramVector()->isLegacyFirmware() && pid < 4) return (4095 - getProgramVector()->parameters[pid])/4096.0f; else #endif @@ -44,7 +44,7 @@ float Patch::getParameterValue(PatchParameterId pid){ void Patch::setParameterValue(PatchParameterId pid, float value){ #ifdef USE_LEGACY_FIRMWARE - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE && pid < 4) + if(getProgramVector()->isLegacyFirmware() && pid < 4) doSetPatchParameter(pid, 4095 - (int16_t)(value*4096.0f)); else #endif diff --git a/Makefile b/Makefile index f08ef29f..ef96ea9e 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ ifndef CONFIG endif ifndef PLATFORM - PLATFORM=OWL + PLATFORM=OwlLegacy endif DEPS = .FORCE diff --git a/README.md b/README.md index 2897a95b..7ea110a8 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Make sure to do a `make clean` before compiling a new patch, or add `clean` to y * PATCHOUT: number of output channels, default 2 * SLOT: user program slot to store patch in, default 0 * TARGET: changes the output prefix, default 'patch' -* PLATFORM: Alchemist, Wizard, Prism, Magus, Player, default 'OWL' +* PLATFORM: Alchemist, Wizard, Prism, Magus, Player, OWL, default 'OwlLegacy' If you follow the convention of SimpleDelay then you don't have to specify `PATCHCLASS` and `PATCHFILE`, they will be deduced from `PATCHNAME`. t diff --git a/Source/PatchProcessor.cpp b/Source/PatchProcessor.cpp index 176c8774..a5b0e332 100644 --- a/Source/PatchProcessor.cpp +++ b/Source/PatchProcessor.cpp @@ -49,7 +49,7 @@ AudioBuffer* PatchProcessor::createMemoryBuffer(int channels, int size){ void PatchProcessor::setParameterValues(int16_t *params){ #ifdef USE_LEGACY_FIRMWARE - if(getProgramVector()->hardware_version == OWL_MODULAR_HARDWARE){ + if(getProgramVector()->isLegacyFirmware()){ for(int i=0; i<4 && iupdate(4095 - params[i]); for(int i=4; i