ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Front.h Source File

Front.h

00001 #ifndef FRONT_H
00002 #define FRONT_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Menu.h"
00008 #include "Sound.h"
00009 #include "Envelope.h"
00010 #include "Filter.h"
00011 
00012 /** Front class
00013  * @author Luke Cartwright, University of Leeds
00014  * @brief manages front pannel of Synth
00015  * @date May 2020
00016 */
00017 
00018 class Front
00019 {
00020 public:
00021     //variables
00022     int submenu;
00023     int a;
00024     int d;
00025     int s;
00026     int r;
00027     int dir;
00028     int envelope_in;
00029     int dir_1;
00030     uint16_t out;
00031     int frequency;
00032 
00033     //Methods
00034     /** Constructor */
00035     Front();
00036 
00037     /** Destructor */
00038     ~Front();
00039 
00040     /** Runs whole front pannel 
00041     * @function to process whole front pannel
00042     * Deals with ADSR and sound generation by calling other classes */
00043     void frontrun(N5110 &lcd, Gamepad &pad, int submenu);
00044 
00045 
00046 private:
00047 //variables
00048     int menuflag; //Flag to exit front function or change menu
00049     int used; //1->4 (A<D<S<R)
00050     bool use; //1=use 0=!use
00051     bool initial; //sets to run 1st time
00052     int adsr; //incrament correct val
00053     int ud; //up/down
00054     bool noteon; //trigger for play tone
00055     int release_flag; //sets 1 for if release on
00056     int filter_type;
00057     int oct;
00058     int lr;
00059     
00060     #ifdef CSV //COMMA SEPERATED VALUE
00061     int itterator; //Itterator for CSV
00062     #endif
00063 
00064 //methods
00065     /** initial setup of front panel
00066     */
00067     void frontsetup(N5110 &lcd, Gamepad &pad, int submenu, int filter_type, bool initial);
00068     
00069     /** Initialises front
00070     * @ Runs all initial front functions
00071     */
00072     void initialise(Gamepad &pad, N5110 &lcd, int submenu);
00073     
00074     /**prints waveforms for front disp. to LCD
00075     */
00076     void printwav(N5110 &lcd, int submenu);
00077 
00078     /**prints single fader to LCD 
00079     */
00080     void printfader(N5110 &lcd,int x, int y);
00081 
00082     /**prints all ADSR sliders to LCD 
00083     */
00084     void printsliders(N5110 &lcd, int a, int d,int s,int r, int used);
00085 
00086     /**prints individual slider to LCD
00087     */
00088     void printslider(N5110 &lcd, int x_val, int y_val, bool use);
00089     
00090     /**Prints Filter Graphic
00091     * @prints correct graphic dependant on filter_type
00092     */
00093     void printfilter(N5110 &lcd, int filter_type);
00094 
00095     /**incraments correct adsr value
00096     * @outputs new ADSR value when called
00097     */
00098     int incrament_adsr(int used, int adsr, int ud);
00099     
00100     /**Incraments Filter type
00101     *outputs new filter value
00102     */
00103     int incrament_filter(int adsr, int ud);
00104     
00105     /**Converts Float to Frequency
00106     * @changes Pot 1 value to Frequency of tone (int)
00107     */
00108     int frequency_convert(Gamepad &pad, int oct);
00109     
00110     /**fader Select Change
00111     */
00112     int fader_select(int used, int lr);
00113 
00114     //pre compilation directive function
00115     #ifdef SLOW_TIME
00116     /**prints slow time front values output from loop
00117     * @prints values to pc if SLOW_TIME Macro used
00118     */
00119     void print_SLOWTIME_out (uint16_t out, bool noteon, int a, int d, int s, int r, int release_flag, int silent_flag);
00120     #endif
00121     
00122 };
00123 
00124 #endif