예제 #1
0
파일: nana1.cpp 프로젝트: craigsapp/improv
void keyboardchar(int key) { 
   switch (key) {
      case ',':      // slow the tempo down
      case '<':
         tempo *= 0.95;
         metronome.setTempo(tempo);
         cout << "Tempo = " << tempo << endl;
         maxwait = calculateMaxWait(tempo);
         break;

      case '.':      // speed the tempo up
      case '>':
         tempo *= 1.05;
         metronome.setTempo(tempo);
         cout << "Tempo = " << tempo << endl;
         maxwait = calculateMaxWait(tempo);
         break;

      case '[':    // decrease the beat lag time in determing a chord
         lagmaxinsec -= 0.05;
         if (lagmaxinsec < 0.05) {
            lagmaxinsec = 0.05;
         }
         cout << "Chord decision time set to " << lagmaxinsec << endl;
         maxwait = calculateMaxWait(tempo);
         break;

      case ']':    // increase the beat lag time in determing a chord
         lagmaxinsec += 0.05;
         if (lagmaxinsec > 60.0/tempo - 0.05) {
            lagmaxinsec = 60.0/tempo - 0.05;
         }
         cout << "Chord decision time set to " << lagmaxinsec << endl;
         maxwait = calculateMaxWait(tempo);
         break;

      default:
         cout << "Undefined keyboard command" << endl;
   }

}
예제 #2
0
파일: nana1.cpp 프로젝트: craigsapp/improv
void initialization(void) { 
   cout << "Enter a tempo for melody performance: ";
   echoKeysOn();
   cin  >> tempo;
   echoKeysOff();

   metronome.setTempo(tempo);
   maxwait = calculateMaxWait(tempo);

   playChord = playChordByRules;
   cout << "Using rules for playing accompaniment" << endl;
}