Skip to content

Commit

Permalink
Implement effect channel changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tysonlt committed Feb 10, 2019
1 parent ef760dc commit 7c21565
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 15 deletions.
14 changes: 14 additions & 0 deletions src/AxeEffect.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#include "AxeEffect.h"
#include "AxeSystem.h"

void AxeEffect::bypass() {
_axe->disableEffect(_effectId);
}

void AxeEffect::enable() {
_axe->enableEffect(_effectId);
}

void AxeEffect::switchChannel(Channel channel) {
setChannel(channel);
_axe->setEffectChannel(_effectId, channel);
}

void AxeEffect::copyEffectName(char *buffer, size_t max) {
char tag[0];
Expand Down
29 changes: 19 additions & 10 deletions src/AxeEffect.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,54 @@
#pragma once

#include <Arduino.h>

#include "AxeEffectEnum.h"

typedef byte Channel;
typedef unsigned EffectId;

class AxeSystem;
class AxeEffect {

public:
friend class AxeSystem;

void setEffectId(EffectId effectId) { _effectId = effectId; }
public:

EffectId getEffectId() { return _effectId; }

void copyEffectName(char *buffer, size_t max);
void copyEffectTag(char *buffer, size_t max);

void setChannel(Channel channel) { _channel = channel; }
byte getChannelCount() { return _numChannels; }
Channel getChannel() { return _channel; }

char getChannelChar();

void setChannelCount(byte count) { _numChannels = count; }
byte getChannelCount() { return _numChannels; }

bool isBypassed() { return _bypassed; }
void setBypassed(bool bypassed) { _bypassed = bypassed; }
bool isSwitchable();

bool isDrive();
bool isDelay();
bool isReverb();

private:
void bypass();
void enable();
void switchChannel(Channel channel);

protected:

void setAxeSystem(AxeSystem *axe) { _axe = axe; }
void setBypassed(bool bypassed) { _bypassed = bypassed; }
void setChannelCount(byte count) { _numChannels = count; }
void setChannel(Channel channel) { _channel = channel; }
void setEffectId(EffectId effectId) { _effectId = effectId; }
void copyEffectNameAndTag(EffectId effectId, char *name, byte szName, char *tag, byte szTag);

private:

EffectId _effectId;
Channel _channel;
byte _numChannels;
bool _bypassed;

AxeSystem *_axe = nullptr;

};
12 changes: 7 additions & 5 deletions src/AxePreset.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ class AxePreset {

public:

void setPresetNumber(int number) { _preset = number; }
void setSceneNumber(int number) { _scene = number; }
int getPresetNumber() { return _preset; }
int getSceneNumber() { return _scene; }

void setPresetName(char *buffer);
void setSceneName(char *buffer);

void copyPresetName(char *buffer, size_t max);
void copySceneName(char *buffer, size_t max);

unsigned getEffectCount() { return _effectCount; }
AxeEffect getEffectAt(const EffectIndex index) { return _effects[index]; }

protected:

void setPresetNumber(int number) { _preset = number; }
void setSceneNumber(int number) { _scene = number; }
void setPresetName(char *buffer);
void setSceneName(char *buffer);
void reset();
bool isComplete();

Expand Down
1 change: 1 addition & 0 deletions src/AxeSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class AxeSystem {
void disableTuner();
void enableEffect(const EffectId);
void disableEffect(const EffectId);
void setEffectChannel(const EffectId, const Channel);

//for generic commands
void sendCommand(const byte command);
Expand Down
7 changes: 7 additions & 0 deletions src/AxeSystem_Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ void AxeSystem::sendSceneChange(const SceneNumber number) {
sendCommand(SYSEX_REQUEST_SCENE_NUMBER, data, 1);
}

void AxeSystem::setEffectChannel(const EffectId effectId, const Channel channel) {
byte data[3];
intToMidiBytes(effectId, &data[0], &data[1]);
data[2] = channel;
sendCommand(SYSEX_REQUEST_EFFECT_CHANNEL, data, 3);
}

void AxeSystem::requestLooperStatus() {
byte data[1] = {SYSEX_QUERY_BYTE};
sendCommand(SYSEX_REQUEST_LOOPER_STATUS, data, 1);
Expand Down
1 change: 1 addition & 0 deletions src/AxeSystem_Handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ void AxeSystem::processEffectDump(const byte *sysex, const byte length) {
if (msb) effectId |= 128;

AxeEffect effect;
effect.setAxeSystem(this);
effect.setEffectId(effectId);
effect.setBypassed(bypassed);
effect.setChannel(channel);
Expand Down

0 comments on commit 7c21565

Please sign in to comment.