コード例 #1
0
ファイル: testgliss.cpp プロジェクト: Isssmael/improv
void initialization(void) { 
   notetimer.setPeriod(period); // set the period in ms between MIDI events.
   notetimer.reset();

   sentout.setSize(1024);       // store up to 1024 MIDI output bytes 
   receivedin.setSize(1024);    // store up to 1024 MIDI input bytes
   description();

   synth.makeOrphanBuffer();
   start();
}
コード例 #2
0
ファイル: squelch.cpp プロジェクト: Isssmael/improv
void initialization(void) { 
   memory.setSize(10000);   // up to 10 seconds of squelch possible
   memory.reset();
   mintime = 48;   // minimum delta time
   maxtime = 180;   // maximum delta time
   description();
}
コード例 #3
0
ファイル: circ.cpp プロジェクト: jeb2239/tcpoudp
int main(int argc, char** argv) {
  CircularBuffer cb;
  int ret, start=0, end=0;
  char buf[100] = "";
  

  cb.setSize(8);
  cb.insert("123", 3);

  cb.remove(4);
  cb.insert("k",1);
  
  cb.print();
  printf("\n");
  cb.insert("abcdefghijklmnopqrstuv", 22);
  cb.remove(7);
  cb.print();
  printf("\n");
  cb.insert("12345678", 8);
  cb.print();

  cb.getAt(buf, 9, 7, end);
  printf("\nread from buf\n%s\nindex end:%d\n", buf, end);
  
  //char testcase1[1000] = "f a\ta\na\0a f";
  //char testcase2[1000] = "abcdefghij";
  //cb.insert(testcase1, 11);
  //cb.remove(5);



  //cb.print();
  /*
  ret=cb.getTotalElements();
  printf("tot elements: %d\n", ret);

  start=cb.getHead();
  for(int i=0; i<cb.getSize(); i++) {
    ret=cb.getAt(buf, start, 1, end);
    start=end;
    printf("%d %d\n", buf[0], ret);
  }
  */

}//main
コード例 #4
0
ファイル: seny.cpp プロジェクト: Isssmael/improv
void initialization(void) { 
   batonTimer.setPeriod(50);           // time to get new state of baton
   offTimer.setPeriod(200);            // time to check buffer for forgetting
   controlDisplayTimer.setPeriod(200); // time to check buffer for forgetting

   // set the voice channels all to be 0 for the disklavier and so
   // the channels do not have to be specified when playing the note.
   for (int i=0; i<MAXVOICES; i++) {
      voice[i].setChannel(0);
   }
   computer.setChannel(0);
   computerMessage.time = t_time;
   computerMessage.p0() = 0x90;
   computerMessage.p1() = 0;
   computerMessage.p2() = 0;

   keys.setSize(1000);        // store keys for memory of previous notes
   keytimes.setSize(1000);    // note times for keys buffer
   volumes.setSize(1000);     // duration of notes being held by performer
   voltimes.setSize(1000);    // duration of notes being held by performer
   durations.setSize(1000);   // duration of notes being held by performer
   durtimes.setSize(1000);    // duration of notes being held by performer
}
コード例 #5
0
ファイル: tumble.cpp プロジェクト: craigsapp/improv
void processNote(MidiEvent message, int seqLength, int direction) {
   static Array<char>         notes;
   static Array<char>         velocities;
   static Array<int>          durations;
   static Array<int>          iois;
   static Array<int>          ontimes;
   static CircularBuffer<int> attacktimes;
   static int                 init = 0;
   static TumbleParameters    temparam;
   char vel;

   if (!init) {
      attacktimes.setSize(256);
      attacktimes.reset();
      notes.setSize(0);
      velocities.setSize(0);
      durations.setSize(0);
      iois.setSize(0);
      ontimes.setSize(128);
      ontimes.zero();
      init = 1;
   }

   char note;
   int deltatime;
   int ioi0;
   int ioix;
   if (message.isNoteOn()) {
      attacktimes.insert(message.tick);

      // check to see if the ioi is in the correct range
      if (notes.getSize() == 0) {
         // no notes yet, so don't know the first ioi
      } else {
         deltatime = attacktimes[0] - attacktimes[1];
         iois.append(deltatime);
      }
      if (iois.getSize() > 1) {
         ioi0 = iois[0];
         ioix = iois[iois.getSize()-1];
         if ((ioix < ioi0 * tolerance) || (ioix > ioi0 / tolerance)) {
            goto resettrigger;
         }
      }

      // at this point the note can be added to the sequence
      if (notes.getSize() + 1 >= seqLength) {
         // time to trigger an algorithm
         if (durations.getSize() < notes.getSize()) {
            // if the last note has not yet been turned off, approximate dur.
            deltatime = iois[iois.getSize()-1];
            durations.append(deltatime);
         }

         int i;
         for (i=0; i<seqLength; i++) {
            temparam.v[i] = velocities[i];
            temparam.i[i] = iois[i];
            temparam.d[i] = durations[i];
            temparam.n[i] = notes[i] - notes[0];
         }
         temparam.n[0]    = message.getP1() - notes[0];
         temparam.current = message.getP1();
         temparam.pos     = 1;
         temparam.max     = seqLength;
         temparam.active  = 1;
         
         startAlgorithm(temparam);
         goto resettrigger;
      } else {
         // add the note info to the algorithm pile
         note = message.getP1();
         notes.append(note);
         vel = message.getP2();
         velocities.append(vel);
         attacktimes[message.getP1()] = message.tick;
      }
   } else if (message.isNoteOff()) {
      if (notes.getSize() > 0) {
         if (notes[notes.getSize()-1] == message.getP1()) {
         deltatime = message.tick - ontimes[message.getP1()];
         durations.append(deltatime);
      } else {
         cout << "A funny error ocurred" << endl;
      }
   }

   return;

resettrigger:
   attacktimes.setSize(0);
   notes.setSize(0);
   velocities.setSize(0);
   durations.setSize(0);
   iois.setSize(0);

   if (message.isNoteOn()) {
      note = message.getP1();
      notes.append(note);
      ontimes[message.getP1()] = message.tick;
      vel = message.getP2();
      velocities.append(vel);
   }
}



//////////////////////////////
//
// startAlgorithm -- start playing the tumble algorithm.  Inserts a
//     FunctionEvent into the eventBuffer which plays the tumble
//     algorithm sequence.  The algorithm will die after the notes
//     fall off of the 88-note keyboard.
//

}
コード例 #6
0
ファイル: cbuf.cpp プロジェクト: ggoodwin37/inpr1
void CBufSizeCommand::perform( CircularBuffer& cb ) const
{
  cb.setSize( m_size );
}