maybe here someone can add, a command to reduce the volume and increase the sound volume (crossading), when the audio moves from case1 to case2.
switch (engineState) {
// case 1:
// if (curStartSample >= start_length) { // Loop the sample
// curStartSample = 0;
// engineState = 2;
// }
// OCR1A = fixedSmpleRate; // fixed sample rate (speed)!
// OCR2B = pgm_read_byte(&start_data[curStartSample]);
// curStartSample++;
// break;
// running ----
case 2:
if (curIdleSample >= idle_length) {
curIdleSample = 0;
}
OCR1A = currentIdleRate; // variable sample rate (RPM)!
OCR2B = pgm_read_byte(&idle_data[curIdleSample]);
curIdleSample++;
break;
case 3:
if (curOnidleSample >= onidle_length) { // Loop the sample
curOnidleSample = 0;
}
OCR1A = currentONidleRate; // variable sample rate (RPM)!
OCR2B = pgm_read_byte(&onidle_data[curOnidleSample]);
curOnidleSample++;
break;