|
THS
|
Robots /
Find a BallGoal
Notes
Code
Quote from CreateBase: How to play music in WinWVR (one method):
void updateMusic(void);
int song_time = 0, song = 0;
int playlist[] = { 4, 5, 4, 5, 0, 1, 2, 3 };
int playtime[] = {6000, 1750, 6000, 1750, 6000, 6000, 6000, 6000 };
//stores all the music:
int sing[] = { 140, 0, 13, 64, 32, 65, 16, 67, 16, 72, 64, //start Indy
30, 16, 62, 32, 64, 16, 65, 64, 30, 16, 67,
32, 69, 16, 71, 16, 77, 48,
140, 1, 14, 69, 32, 71, 16, 72, 32, 74, 32,
76, 32, 30, 16, 64, 32, 65, 16, 67, 16, 72,
64, 30, 16, 74, 32, 76, 16, 77, 32,
140, 2, 12, 67, 32, 67, 16, 76, 48, 74, 16,
67, 16, 76, 48, 74, 16, 67, 16, 77, 48,
76, 32, 74, 16, 72, 64,
140, 3, 6, 30, 64, 30, 64, 30, 64, 30, 64,
30, 64, 30, 64, //end Indy
140, 4, 15, 65, 16, 65, 16, 65, 16, 70, 48, //start SW
77, 48, 75, 16, 74, 16, 72, 16, 82, 48, 77, 32,
75, 16, 74, 16, 72, 16, 82, 48, 77, 32,
140, 5, 4, 75, 16, 74, 16, 75, 16, 72, 64,
140, 15, 4, 65, 16, 65, 16, 69, 16, 65, 32};
//executes the commands from sing[]
for(int i=0; i < 157; i++)
{
cr8_byte_tx( sing[i] ); //sends a byte to the create
}
// updateMusic() checks to see if a song is done and
// plays the next one if it is. Returns nothing.
void updateMusic(void){
if(song_time > playtime[song % 8]){// 6000){
cr8_byte_tx(141);
cr8_byte_tx(playlist[song % 8]);
song_time = 0;
song++;
}
return;
} //end updateMusic
|