Skip to content

Commit

Permalink
cleaning up arp stuff a bit and fixing arp length issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmikwolf committed Feb 24, 2020
1 parent 80d3d2b commit 11b7050
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 44 deletions.
3 changes: 0 additions & 3 deletions src/Sequencer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,7 @@ void Sequencer::sequenceModeStandardStep()
case CURRENTLY_PLAYING:
if (stepData[stepNum].framesRemaining < stepData[stepNum].arpLastFrame)
{
// if( getArpLastFrame(stepNum) < currentFrame )

noteShutOff(stepNum, stepData[stepNum].gateOff());
// Serial.println("note shut off: " + String(stepNum));
stepData[stepNum].noteStatus = BETWEEN_APEGGIATIONS;
if (stepData[stepNum].arpStatus > getArpCount(stepNum))
{
Expand Down
1 change: 0 additions & 1 deletion src/Sequencer.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class Sequencer
uint16_t getStepPitch(uint8_t step, uint8_t index);
uint16_t getArpCount(uint8_t stepNum);
uint32_t getArpStartFrame(uint8_t stepNum, uint16_t arpNum);
uint32_t getArpLastFrame(uint8_t stepNum, uint16_t arpNum);
uint8_t getArpSpeedNumerator(uint8_t stepNum);
uint8_t getArpSpeedDenominator(uint8_t stepNum);

Expand Down
58 changes: 24 additions & 34 deletions src/sequencer_note_trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,7 @@ void Sequencer::noteTrigger(uint8_t stepNum, bool gateTrig, uint8_t arpTypeTrig,
return;
}


//if (quantizeKey == 1){
// stepData[stepNum].notePlaying = quantizePitch(playPitch, aminor, 1);
//if (quantizeMode > 0){
// stepData[stepNum].notePlaying = quantizePitch(playPitch, quantizeKey, quantizeMode, 1);
// } else {
stepData[stepNum].notePlaying = this->get_play_pitch(stepNum, pitchArray, arpTypeTrig, arpOctaveTrig);
// }
//Serial.println("noteOn"); delay(10);
// Serial.printf("-%d-\
n", stepData[stepNum].notePlaying);

//BEGIN INPUT MAPPING SECTION
// if (gateInputRaw[gpio_randompitch]){
Expand All @@ -134,13 +124,12 @@ void Sequencer::noteTrigger(uint8_t stepNum, bool gateTrig, uint8_t arpTypeTrig,
stepData[stepNum].notePlaying += this->transpose;
uint8_t glideVal = min_max(stepData[stepNum].glide + outputControl->cvInputCheck(cv_glidemod), 0, 255);

//if(gateInputRaw[gpio_gatemute]){
if (outputControl->gpioCheck(gpio_gatemute))
{
gateTrig = false;
}
if (stepData[stepNum].arpStatus == 0)
{
{
stepData[stepNum].framesRemaining = 0;
stepData[stepNum].stepStartFrame = currentFrame;
}
Expand All @@ -149,9 +138,9 @@ void Sequencer::noteTrigger(uint8_t stepNum, bool gateTrig, uint8_t arpTypeTrig,
// THIS INPUT MAPPING STILL NEEDS WORK.
// CUTS NOTES OFF WHEN GATE IS TOO LONG.
// NEED TO ADD WATCHDOG TO TURN NOTES OFF BEFORE A NEW ONE IS TRIGGERED
stepData[stepNum].framesRemaining += (2 * stepData[stepNum].gateLength + 2 + outputControl->cvInputCheck(cv_gatemod)) * framesPerBeat(globalObj->tempoX100) * clockDivisionNum() / (8 * clockDivisionDen());
stepData[stepNum].framesRemaining += (3 * stepData[stepNum].gateLength + 2 + outputControl->cvInputCheck(cv_gatemod)) * framesPerBeat(globalObj->tempoX100) * clockDivisionNum() / (8 * clockDivisionDen());

if (swingX100 != 50)
if (swingX100 != 50)
{
if (!swinging)
{
Expand Down Expand Up @@ -184,15 +173,14 @@ void Sequencer::noteTrigger(uint8_t stepNum, bool gateTrig, uint8_t arpTypeTrig,
}
else
{

stepData[stepNum].framesRemaining += framesPerBeat(globalObj->tempoX100) * clockDivisionNum();
stepData[stepNum].framesRemaining *= getArpSpeedNumerator(stepNum);
stepData[stepNum].framesRemaining /= getArpSpeedDenominator(stepNum);
stepData[stepNum].framesRemaining /= clockDivisionDen();

if (swingX100 != 50)
{
//if ((stepNum + swingSwitch + (stepData[stepNum].arpStatus * getArpSpeedNumerator(stepNum)) / getArpSpeedDenominator(stepNum)) % 2){
// if ((stepNum + swingSwitch + (stepData[stepNum].arpStatus * getArpSpeedNumerator(stepNum)) / getArpSpeedDenominator(stepNum)) % 2){
if (!swinging)
{
stepData[stepNum].framesRemaining *= 200 - 2 * swingX100;
Expand All @@ -205,28 +193,30 @@ void Sequencer::noteTrigger(uint8_t stepNum, bool gateTrig, uint8_t arpTypeTrig,
}
}

stepData[stepNum].arpLastFrame = stepData[stepNum].framesRemaining / 4;
if (stepData[stepNum].arpLastFrame < getStepLength() / 16)
stepData[stepNum].arpLastFrame = stepData[stepNum].framesRemaining / 64;
if (stepData[stepNum].arpLastFrame < getStepLength() / 64)
{
stepData[stepNum].arpLastFrame = getStepLength() / 16;
stepData[stepNum].arpLastFrame = getStepLength() / 64;
}

}

/*
Serial.println(
"millis: " + String(millis()) +
"\tstepNum: " + String(stepNum) +
"\tchannel: " + String(channel) +
"\tpattern: " + String(pattern) +
//"\tgateLength: " + String(stepData[stepNum].gateLength) +
//"\tminmax: " + String(min_max(stepData[stepNum].framesRemaining, 1, 64 )) +
//"\tcurrentFrame: " + String(currentFrame) +
//"\tswinging: " + String(swingCount % 2) +
//"\tFramesRem: " + String(stepData[stepNum].framesRemaining) +
//"\tgetStepLength: " + String(getStepLength()) +
"\tarptype: " + String(stepData[stepNum].arpType)
);
*/

// Serial.println(
// "millis: " + String(millis()) +
// "\tstepNum: " + String(stepNum) +
// "\tchannel: " + String(channel) +
// "\tpattern: " + String(pattern) +
// "\tgateLength: " + String(stepData[stepNum].gateLength) +
// //"\tminmax: " + String(min_max(stepData[stepNum].framesRemaining, 1, 64 )) +
// //"\tcurrentFrame: " + String(currentFrame) +
// //"\tswinging: " + String(swingCount % 2) +
// //"\tFramesRem: " + String(stepData[stepNum].framesRemaining) +
// "\tgetStepLength: " + String(getStepLength()) +
// "\tarpStatus: " + String(stepData[stepNum].arpStatus) +
// "\tarptype: " + String(stepData[stepNum].arpType)
// );


//DEBUG_PRINT("clockDivNum:" + String(clockDivisionNum()) + "clockDivDen:" + String(clockDivisionDen()) );

Expand Down
7 changes: 1 addition & 6 deletions src/sequencer_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,6 @@ void Sequencer::stoppedTrig(uint8_t stepNum, bool onOff, bool gate)
}
};


uint32_t Sequencer::getArpLastFrame(uint8_t stepNum, uint16_t arpNum)
{
}

uint32_t Sequencer::getArpStartFrame(uint8_t stepNum, uint16_t arpNum)
{
uint32_t stepFrames = stepData[stepNum].stepStartFrame;
Expand Down Expand Up @@ -520,7 +515,7 @@ uint16_t Sequencer::getArpCount(uint8_t stepNum)
}
else
{
arpCount = (stepData[stepNum].gateLength * getArpSpeedDenominator(stepNum) / getArpSpeedNumerator(stepNum)) / 4;
arpCount = ((stepData[stepNum].gateLength+1) * getArpSpeedDenominator(stepNum) / getArpSpeedNumerator(stepNum)) / 4 -1;
}

return arpCount;
Expand Down

0 comments on commit 11b7050

Please sign in to comment.