Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Music/Music.cpp
- Revision:
- 14:1e6f74233e8e
- Parent:
- 11:db27d3838514
--- a/Music/Music.cpp Mon May 06 15:07:28 2019 +0000
+++ b/Music/Music.cpp Wed May 08 14:41:56 2019 +0000
@@ -1,11 +1,16 @@
#include "Music.h"
PwmOut speaker(PTC10);
-
+/**
+* @brief Constructor (no paramateters)
+*/
Music::Music()
{
}
+/**
+* @brief Deconstructor
+*/
Music::~Music()
{
@@ -13,7 +18,12 @@
}
-
+/**
+* @brief Initialiser. Takes the sound data and initialises the buzzer
+* @param const int* data @details The audio data. A array of the amplitude of
+* the waveform over time
+* @param length @details Length of above sound array
+*/
void Music::init(const int* data,int length)
{
@@ -23,7 +33,9 @@
speaker.write(0); // until music played stay silent
_index = 0;
}
-
+/**
+* @brief Plays the next sound sample. Must be called at the sample rate
+*/
void Music::play_next()
{
double duty_cycle;