uses patches a bit

This commit is contained in:
Gordon JC Pearce 2025-02-05 23:48:58 +00:00
parent 90e818570f
commit ca653441f9
5 changed files with 49 additions and 11 deletions

View File

@ -10,6 +10,7 @@
NAME = chassis NAME = chassis
FILES_DSP = \ FILES_DSP = \
parameters.cpp \
chassis.cpp chassis.cpp

View File

@ -1,6 +1,8 @@
#include "chassis.hpp" #include "chassis.hpp"
#include "patches.hpp"
START_NAMESPACE_DISTRHO START_NAMESPACE_DISTRHO
Chassis::Chassis() : Plugin(parameterCount, 128, 0), sampleRate(getSampleRate()) { Chassis::Chassis() : Plugin(parameterCount, 128, 0), sampleRate(getSampleRate()) {
@ -18,11 +20,13 @@ void Chassis::initAudioPort(bool input, uint32_t index, AudioPort &port) {
} }
void Chassis::initProgramName(uint32_t index, String &programName) { void Chassis::initProgramName(uint32_t index, String &programName) {
return; programName = patchName[index & 0x7f].c_str();
//printf("prog = %s\n", patchName[index]);
} }
void Chassis::loadProgram(uint32_t index) { void Chassis::loadProgram(uint32_t index) {
return; index &= 0x7f;
memmove(&patchRam, (uint8_t *)patchData + (index * 18), 18);
} }
// Processing functions // Processing functions

View File

@ -67,10 +67,10 @@ class Chassis : public Plugin {
// Initialisation // Initialisation
void initAudioPort(bool input, uint32_t index, AudioPort &port) override; void initAudioPort(bool input, uint32_t index, AudioPort &port) override;
// void initParameter(uint32_t index, Parameter &parameter) override; void initParameter(uint32_t index, Parameter &parameter) override;
// void setParameterValue(uint32_t index, float value) override; void setParameterValue(uint32_t index, float value) override;
// float getParameterValue(uint32_t index) const override; float getParameterValue(uint32_t index) const override;
void initProgramName(uint32_t index, String &programName) override; void initProgramName(uint32_t index, String &programName) override;
void loadProgram(uint32_t index) override; void loadProgram(uint32_t index) override;
@ -82,6 +82,26 @@ class Chassis : public Plugin {
private: private:
double sampleRate; double sampleRate;
struct {
uint8_t lfoRate = 0x30; // lookup value defaults to 0x0200
uint8_t lfoDelay = 0x00;
uint8_t vcoLfo = 0x0a;
uint8_t pwmLfo = 0x30;
uint8_t noise = 0x00;
uint8_t vcfFreq = 0x3c; // 0x3f80
uint8_t vcfReso = 0x00;
uint8_t vcfEnv = 0x2e;
uint8_t vcfLfo = 0;
uint8_t vcfKey = 0x47;
uint8_t vca = 0x28;
uint8_t env_a = 0x1b;
uint8_t env_d = 0x39;
uint8_t env_s = 0x39; // 0x3f80
uint8_t env_r = 0x30;
uint8_t sub = 0x00;
uint8_t switch1 = 0x1a;
uint8_t switch2 = 0x18;
} patchRam;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Chassis); DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Chassis);
}; };

View File

@ -3,9 +3,6 @@
#include <stdint.h> #include <stdint.h>
#include <string> #include <string>
#include "DistrhoPlugin.hpp"
const std::string patchName[] = { const std::string patchName[] = {
"Brass Set 1", "Brass Swell", "Trumpet", "Flutes", "Moving Strings", "Brass & Strings", "Choir", "Piano I", "Brass Set 1", "Brass Swell", "Trumpet", "Flutes", "Moving Strings", "Brass & Strings", "Choir", "Piano I",
"Organ I", "Organ II", "Combo Organ", "Calliope", "Donald Pluck", "Celeste* (1 oct.up)", "Elect. Piano I", "Organ I", "Organ II", "Combo Organ", "Calliope", "Donald Pluck", "Celeste* (1 oct.up)", "Elect. Piano I",

View File

@ -144,7 +144,7 @@ DistrhoUIchassis::~DistrhoUIchassis() {
} }
void DistrhoUIchassis::programLoaded(uint32_t index) { void DistrhoUIchassis::programLoaded(uint32_t index) {
// printf("in programLoaded %d\n", i printf("in programLoaded %d\n", index);
switch (index) { switch (index) {
case Chassis::pLFORate: case Chassis::pLFORate:
xSliderLFORate->setValue(0.5); xSliderLFORate->setValue(0.5);
@ -160,12 +160,28 @@ void DistrhoUIchassis::parameterChanged(uint32_t index, float value) {
// printf("in parameterchanged %d %f\n", index, value); // printf("in parameterchanged %d %f\n", index, value);
if (index == Chassis::pLFORate) { if (index == Chassis::pLFORate) {
xSliderLFORate->setValue(value); xSliderLFORate->setValue(value);
printf("changed lforate\n");
} }
if (index == Chassis::pLFODelay) { if (index == Chassis::pLFODelay) {
xSliderLFODelay->setValue(value); xSliderLFODelay->setValue(value);
printf("changed lfoDelay\n");
} }
switch(index) {
case Chassis::pLFORate: xSliderLFORate->setValue(value); break;
case Chassis::pLFODelay: xSliderLFODelay->setValue(value); break;
case Chassis::pLFODepth: xSliderLFODepth->setValue(value); break;
case Chassis::pPWMDepth: xSliderPWMDepth->setValue(value); break;
case Chassis::pSubLevel: xSliderSubLevel->setValue(value); break;
case Chassis::pNoiseLevel: xSliderNoiseLevel->setValue(value); break;
case Chassis::pHPF: xSliderHPF->setValue(value); break;
case Chassis::pCutoff: xSliderCutoff->setValue(value); break;
case Chassis::pRes: xSliderRes->setValue(value); break;
case Chassis::pEnv: xSliderEnv->setValue(value); break;
case Chassis::pLfo: xSliderLfo->setValue(value); break;
case Chassis::pKyb: xSliderKyb->setValue(value); break;
}
} }
void DistrhoUIchassis::imageSliderDragStarted(ImageSlider* slider) { void DistrhoUIchassis::imageSliderDragStarted(ImageSlider* slider) {