Added CV Test Utility, changed some stuff related to cv in main program
This commit is contained in:
@ -40,21 +40,21 @@ struct channel {
|
||||
byte mode; //0 - CLK, 1 - RND, 2 - SEQ
|
||||
byte subDiv;
|
||||
byte CV1Target; //0 - Off, 1 - Subdiv, 2 - RND, 3 - SeqPattern
|
||||
byte CV1Value;
|
||||
byte CV1Range;
|
||||
byte CV2Target;
|
||||
byte CV2Value;
|
||||
byte CV2Range;
|
||||
byte offset;
|
||||
byte random;
|
||||
byte seqPattern;
|
||||
};
|
||||
|
||||
channel channels[6] = { //array of channel settings
|
||||
{ 0, 7, 0, 3, 0, 3, 0, 0, 0 },
|
||||
{ 0, 7, 0, 3, 0, 3, 0, 0, 0 },
|
||||
{ 0, 7, 0, 3, 0, 3, 0, 0, 0 },
|
||||
{ 0, 7, 0, 3, 0, 3, 0, 0, 0 },
|
||||
{ 0, 7, 0, 3, 0, 3, 0, 0, 0 },
|
||||
{ 0, 7, 0, 3, 0, 3, 0, 0, 0 }
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
bool seqA1[16] = {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1};
|
||||
@ -82,7 +82,7 @@ byte memCode = 'A'; //Change to different letter if you changed the data structu
|
||||
unsigned int channelPulseCount[6];
|
||||
unsigned int channelPulsesPerCycle[6];
|
||||
byte sixteenthPulseCount = 0;
|
||||
int playingModes[6]; //actual channel modes array updated from channels object on each beat
|
||||
int playingModes[6]; // should be renamed to currentSubdivs or something. Updated from channels object on beat and with applied CV modulation
|
||||
|
||||
unsigned int pulsePeriod;
|
||||
bool isPlaying = false;
|
||||
@ -158,23 +158,7 @@ const uint8_t fabryka[450] U8G2_FONT_SECTION("fabryka") =
|
||||
"\65L\206\221\30\67b\334\210q#\306\215\30\67b\30\11&\234\14#\61\356\240\275{ \242\5\23\0"
|
||||
"x\32\336\36\303\300c$\10\221!B\12\235I\222\346P\21!C\210\4\261\203\3\0\0\0\4\377\377"
|
||||
"\0";
|
||||
|
||||
static const uint16_t fabryka_first_encoding_table[4] = {
|
||||
47, 49, 55, 65535};
|
||||
static const uint16_t fabryka_index_to_second_table[4] = {
|
||||
0, 5, 6, 11};
|
||||
static const uint16_t fabryka_second_encoding_table[11] = {
|
||||
47, 49, 50, 51, 55, 52, 37, 52, 65, 66, 120};
|
||||
static const uint8_t fabryka_kerning_values[11] = {
|
||||
10, 6, 2, 4, 9, 5, 2, 3, 2, 2, 2};
|
||||
u8g2_kerning_t fabryka_k = {
|
||||
4, 11,
|
||||
fabryka_first_encoding_table,
|
||||
fabryka_index_to_second_table,
|
||||
fabryka_second_encoding_table,
|
||||
fabryka_kerning_values};
|
||||
|
||||
|
||||
|
||||
|
||||
void setup() {
|
||||
//Serial.begin(9600);
|
||||
@ -287,9 +271,9 @@ void sendTriggers() {
|
||||
int seqMod = 0;
|
||||
byte seqPattern;
|
||||
if (channels[i].CV2Target == 3) {
|
||||
seqMod = map(a2Input, 0, 1023, -8, 8);
|
||||
seqMod = map(a2Input, -1, 1024, -8, 8); //-1 and 1024 are to try to make the last step not at max value (should make the range from -7 to +7)
|
||||
} else if (channels[i].CV1Target == 3) {
|
||||
seqMod = map(a1Input, 0, 1023, -8, 8);
|
||||
seqMod = map(a1Input, -1, 1024, -8, 8);
|
||||
}
|
||||
if (channels[i].seqPattern < 8 && channels[i].seqPattern + seqMod >= 8) {
|
||||
seqPattern = 7;
|
||||
@ -388,7 +372,6 @@ void sendTriggers() {
|
||||
randAmount = 10;
|
||||
}
|
||||
|
||||
|
||||
if ((channels[i].mode == 0 && channelPulseCount[i] == channels[i].offset) //CLK with offset
|
||||
|| (channels[i].mode == 1 && channelPulseCount[i] == 0 && (random(10) + 1) > randAmount) //RND
|
||||
) {
|
||||
@ -406,19 +389,13 @@ void sendTriggers() {
|
||||
void calculateCycles() {
|
||||
|
||||
for (byte i = 0; i < 6; i++) {
|
||||
if (channels[i].CV1Target != 1 && channels[i].CV2Target != 1) {
|
||||
playingModes[i] = subDivs[channels[i].subDiv];
|
||||
} else if (channels[i].CV1Target == 1) { //subdiv modulation happens here
|
||||
int mod;
|
||||
mod = a1Input;
|
||||
mod = map(mod, 0, 1023, (channels[i].CV1Value * -1), channels[i].CV1Value);
|
||||
playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards
|
||||
int mod = 0; //subdiv modulation happens here
|
||||
if (channels[i].CV1Target == 1) {
|
||||
mod = map(a1Input, -1, 1024, -5, 5); //(channels[i].CV1Value * -1), channels[i].CV1Value)
|
||||
} else if (channels[i].CV2Target == 1) {
|
||||
int mod;
|
||||
mod = a2Input;
|
||||
mod = map(mod, 0, 1023, (channels[i].CV2Value * -1), channels[i].CV2Value);
|
||||
playingModes[i] = subDivs[channels[i].subDiv - mod];
|
||||
mod = map(a2Input, -1, 1024, -5, 5);
|
||||
}
|
||||
playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards
|
||||
|
||||
if (playingModes[i] > 0 && channels[i].mode != 2) {
|
||||
channelPulsesPerCycle[i] = (playingModes[i] * PPQN) - 1;
|
||||
|
||||
Reference in New Issue
Block a user