Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Front/Front.h

Committer:
lukeocarwright
Date:
2020-05-22
Revision:
19:08862f49cd9e
Parent:
18:204cd747b54a
Child:
21:60f01b17b0a6

File content as of revision 19:08862f49cd9e:

#ifndef FRONT_H
#define FRONT_H

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Menu.h"
#include "Sound.h"
#include "Envelope.h"

/** Front class
 * @author Luke Cartwright, University of Leeds
 * @brief manages front pannel of Synth
 * @date May 2020
*/

class Front
{
public:
    //variables
    int submenu;
    int a;
    int d;
    int s;
    int r;
    int dir;
    int envelope_in;
    int dir_1;
    uint16_t out;

    //Methods
    //Constructor
    Front();

    //Destructior
    ~Front();

    //Runs whole front pannel
    void frontrun(N5110 &lcd, Gamepad &pad, int submenu);


private:
//variables
    int menuflag;
    int used; //1->4 (A<D<S<R)
    bool use; //1=use 0=!use
    bool initial; //sets to run 1st time
    int adsr; //incrament correct val
    int ud; //up/down
    bool noteon; //trigger for play tone
    int release_flag; //sets 1 for if release on
    
    #ifdef CSV
    int itterator;
    #endif

//methods
    //initial setup of front panel
    void frontsetup(N5110 &lcd, Gamepad &pad, int submenu, bool initial);

    //prints waveforms for front disp.
    void printwav(N5110 &lcd, int submenu);

    //prints fader
    void printfader(N5110 &lcd,int x, int y);

    //prints sliders
    void printsliders(N5110 &lcd, int a, int d,int s,int r, int used);

    //prints individual slider
    void printslider(N5110 &lcd, int x_val, int y_val, bool use);

    //incraments correct adsr value
    int incrament_adsr(int used, int adsr, int ud);
    
    //pre compilation directive function
    #ifdef SLOW_TIME
    //prints slow time front values output from loop
    void print_SLOWTIME_out (uint16_t out, bool noteon, int a, int d, int s, int r, int release_flag, int silent_flag);
    #endif
};

#endif