Skip to content

Commit bd98e75

Browse files
committed
fix: roll and shuffle based on new uClock v2
1 parent 7113bda commit bd98e75

File tree

8 files changed

+52
-35
lines changed

8 files changed

+52
-35
lines changed

v2/AciduinoV2/6_shared_gui_comp.ino

+8-5
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,15 @@ struct Transpose : PageComponent {
141141
} transposeComponent;
142142

143143
struct RollType : PageComponent {
144-
144+
145+
uint8_t current_roll = 0;
146+
ROLL_TYPE rollTypes[7] = {FLAM_1, FLAM_2, FLAM_3, FLAM_4, FLAM_5, SUB_STEP_1, SUB_STEP_2};
147+
145148
String options;
146149
void view() {
147-
uint8_t roll_type = AcidSequencer.getRollType(_selected_track);
150+
uint8_t roll_type = rollTypes[current_roll]; //AcidSequencer.getRollType(_selected_track);
148151
if (roll_type <= FLAM_5) {
149-
options = "f" + String(roll_type+1);
152+
options = "f" + String(roll_type);
150153
} else {
151154
options = "s" + String(roll_type - FLAM_5);
152155
}
@@ -156,8 +159,8 @@ struct RollType : PageComponent {
156159

157160
void change(int16_t data) {
158161
//clearStackNote(_selected_track);
159-
data = parseData(data, 0, 6, AcidSequencer.getRollType(_selected_track));
160-
AcidSequencer.setRollType(_selected_track, data);
162+
current_roll = parseData(data, 0, 6, current_roll); //AcidSequencer.getRollType(_selected_track));
163+
AcidSequencer.setRollType(_selected_track, rollTypes[current_roll]);
161164
}
162165

163166
} rollTypeComponent;

v2/AciduinoV2/src/ports/esp32/wroom.h

+22-10
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
// enable ble-midi? needs USE_MIDI2
2424
//#define USE_BT_MIDI_ESP32
2525

26-
#define USE_MIDI1
27-
//#define USE_MIDI2
28-
//#define USE_MIDI3
26+
// enable Serial to be able to use on serial-to-midi bridges on PCs
27+
// like hairless midi or ttymidi
28+
// does it needs USE_MIDI1
29+
#define USE_SERIAL_MIDI_115200
30+
31+
#define USE_MIDI1 // USB MIDI, needs a serial-to-midi bridge on the other side: hariless midi or ttymidi
32+
//#define USE_MIDI2 // BLE MIDI: bluetooth is not a good option to run realtime application like midi, so be aware of shit timming and issues(good for a midi controller only)
33+
#define USE_MIDI3 // real MIDI serial port: connect to your hardware synths via MIDI cable(check midi out schematics for 3.3v)
2934

3035
// wich modules you need acidman?
3136
// PUSH and LED modules require booth PUSH_SPI and LED_SPI to point into some spi device
@@ -97,19 +102,26 @@ U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
97102

98103
// Midi device
99104
// initing midi devices
100-
//MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI1);
101-
MIDI_CREATE_INSTANCE(HardwareSerial, Serial2, MIDI1);
105+
#if defined(USE_MIDI1) // USB
106+
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI1);
107+
#endif
102108

103-
#if defined(USE_BT_MIDI_ESP32) && defined(CONFIG_BT_ENABLED)
109+
#if defined(USE_MIDI2) // Bluetooth
110+
#if defined(USE_BT_MIDI_ESP32) && defined(CONFIG_BT_ENABLED)
104111
BLEMIDI_CREATE_INSTANCE("Aciduino", MIDI2);
105112
#endif
113+
#endif
106114

107-
// in case we got USB native mode support builtin, use it!
108-
#if defined(CONFIG_TINYUSB_ENABLED)
109-
ESPNATIVEUSBMIDI espNativeUsbMidi;
110-
MIDI_CREATE_INSTANCE(ESPNATIVEUSBMIDI, espNativeUsbMidi, MIDI3);
115+
#if defined(USE_MIDI3) // Hardware midi
116+
MIDI_CREATE_INSTANCE(HardwareSerial, Serial2, MIDI3);
111117
#endif
112118

119+
// in case we got USB native mode support builtin, use it! note the case of wroom, keep this setup for later other boards
120+
//#if defined(CONFIG_TINYUSB_ENABLED)
121+
//ESPNATIVEUSBMIDI espNativeUsbMidi;
122+
//MIDI_CREATE_INSTANCE(ESPNATIVEUSBMIDI, espNativeUsbMidi, MIDI1);
123+
//#endif
124+
113125
// SPI devices
114126
//#define PUSH_SPI SPI
115127
//#define LED_SPI SPI

v2/AciduinoV2/src/sequencer/acid_sequencer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ void AcidSequencerClass::on96PPQN(uint32_t tick)
6767
{
6868
_tick = tick;
6969
// 303 clock call
70-
_engine303.onClockCall(tick);
70+
_engine303.on96PPQNCall(tick);
7171
// 808 clock call
72-
_engine808.onClockCall(tick);
72+
_engine808.on96PPQNCall(tick);
7373
}
7474

7575
uint16_t AcidSequencerClass::get303PatternMemorySize()

v2/AciduinoV2/src/sequencer/engine_303.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ void Engine303::onStepCall(uint32_t tick, int8_t shuffle_length_ctrl)
404404
}
405405

406406
// The callback function wich will be called by uClock each Pulse of 96PPQN clock resolution.
407-
void Engine303::onClockCall(uint32_t tick)
407+
void Engine303::on96PPQNCall(uint32_t tick)
408408
{
409409
for ( uint8_t track = 0; track < TRACK_NUMBER_303; track++ ) {
410410

v2/AciduinoV2/src/sequencer/engine_303.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Engine303 : public Engine
115115
void onStepCall(uint32_t tick, int8_t shuffle_length_ctrl);
116116

117117
// The callback function wich will be called by uClock each Pulse of 96PPQN clock resolution.
118-
void onClockCall(uint32_t tick);
118+
void on96PPQNCall(uint32_t tick);
119119

120120
void clearStackNote(int8_t track);
121121

v2/AciduinoV2/src/sequencer/engine_808.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,24 @@ void Engine808::onStepCall(uint32_t tick, int8_t shuffle_length_ctrl)
122122
#endif
123123
// it this a roll? prepare the data
124124
if (roll) {
125-
// a full one step in 96ppqn is 24 pulses. minus this shot one, we have 23 pulses left, put it 20
126-
_sequencer[track].voice[voice].trigger_ctrl = -20;
125+
// a full one step in 96ppqn is 24 pulses. minus this shot one, we have 23 pulses left
126+
_sequencer[track].voice[voice].trigger_ctrl = -24;
127+
if (_sequencer[track].roll_type >= SUB_STEP_1)
128+
return; // handle on 96ppqn only
127129
} else {
128130
_sequencer[track].voice[voice].trigger_ctrl = NOTE_LENGTH_808;
129131
}
130132

131133
// send the drum triger
132134
_onEventCallback(NOTE_ON, _sequencer[track].voice[voice].note, accent ? ACCENT_VELOCITY_808 : NOTE_VELOCITY_808, track+TRACK_NUMBER_303);
133-
134135
}
135136
}
136137

137138
}
138139
}
139140

140-
// The callback function wich will be called by uClock each Pulse of 96PPQN clock resolution.
141-
void Engine808::onClockCall(uint32_t tick)
141+
// The callback function wich will be called by uClock each Pulse of 96PPQN
142+
void Engine808::on96PPQNCall(uint32_t tick)
142143
{
143144
for ( uint8_t track = 0; track < TRACK_NUMBER_808; track++ ) {
144145

@@ -168,17 +169,17 @@ void Engine808::onClockCall(uint32_t tick)
168169
} else {
169170
// SUB_STEP_1
170171
if (_sequencer[track].roll_type == SUB_STEP_1) {
171-
if (_sequencer[track].voice[i].trigger_ctrl == -3 || _sequencer[track].voice[i].trigger_ctrl == -1)
172+
if (_sequencer[track].voice[i].trigger_ctrl%8 == 0)
172173
shot_the_moon = true;
173174
// SUB_STEP_2
174175
} else if (_sequencer[track].roll_type == SUB_STEP_2) {
175-
shot_the_moon = true;
176+
if (_sequencer[track].voice[i].trigger_ctrl%4 == 0)
177+
shot_the_moon = true;
176178
}
177-
178179
}
179180

180181
if (shot_the_moon)
181-
_onEventCallback(NOTE_ON, _sequencer[track].voice[i].note, NOTE_VELOCITY_808, track+TRACK_NUMBER_303);
182+
_onEventCallback(NOTE_ON, _sequencer[track].voice[i].note, ACCENT_VELOCITY_808, track+TRACK_NUMBER_303);
182183
}
183184

184185
}

v2/AciduinoV2/src/sequencer/engine_808.h

+7-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@
3232
#include "setup.h"
3333
#include "engine.h"
3434

35+
// based on 96PPQN place the pulse location of each FLAM option
3536
typedef enum {
36-
FLAM_1,
37-
FLAM_2,
38-
FLAM_3,
39-
FLAM_4,
40-
FLAM_5,
37+
FLAM_1 = 1,
38+
FLAM_2 = 3,
39+
FLAM_3 = 6,
40+
FLAM_4 = 9,
41+
FLAM_5 = 13,
4142
SUB_STEP_1,
4243
SUB_STEP_2,
4344
} ROLL_TYPE;
@@ -142,7 +143,7 @@ class Engine808 : public Engine
142143
uint16_t getPatternTrackSize();
143144

144145
// The callback function wich will be called by uClock each Pulse of 96PPQN clock resolution.
145-
void onClockCall(uint32_t tick);
146+
void on96PPQNCall(uint32_t tick);
146147
void clearStackNote(int8_t track);
147148

148149
private:

v2/AciduinoV2/src/uClock

0 commit comments

Comments
 (0)