Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Fri May 22 20:10:00 2020 +0000
Revision:
19:08862f49cd9e
Parent:
18:204cd747b54a
Child:
21:60f01b17b0a6
ADSR fully working and interfaceable

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lukeocarwright 7:33cb5f2db1ee 1 #ifndef FRONT_H
lukeocarwright 7:33cb5f2db1ee 2 #define FRONT_H
lukeocarwright 7:33cb5f2db1ee 3
lukeocarwright 7:33cb5f2db1ee 4 #include "mbed.h"
lukeocarwright 7:33cb5f2db1ee 5 #include "N5110.h"
lukeocarwright 7:33cb5f2db1ee 6 #include "Gamepad.h"
lukeocarwright 8:f305ea78b2b1 7 #include "Menu.h"
lukeocarwright 14:9cfe0041cc4e 8 #include "Sound.h"
lukeocarwright 18:204cd747b54a 9 #include "Envelope.h"
lukeocarwright 13:27300c533dd1 10
lukeocarwright 7:33cb5f2db1ee 11 /** Front class
lukeocarwright 7:33cb5f2db1ee 12 * @author Luke Cartwright, University of Leeds
lukeocarwright 7:33cb5f2db1ee 13 * @brief manages front pannel of Synth
lukeocarwright 7:33cb5f2db1ee 14 * @date May 2020
lukeocarwright 7:33cb5f2db1ee 15 */
lukeocarwright 8:f305ea78b2b1 16
lukeocarwright 7:33cb5f2db1ee 17 class Front
lukeocarwright 7:33cb5f2db1ee 18 {
lukeocarwright 7:33cb5f2db1ee 19 public:
lukeocarwright 7:33cb5f2db1ee 20 //variables
lukeocarwright 7:33cb5f2db1ee 21 int submenu;
lukeocarwright 8:f305ea78b2b1 22 int a;
lukeocarwright 8:f305ea78b2b1 23 int d;
lukeocarwright 8:f305ea78b2b1 24 int s;
lukeocarwright 8:f305ea78b2b1 25 int r;
lukeocarwright 13:27300c533dd1 26 int dir;
lukeocarwright 18:204cd747b54a 27 int envelope_in;
lukeocarwright 13:27300c533dd1 28 int dir_1;
lukeocarwright 14:9cfe0041cc4e 29 uint16_t out;
lukeocarwright 14:9cfe0041cc4e 30
lukeocarwright 14:9cfe0041cc4e 31 //Methods
lukeocarwright 14:9cfe0041cc4e 32 //Constructor
lukeocarwright 7:33cb5f2db1ee 33 Front();
lukeocarwright 7:33cb5f2db1ee 34
lukeocarwright 14:9cfe0041cc4e 35 //Destructior
lukeocarwright 7:33cb5f2db1ee 36 ~Front();
lukeocarwright 8:f305ea78b2b1 37
lukeocarwright 14:9cfe0041cc4e 38 //Runs whole front pannel
lukeocarwright 7:33cb5f2db1ee 39 void frontrun(N5110 &lcd, Gamepad &pad, int submenu);
lukeocarwright 14:9cfe0041cc4e 40
lukeocarwright 14:9cfe0041cc4e 41
lukeocarwright 7:33cb5f2db1ee 42 private:
lukeocarwright 7:33cb5f2db1ee 43 //variables
lukeocarwright 8:f305ea78b2b1 44 int menuflag;
lukeocarwright 13:27300c533dd1 45 int used; //1->4 (A<D<S<R)
lukeocarwright 13:27300c533dd1 46 bool use; //1=use 0=!use
lukeocarwright 13:27300c533dd1 47 bool initial; //sets to run 1st time
lukeocarwright 13:27300c533dd1 48 int adsr; //incrament correct val
lukeocarwright 13:27300c533dd1 49 int ud; //up/down
lukeocarwright 18:204cd747b54a 50 bool noteon; //trigger for play tone
lukeocarwright 19:08862f49cd9e 51 int release_flag; //sets 1 for if release on
lukeocarwright 19:08862f49cd9e 52
lukeocarwright 18:204cd747b54a 53 #ifdef CSV
lukeocarwright 18:204cd747b54a 54 int itterator;
lukeocarwright 18:204cd747b54a 55 #endif
lukeocarwright 7:33cb5f2db1ee 56
lukeocarwright 8:f305ea78b2b1 57 //methods
lukeocarwright 8:f305ea78b2b1 58 //initial setup of front panel
lukeocarwright 13:27300c533dd1 59 void frontsetup(N5110 &lcd, Gamepad &pad, int submenu, bool initial);
lukeocarwright 8:f305ea78b2b1 60
lukeocarwright 8:f305ea78b2b1 61 //prints waveforms for front disp.
lukeocarwright 8:f305ea78b2b1 62 void printwav(N5110 &lcd, int submenu);
lukeocarwright 8:f305ea78b2b1 63
lukeocarwright 7:33cb5f2db1ee 64 //prints fader
lukeocarwright 7:33cb5f2db1ee 65 void printfader(N5110 &lcd,int x, int y);
lukeocarwright 13:27300c533dd1 66
lukeocarwright 8:f305ea78b2b1 67 //prints sliders
lukeocarwright 13:27300c533dd1 68 void printsliders(N5110 &lcd, int a, int d,int s,int r, int used);
lukeocarwright 14:9cfe0041cc4e 69
lukeocarwright 13:27300c533dd1 70 //prints individual slider
lukeocarwright 13:27300c533dd1 71 void printslider(N5110 &lcd, int x_val, int y_val, bool use);
lukeocarwright 14:9cfe0041cc4e 72
lukeocarwright 13:27300c533dd1 73 //incraments correct adsr value
lukeocarwright 13:27300c533dd1 74 int incrament_adsr(int used, int adsr, int ud);
lukeocarwright 19:08862f49cd9e 75
lukeocarwright 19:08862f49cd9e 76 //pre compilation directive function
lukeocarwright 19:08862f49cd9e 77 #ifdef SLOW_TIME
lukeocarwright 19:08862f49cd9e 78 //prints slow time front values output from loop
lukeocarwright 19:08862f49cd9e 79 void print_SLOWTIME_out (uint16_t out, bool noteon, int a, int d, int s, int r, int release_flag, int silent_flag);
lukeocarwright 19:08862f49cd9e 80 #endif
lukeocarwright 7:33cb5f2db1ee 81 };
lukeocarwright 7:33cb5f2db1ee 82
lukeocarwright 7:33cb5f2db1ee 83 #endif