Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Tue May 26 14:21:36 2020 +0000
Revision:
31:cfdb014ff086
Parent:
30:08cc4ec58d07
Child:
33:e7635c8a58a8
Final Pad edit (-API check)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lukeocarwright 14:9cfe0041cc4e 1 #ifndef SOUND_H
lukeocarwright 14:9cfe0041cc4e 2 #define SOUND_H
lukeocarwright 14:9cfe0041cc4e 3
lukeocarwright 14:9cfe0041cc4e 4 #include "mbed.h"
lukeocarwright 14:9cfe0041cc4e 5
lukeocarwright 22:028f1627c262 6 /**Sound class
lukeocarwright 22:028f1627c262 7 * @author Luke Cartwright, University of Leeds
lukeocarwright 22:028f1627c262 8 * @brief fetches data from wavetables and
lukeocarwright 30:08cc4ec58d07 9 * @itterates through to next samples
lukeocarwright 22:028f1627c262 10 * @date May 2020
lukeocarwright 22:028f1627c262 11 */
lukeocarwright 14:9cfe0041cc4e 12
lukeocarwright 14:9cfe0041cc4e 13 class Sound
lukeocarwright 14:9cfe0041cc4e 14 {
lukeocarwright 14:9cfe0041cc4e 15 public: //----------------------------------------------------------------------
lukeocarwright 22:028f1627c262 16 /**Constructor */
lukeocarwright 22:028f1627c262 17 Sound();
lukeocarwright 22:028f1627c262 18
lukeocarwright 22:028f1627c262 19 /** Destructor */
lukeocarwright 22:028f1627c262 20 ~Sound();
lukeocarwright 14:9cfe0041cc4e 21
lukeocarwright 14:9cfe0041cc4e 22 //Variables
lukeocarwright 22:028f1627c262 23 int waveform; //waveform number select
lukeocarwright 22:028f1627c262 24 int frequency; //frequency of note
lukeocarwright 14:9cfe0041cc4e 25
lukeocarwright 22:028f1627c262 26 //Methods
lukeocarwright 22:028f1627c262 27
lukeocarwright 22:028f1627c262 28 /**Main sound function
lukeocarwright 22:028f1627c262 29 * @Takes in waveform type and frequency.
lukeocarwright 22:028f1627c262 30 * @ Outputs Unsigned int of wavetable value.
lukeocarwright 22:028f1627c262 31 * @ (Self itterates)
lukeocarwright 22:028f1627c262 32 */
lukeocarwright 14:9cfe0041cc4e 33 uint16_t sound_main(bool initial, int waveform, int frequency); //runs main sound function
lukeocarwright 31:cfdb014ff086 34
lukeocarwright 31:cfdb014ff086 35 /**Iterator function.
lukeocarwright 31:cfdb014ff086 36 * @Itterates through wavetable values.
lukeocarwright 31:cfdb014ff086 37 * @Outputs Next i value for sound_main function.
lukeocarwright 31:cfdb014ff086 38 */
lukeocarwright 31:cfdb014ff086 39 uint16_t wavetable_itt(uint16_t i, int frequency); //itterates wavetable
lukeocarwright 14:9cfe0041cc4e 40
lukeocarwright 14:9cfe0041cc4e 41 private: //---------------------------------------------------------------------
lukeocarwright 14:9cfe0041cc4e 42 //Variables
lukeocarwright 22:028f1627c262 43 uint16_t i; //itterator as an uint
lukeocarwright 22:028f1627c262 44 double i_d; //itterator as a double
lukeocarwright 14:9cfe0041cc4e 45 };
lukeocarwright 14:9cfe0041cc4e 46 #endif