Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 97e00b735e
Fetching contributors…

Cannot retrieve contributors at this time

file 75 lines (66 sloc) 1.24 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

Tpattern *CP; // current pattern

#define _patternSlots 8
int numPatterns = 3;
int patternIndex = 0;
unsigned char autoPatternCycle = false;
Tpattern *allPatterns[_patternSlots];

void patternRunner()
{
  CP->paint(CP->pos++);
  if (CP->pos >= CP->length)
  {
    // reached end of pattern.
    CP->pos = 0;
    CP->restart();
    if ((CP->repeats < 99) && (CP->count++ >= CP->repeats))
    {
      CP->count = 0;
      nextPattern();
    }
  }
}

void selectPattern(unsigned int index)
{
  patternIndex = index % numPatterns;
  CP = allPatterns[patternIndex];
  CP->restart();
  CP->pos = 0;
  CP->count = 0;
}

int getNumPatterns()
{
  return numPatterns;
}

void nextPattern()
{
  // pseudocode: if sequencer is running, go to next pattern
  if(autoPatternCycle)
  {
    selectPattern(patternIndex+1);
    if (patternIndex == 0)
    {
      selectMessage(random(numMessages));
    }
  }
}

void initSequencer()
{
  initPatText();
  initPatSolid();
  initPatCimg1();
  allPatterns[0] = &patText;
  allPatterns[1] = &patSolid;
  allPatterns[2] = &patCimg1;
  selectPattern(0);
}

void scanPattern()
{
  patternRunner();
  scanSlantBuf();
  scanRope();
}

void randomPattern()
{
  selectPattern(random(numPatterns));
  CP->randomize();
}
Something went wrong with that request. Please try again.