-
Notifications
You must be signed in to change notification settings - Fork 8
/
PresetDetails.ino
78 lines (57 loc) · 1.85 KB
/
PresetDetails.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <AxeFxControl.h>
AxeSystem Axe;
void setup() {
Serial.begin(9600);
while (!Serial);
//Axe.begin(Serial1, AxeSystem::MIDI_CHANNEL_OMNI); //same as...
Axe.begin(Serial1);
//register a callback so we know when preset details are available
Axe.registerPresetChangeCallback(onPresetChange);
//ask for effects to be fetched with preset
Axe.fetchEffects(true);
//request current preset
Axe.requestPresetDetails();
}
void loop() {
Axe.update();
}
void onPresetChange(AxePreset preset) {
const size_t sz = 150;
char buf[sz];
//Preset/scene names with % in them will not print to debug properly
//AxeSystem has notified that all requested information has arrived!
Serial.println();
Serial.print("Preset number: ");
Serial.println(preset.getPresetNumber());
//You can print directly to a Print object
Serial.print("Preset name: ");
preset.printPresetName(Serial, true);
Serial.print("Scene number: ");
Serial.println(preset.getSceneNumber());
//Or you can get the name into a buffer
Serial.print("Scene name: ");
preset.copySceneName(buf, sz);
Serial.println(buf);
Serial.print("Looper status: ");
snprintf(buf, sz,
"record[%d] play[%d] overdub[%d] once[%d] reverse[%d] halfspeed[%d]",
Axe.getLooper().isRecord(),
Axe.getLooper().isPlay(),
Axe.getLooper().isOverdub(),
Axe.getLooper().isOnce(),
Axe.getLooper().isReverse(),
Axe.getLooper().isHalfSpeed()
);
Serial.println(buf);
const size_t tagSz = 10;
char tag[tagSz];
snprintf(buf, sz, "Effects[%d]: ", preset.getEffectCount());
Serial.println(buf);
for (EffectIndex index = 0; index < preset.getEffectCount(); index++) {
AxeEffect effect = preset.getEffectAt(index);
effect.copyEffectTag(tag, tagSz);
char engaged = effect.isBypassed() ? ' ' : 'X';
snprintf(buf, sz, "%s(ch:%c) [%c]", tag, effect.getChannelChar(), engaged);
Serial.println(buf);
}
}