minor formatting

This commit is contained in:
2025-06-09 22:36:58 -07:00
parent 8aa47b73fd
commit 70b9b28032

View File

@ -4,16 +4,14 @@
#include <Arduino.h> #include <Arduino.h>
#include <gravity.h> #include <gravity.h>
static const int MOD_CHOICE_SIZE = 21; static const int MOD_CHOICE_SIZE = 21;
// Negative for multiply, positive for divide. // Negative for multiply, positive for divide.
static const int clock_mod[MOD_CHOICE_SIZE] = {-24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64, 128}; static const int clock_mod[MOD_CHOICE_SIZE] = {-24, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 64, 128};
// This represents the number of clock pulses for a 96 PPQN clock source that match the above div/mult mods. // This represents the number of clock pulses for a 96 PPQN clock source that match the above div/mult mods.
static const int clock_mod_pulses[MOD_CHOICE_SIZE] = {4, 8, 12, 16, 24, 32, 48, 96, 192, 288, 384, 480, 576, 1152, 672, 768, 1536, 2304, 3072, 6144, 12288}; static const int clock_mod_pulses[MOD_CHOICE_SIZE] = {4, 8, 12, 16, 24, 32, 48, 96, 192, 288, 384, 480, 576, 1152, 672, 768, 1536, 2304, 3072, 6144, 12288};
class Channel { class Channel {
public: public:
/** /**
* @brief Construct a new Channel object with default values. * @brief Construct a new Channel object with default values.
*/ */
@ -21,7 +19,7 @@ public:
updatePulses(); updatePulses();
} }
// --- Setters for channel properties --- // Setters for channel properties
void setClockMod(int index) { void setClockMod(int index) {
if (index >= 0 && index < MOD_CHOICE_SIZE) { if (index >= 0 && index < MOD_CHOICE_SIZE) {
@ -44,9 +42,8 @@ public:
updatePulses(); updatePulses();
} }
// --- Getters for channel properties --- // Getters for channel properties
int getClockModIndex() const { return clock_mod_index; }
int getProbability() const { return probability; } int getProbability() const { return probability; }
int getDutyCycle() const { return duty_cycle; } int getDutyCycle() const { return duty_cycle; }
int getOffset() const { return offset; } int getOffset() const { return offset; }
@ -77,7 +74,7 @@ public:
} }
} }
private: private:
/** /**
* @brief Recalculates pulse values based on current channel settings. * @brief Recalculates pulse values based on current channel settings.
* Should be called whenever mod, duty cycle, or offset changes. * Should be called whenever mod, duty cycle, or offset changes.
@ -88,7 +85,7 @@ private:
offset_pulses = (long)((mod_pulses * (100L - offset)) / 100L); offset_pulses = (long)((mod_pulses * (100L - offset)) / 100L);
} }
byte clock_mod_index = 7; // 1x byte clock_mod_index = 7; // 1x clock mod
byte probability = 100; byte probability = 100;
byte duty_cycle = 50; byte duty_cycle = 50;
byte offset = 0; byte offset = 0;
@ -96,4 +93,4 @@ private:
int offset_pulses; int offset_pulses;
}; };
#endif // CHANNEL_H #endif // CHANNEL_H