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.
Music/Music.h@15:1cb1eb0136aa, 2019-05-08 (annotated)
- Committer:
- joshdavy
- Date:
- Wed May 08 14:55:06 2019 +0000
- Revision:
- 15:1cb1eb0136aa
- Parent:
- 14:1e6f74233e8e
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joshdavy | 4:afbf3dd71403 | 1 | #ifndef MUSIC_H |
joshdavy | 4:afbf3dd71403 | 2 | #define MUSIC_H |
joshdavy | 4:afbf3dd71403 | 3 | |
joshdavy | 4:afbf3dd71403 | 4 | /*Music Class*/ |
joshdavy | 4:afbf3dd71403 | 5 | #include "mbed.h" |
joshdavy | 4:afbf3dd71403 | 6 | #include "N5110.h" |
joshdavy | 4:afbf3dd71403 | 7 | #include "Gamepad.h" |
joshdavy | 4:afbf3dd71403 | 8 | #include "Sprite.h" |
joshdavy | 4:afbf3dd71403 | 9 | #include "Player.h" |
joshdavy | 5:b9cf407bcc63 | 10 | |
joshdavy | 4:afbf3dd71403 | 11 | |
joshdavy | 4:afbf3dd71403 | 12 | |
joshdavy | 14:1e6f74233e8e | 13 | /** Music Class |
joshdavy | 14:1e6f74233e8e | 14 | |
joshdavy | 14:1e6f74233e8e | 15 | @brief The Music Class handles the playing of the background music while playing |
joshdavy | 14:1e6f74233e8e | 16 | the game. It uses the buzzer with PWM audio to play complex waveforms through |
joshdavy | 15:1cb1eb0136aa | 17 | a standard 5V pin of the board. See presentation for more detail how this works. |
joshdavy | 14:1e6f74233e8e | 18 | @version 1.0 |
joshdavy | 14:1e6f74233e8e | 19 | |
joshdavy | 14:1e6f74233e8e | 20 | @author Joshua Davy el17jd |
joshdavy | 14:1e6f74233e8e | 21 | |
joshdavy | 14:1e6f74233e8e | 22 | @date April 2019 |
joshdavy | 14:1e6f74233e8e | 23 | |
joshdavy | 14:1e6f74233e8e | 24 | */ |
joshdavy | 4:afbf3dd71403 | 25 | |
joshdavy | 4:afbf3dd71403 | 26 | class Music { |
joshdavy | 4:afbf3dd71403 | 27 | |
joshdavy | 4:afbf3dd71403 | 28 | public: |
joshdavy | 4:afbf3dd71403 | 29 | Music(); |
joshdavy | 4:afbf3dd71403 | 30 | ~Music(); |
joshdavy | 5:b9cf407bcc63 | 31 | void init(const int* data,int length); |
joshdavy | 4:afbf3dd71403 | 32 | void play_next(); |
joshdavy | 4:afbf3dd71403 | 33 | |
joshdavy | 4:afbf3dd71403 | 34 | |
joshdavy | 4:afbf3dd71403 | 35 | private: |
joshdavy | 5:b9cf407bcc63 | 36 | const int* _data; |
joshdavy | 4:afbf3dd71403 | 37 | int _index; |
joshdavy | 5:b9cf407bcc63 | 38 | int _length; |
joshdavy | 5:b9cf407bcc63 | 39 | |
joshdavy | 4:afbf3dd71403 | 40 | |
joshdavy | 4:afbf3dd71403 | 41 | }; |
joshdavy | 4:afbf3dd71403 | 42 | #endif |