Add per-channel Swing configuration #7

Merged
awonak merged 9 commits from refs/pull/7/head into main 2025-06-22 18:38:51 +00:00
6 changed files with 93 additions and 29 deletions
Showing only changes of commit 572b47f9d1 - Show all commits

View File

@ -14,7 +14,7 @@ struct AppState {
int selected_param = 0;
int selected_sub_param = 0;
byte selected_channel = 0; // 0=tempo, 1-6=output channel
byte selected_shuffle = 0; // index into shuffle template
byte selected_shuffle = 0;
Clock::Source selected_source = Clock::SOURCE_INTERNAL;
Channel channel[Gravity::OUTPUT_COUNT];
};

View File

@ -93,7 +93,7 @@ class Channel {
swing_pulses = (long)((mod_pulses * (100L - shifted_swing)) / 100L);
}
const uint16_t current_tick_offset = tick + offset_pulses + swing_pulses;
const uint32_t current_tick_offset = tick + offset_pulses + swing_pulses;
// Step check
if (!output.On()) {
@ -106,7 +106,7 @@ class Channel {
}
// Duty cycle low check
const uint16_t duty_cycle_end_tick = tick + duty_pulses + offset_pulses + swing_pulses;
const uint32_t duty_cycle_end_tick = tick + duty_pulses + offset_pulses + swing_pulses;
if (duty_cycle_end_tick % mod_pulses == 0) {
output.Low();
}

View File

@ -147,6 +147,7 @@ void drawMenuItems(const char* menu_items[], int menu_size) {
}
}
// Display an indicator when swing percentage matches a musical note.
void swingDivisionMark() {
auto& ch = GetSelectedChannel();
switch (ch.getSwing()) {