Josh Davy / Mbed OS MUSIC_K64F
Embed: (wiki syntax)

« Back to documentation index

Music Class Reference

Music Class Reference

Music Class. More...

#include <Music.h>

Public Member Functions

 Music ()
 Constructor (no paramateters)
 ~Music ()
 Deconstructor.
void init (const int *data, int length)
 Initialiser.
void play_next ()
 Plays the next sound sample.

Detailed Description

Music Class.

The Music Class handles the playing of the background music while playing the game. It uses the buzzer with PWM audio to play complex waveforms through a standard 5V pin of the board. See presentation for more detail how this works.

Version:
1.0
Author:
Joshua Davy el17jd
Date:
April 2019

Definition at line 21 of file Music.h.


Constructor & Destructor Documentation

Music (  )

Constructor (no paramateters)

Definition at line 7 of file Music.cpp.

~Music (  )

Deconstructor.

Definition at line 14 of file Music.cpp.


Member Function Documentation

void init ( const int *  data,
int  length 
)

Initialiser.

Takes the sound data and initialises the buzzer

Parameters:
constint* data

The audio data. A array of the amplitude of the waveform over time

Parameters:
lengthLength of above sound array

Definition at line 27 of file Music.cpp.

void play_next (  )

Plays the next sound sample.

Must be called at the sample rate

Definition at line 40 of file Music.cpp.