/* Theme for a small car. last updated 12.9.00 */ static NoteDesc Theme1[16] = { {f2,125, 1,2}, {a2,125, 1,2}, {g2,125, 1,2}, {c3,125, 1,2}, {f2,125, 1,2}, {d3,125,250,2}, {d2,250, 1,2}, {g3,250, 1,2}, {a3,125, 1,2}, {c2,125, 1,2}, {g3,125, 1,2}, {d2,125,250,2}, {c3,125, 1,2}, {f2,125, 1,2}, {a2,125, 1,2}, {g2,125, 1,2}, }; static NoteDesc Theme2[20] = { { aSharp2,83, 1,2}, { b2, 83, 1,2}, { c2, 83, 1,2}, { cSharp2,83, 1,2}, { d2, 83, 1,2}, { dSharp2,83, 1,2}, { e2, 125, 1,2}, { f2, 375,250,2}, { g2,125,1,2}, { f2,125,1,2}, { g2,125,1,2}, { f2,125,1,2}, { g2,125,1,2}, { f2,125,1,2}, { f2,125,1,2}, { f2,125,1,2}, { g2,125,1,2}, { f2,125,1,2}, { f2,125,1,2}, { g2,125,1,2}, }; static NoteDesc Theme3[25] = { {f2, 125, 1,2}, {f3, 125, 1,2}, {d2, 125, 1,2}, {d3, 125, 1,2}, {dSharp2,125, 1,2}, {dSharp3,125, 1,2}, {e2, 125, 1,2}, {f3, 125, 1,2}, {aSharp2,167, 1,2}, {a2, 167, 1,2}, {gSharp2,133, 1,2}, {g2, 133, 1,2}, {fSharp2,100, 1,2}, {f2, 100, 1,2}, {e2, 100, 1,2}, {dSharp2, 80,20,2}, {d2, 83,20,2}, {dSharp2, 83,20,2}, {d2, 67,20,2}, {dSharp2, 67,20,2}, {c2, 67,20,2}, {cSharp2, 42,20,2}, {d2, 42,20,2}, {dSharp2, 42,20,2}, {e2, 42,20,2}, }; static uint16 theme = 1; /* Current theme */ static uint16 tableindex = 0; /* Next note to be played */ int16 PlayTheme1( byte duty ) { int16 i; i = tableindex; while ( (i < 16) ) { if ( ! Play( Theme1[i].pitch,Theme1[i].duration,Theme1[i].pause,duty) ) return i; i = i + 1; } return i; } int16 PlayTheme2( byte duty ) { int16 i; i = tableindex; while ( (i < 20) ) { if ( ! Play( Theme2[i].pitch,Theme2[i].duration,Theme2[i].pause,duty) ) return i; i = i + 1; } return i; } int16 PlayTheme3( byte duty ) { int16 i; i = tableindex; while ( (i < 25) ) { if ( ! Play( Theme3[i].pitch,Theme3[i].duration,Theme3[i].pause,duty) ) return i; i = i + 1; } return i; } byte ThemeForASmallCar( void ) { while ( ! MusicBreak ) { switch ( theme ) { case 1: tableindex = PlayTheme1(2); if ( tableindex == 16 ) { theme++; tableindex = 0;}; break; case 2: tableindex = PlayTheme1(12); if ( tableindex == 16 ) { theme++; tableindex = 0;}; break; case 3: tableindex = PlayTheme2(3); if ( tableindex == 20 ) { theme++; tableindex = 0;}; break; case 4: tableindex = PlayTheme2(15); if ( tableindex == 20 ) { theme++; tableindex = 0;}; break; case 5: tableindex = PlayTheme1(30); if ( tableindex == 16 ) { theme++; tableindex = 0;}; break; case 6: tableindex = PlayTheme2(60); if ( tableindex == 20 ) { theme++; tableindex = 0;}; break; case 7: tableindex = PlayTheme3(5); if ( tableindex == 25 ) { theme++; tableindex = 0;}; break; case 8: tableindex = PlayTheme3(5); if ( tableindex == 25 ) { theme++; tableindex = 0;}; break; case 9: WaitOrMusicBreak(500); { theme = 1; tableindex = 0;}; break; } } return TRUE; /* duty = 2; for ( i=1; i < 2 ; i++ ){ PlayTheme1(0,duty); duty = 12; } duty = 3; for ( i=1; i < 2 ; i++){ PlayTheme2(0,duty); duty = 15; } PlayTheme1(0,30); PlayTheme2(0,60); for ( i=1; i<2 ; i++){ for ( i=1; i<2 ; i++){ PlayTheme3(0,5); } WaitOrBreak(500); } */ }