ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Sound.h Source File

Sound.h

00001 #ifndef SOUND_H
00002 #define SOUND_H
00003 
00004 #include "mbed.h"
00005 
00006 /**Sound class
00007  * @author Luke Cartwright, University of Leeds
00008  * @brief fetches data from wavetables and
00009  * @itterates through to next samples
00010  * @date May 2020
00011 */
00012 
00013 class Sound
00014 {
00015 public: //----------------------------------------------------------------------
00016 /**Constructor */
00017 Sound();
00018    
00019 /** Destructor */ 
00020 ~Sound();
00021     
00022 //Variables
00023 int waveform; //waveform number select
00024 int frequency; //frequency of note
00025     
00026 //Methods
00027 
00028 /** Main sound function
00029 * @Takes in waveform type and frequency.
00030 * @ Outputs Unsigned int of wavetable value.
00031 * @ (Self itterates)
00032 */
00033  uint16_t sound_main(bool initial, int waveform, int frequency); //runs main sound function
00034  
00035  /**Iterator function.
00036 * @Itterates through wavetable values.
00037 * @Outputs Next i value for sound_main function.
00038 */
00039 uint16_t wavetable_itt(uint16_t i, int frequency); //itterates wavetable
00040 
00041 private: //---------------------------------------------------------------------
00042 //Variables
00043 uint16_t i; //itterator as an uint
00044 double i_d; //itterator as a double
00045 };
00046 #endif