I think it would be nice to have a NOTE_PAUSE or NOTE_SILENT "note" so when
you could write note_player.play(NOTE_PAUSE, 100) to have a non-blocking
pause in the melody. It could be used like this:
int melody[] = { NOTE_C4, NOTE_D4, NOTE_E4, NOTE_PAUSE,
NOTE_G4, NOTE_PAUSE, NOTE_A4, NOTE_PAUSE };
int melody_duration[] = { 100, 100, 100, 50,
100, 300, 50, 250, };
int melody_length = sizeof(melody) / 2; // Melody length, for looping.
void loop()
{
play_melody();
do_something_else();
}
void play_melody()
{
if(!(note_player.isPlaying())) // if the last tone has stopped
{
if(i<melody_length)
{
tone_maker.play(melody[position], melody_duration[position]);
position++;
}
else
{
position = 0;
}
}
}
I could try to add it myself, but I don't have time this week, and I've
never tried to write or modify arduino libraries before... But maybe I'll
give it a try next week if it hasn't been implemented by then.
Thanks for a great library!
Regards Martin
Original issue reported on code.google.com by
martin.f...@gmail.comon 11 Nov 2009 at 6:46