Can select programs

This commit is contained in:
Gordon JC Pearce 2024-07-30 19:35:38 +01:00
parent 6459dac63f
commit 7648ba6bdc
2 changed files with 11 additions and 2 deletions

View File

@ -83,6 +83,12 @@ void BarrVerb::initAudioPort(bool input, uint32_t index, AudioPort &port) {
void BarrVerb::initProgramName(uint32_t index, String &programName) { void BarrVerb::initProgramName(uint32_t index, String &programName) {
programName = "init program"; //&prog_name[index & 0x3f]; programName = "init program"; //&prog_name[index & 0x3f];
programName = prog_name[index & 0x3f].c_str();
}
void BarrVerb::loadProgram(uint32_t index) {
prog_offset = (index & 0x3f) << 7;
} }
// Processing functions // Processing functions
@ -122,7 +128,7 @@ void BarrVerb::run(const float **inputs, float **outputs, uint32_t frames) {
for (uint32_t i=0; i < frames; i+=2) { for (uint32_t i=0; i < frames; i+=2) {
// run the actual DSP engine for each sample // run the actual DSP engine for each sample
for (uint8_t step = 0; step < 128; step++) { for (uint8_t step = 0; step < 128; step++) {
opcode = rom[(128*57) + step]; opcode = rom[prog_offset + step];
switch (opcode & 0xc000) { switch (opcode & 0xc000) {
case 0x0000: case 0x0000:
ai = ram[ptr]; ai = ram[ptr];

View File

@ -45,17 +45,20 @@ class BarrVerb : 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 initProgramName(uint32_t index, String &programName) override; void initProgramName(uint32_t index, String &programName) override;
void loadProgram(uint32_t index) override;
// Processing // Processing
void activate() override; void activate() override;
void deactivate() override; void deactivate() override;
void run(const float **inputs, float **outputs, uint32_t frames) override; void run(const float **inputs, float **outputs, uint32_t frames) override;
private: private:
float c1_1, c2_1, d0_1, c1_2, c2_2, d0_2, in_z1, in_z2, in_z12,in_z22, out_z1, out_z2; float c1_1, c2_1, d0_1, c1_2, c2_2, d0_2, in_z1, in_z2, in_z12,in_z22, out_z1, out_z2;
int16_t ai, li, acc; int16_t ai, li, acc;
uint16_t ptr; uint16_t ptr;
uint16_t prog_offset;
int16_t *ram; int16_t *ram;
float *lowpass; float *lowpass;