Store up to 16 steps during recording or output previously stored CV-values
step16-storage
@/step16-storage
Store up to 16 steps during recording or output previously stored CV-values
TRIGpulse
Trigger next Step
CVinnumber
CV to be recorded if record-mode is enabled
RECnumber
Enable Record if > 0.5
STNUMnumber
Number of step to be triggered and possibly recorded if record-mode is enabled
CVoutnumber
CV output of current step - Please note: you can use this as a thruough-option during record-mode as well!
To use the node in your project you should have the visuelle-musik/16-step-sequencer-library library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
node {
// Internal state variables defined at this level persists across evaluations
Number step[16] = {31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46}; // Array of the 16 needed steps
void evaluate(Context ctx)
{
if (!isInputDirty<input_TRIG>(ctx)) // Next step to play or record
return;
int step_idx = (int)getValue<input_STNUM>(ctx)-1; // Current stepnumber (1-16)
if( ((step_idx<0) || (step_idx>15)) ) // Check for unexpected array over- or underflow!
return;
if(getValue<input_REC>(ctx) > 0.45f) // Record-mode?
step[step_idx] = getValue<input_CVin>(ctx); // Input-CV that maybe has to be recorded (do not convert to MIDI-note here!)
#ifdef DEBUG_PRINT
Serial.print(" cv / step["); Serial.print(step_idx); Serial.print("] "); Serial.print(getValue<input_CVin>(ctx)); Serial.print(" / "); Serial.println(step[step_idx]);
#endif
emitValue<output_CVout>(ctx, step[step_idx]); // Output the current step, possibly changed via step-record just now
}
}