mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Selecting the melody to play when alarm goes off
This commit is contained in:
@@ -137,7 +137,7 @@ void Melody::setLoopDuration(unsigned long ms)
|
||||
/**
|
||||
* \brief Starts playing the melody, or restarts it if already playing.
|
||||
*
|
||||
* \sa setMelody(), stop(), loopCount()
|
||||
* \sa playOnce(), setMelody(), stop(), loopCount()
|
||||
*/
|
||||
void Melody::play()
|
||||
{
|
||||
@@ -150,6 +150,22 @@ void Melody::play()
|
||||
nextNote();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Plays the melody once and then stops.
|
||||
*
|
||||
* \sa play(), stop()
|
||||
*/
|
||||
void Melody::playOnce()
|
||||
{
|
||||
stop();
|
||||
if (size == 0)
|
||||
return; // No melody to play.
|
||||
loopsLeft = 1;
|
||||
posn = 0;
|
||||
playing = true;
|
||||
nextNote();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Stops playing the melody.
|
||||
*
|
||||
|
||||
@@ -131,6 +131,7 @@ public:
|
||||
void setLoopDuration(unsigned long ms);
|
||||
|
||||
void play();
|
||||
void playOnce();
|
||||
void stop();
|
||||
|
||||
void setMelody(const int *notes, const uint8_t *lengths, unsigned int size);
|
||||
|
||||
Reference in New Issue
Block a user