Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Thu May 21 22:59:59 2020 +0000
Revision:
18:204cd747b54a
Parent:
14:9cfe0041cc4e
Child:
19:08862f49cd9e
Got attack working with hardware glitch (slew rate issue and distortion likely due to loading and amp module). Generates CSV file to check output with envelope.

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 18:204cd747b54a 20 //Objects
lukeocarwright 18:204cd747b54a 21
lukeocarwright 18:204cd747b54a 22
lukeocarwright 7:33cb5f2db1ee 23 //variables
lukeocarwright 7:33cb5f2db1ee 24 int submenu;
lukeocarwright 8:f305ea78b2b1 25 int a;
lukeocarwright 8:f305ea78b2b1 26 int d;
lukeocarwright 8:f305ea78b2b1 27 int s;
lukeocarwright 8:f305ea78b2b1 28 int r;
lukeocarwright 13:27300c533dd1 29 int dir;
lukeocarwright 18:204cd747b54a 30 int envelope_in;
lukeocarwright 13:27300c533dd1 31 int dir_1;
lukeocarwright 14:9cfe0041cc4e 32 uint16_t out;
lukeocarwright 14:9cfe0041cc4e 33
lukeocarwright 18:204cd747b54a 34
lukeocarwright 14:9cfe0041cc4e 35 //Methods
lukeocarwright 14:9cfe0041cc4e 36 //Constructor
lukeocarwright 7:33cb5f2db1ee 37 Front();
lukeocarwright 7:33cb5f2db1ee 38
lukeocarwright 14:9cfe0041cc4e 39 //Destructior
lukeocarwright 7:33cb5f2db1ee 40 ~Front();
lukeocarwright 8:f305ea78b2b1 41
lukeocarwright 14:9cfe0041cc4e 42 //Runs whole front pannel
lukeocarwright 7:33cb5f2db1ee 43 void frontrun(N5110 &lcd, Gamepad &pad, int submenu);
lukeocarwright 14:9cfe0041cc4e 44
lukeocarwright 14:9cfe0041cc4e 45
lukeocarwright 7:33cb5f2db1ee 46 private:
lukeocarwright 7:33cb5f2db1ee 47 //variables
lukeocarwright 8:f305ea78b2b1 48 int menuflag;
lukeocarwright 13:27300c533dd1 49 int used; //1->4 (A<D<S<R)
lukeocarwright 13:27300c533dd1 50 bool use; //1=use 0=!use
lukeocarwright 13:27300c533dd1 51 bool initial; //sets to run 1st time
lukeocarwright 13:27300c533dd1 52 int adsr; //incrament correct val
lukeocarwright 13:27300c533dd1 53 int ud; //up/down
lukeocarwright 18:204cd747b54a 54 bool noteon; //trigger for play tone
lukeocarwright 18:204cd747b54a 55 #ifdef CSV
lukeocarwright 18:204cd747b54a 56 int itterator;
lukeocarwright 18:204cd747b54a 57 #endif
lukeocarwright 7:33cb5f2db1ee 58
lukeocarwright 8:f305ea78b2b1 59 //methods
lukeocarwright 8:f305ea78b2b1 60 //initial setup of front panel
lukeocarwright 13:27300c533dd1 61 void frontsetup(N5110 &lcd, Gamepad &pad, int submenu, bool initial);
lukeocarwright 8:f305ea78b2b1 62
lukeocarwright 8:f305ea78b2b1 63 //prints waveforms for front disp.
lukeocarwright 8:f305ea78b2b1 64 void printwav(N5110 &lcd, int submenu);
lukeocarwright 8:f305ea78b2b1 65
lukeocarwright 7:33cb5f2db1ee 66 //prints fader
lukeocarwright 7:33cb5f2db1ee 67 void printfader(N5110 &lcd,int x, int y);
lukeocarwright 13:27300c533dd1 68
lukeocarwright 8:f305ea78b2b1 69 //prints sliders
lukeocarwright 13:27300c533dd1 70 void printsliders(N5110 &lcd, int a, int d,int s,int r, int used);
lukeocarwright 14:9cfe0041cc4e 71
lukeocarwright 13:27300c533dd1 72 //prints individual slider
lukeocarwright 13:27300c533dd1 73 void printslider(N5110 &lcd, int x_val, int y_val, bool use);
lukeocarwright 14:9cfe0041cc4e 74
lukeocarwright 13:27300c533dd1 75 //incraments correct adsr value
lukeocarwright 13:27300c533dd1 76 int incrament_adsr(int used, int adsr, int ud);
lukeocarwright 7:33cb5f2db1ee 77 };
lukeocarwright 7:33cb5f2db1ee 78
lukeocarwright 7:33cb5f2db1ee 79 #endif