Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Front/Front.cpp@19:08862f49cd9e, 2020-05-22 (annotated)
- Committer:
- lukeocarwright
- Date:
- Fri May 22 20:10:00 2020 +0000
- Revision:
- 19:08862f49cd9e
- Parent:
- 18:204cd747b54a
- Child:
- 24:c3bb1b0b2207
ADSR fully working and interfaceable
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lukeocarwright | 7:33cb5f2db1ee | 1 | #include "mbed.h" |
lukeocarwright | 7:33cb5f2db1ee | 2 | #include "Front.h" |
lukeocarwright | 7:33cb5f2db1ee | 3 | |
lukeocarwright | 14:9cfe0041cc4e | 4 | //Objects----------------------------------------------------------------------- |
lukeocarwright | 14:9cfe0041cc4e | 5 | Sound sound; |
lukeocarwright | 18:204cd747b54a | 6 | Envelope envelope; |
lukeocarwright | 14:9cfe0041cc4e | 7 | |
lukeocarwright | 14:9cfe0041cc4e | 8 | //Sprites----------------------------------------------------------------------- |
lukeocarwright | 19:08862f49cd9e | 9 | const int fader[35][5] = { //Fader Sprite |
lukeocarwright | 7:33cb5f2db1ee | 10 | { 1,1,1,1,1 }, |
lukeocarwright | 7:33cb5f2db1ee | 11 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 12 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 13 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 14 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 15 | { 1,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 16 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 17 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 18 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 19 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 20 | { 1,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 21 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 22 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 23 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 24 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 25 | { 1,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 26 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 27 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 28 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 29 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 30 | { 1,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 31 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 32 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 33 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 34 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 35 | { 1,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 36 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 37 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 38 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 39 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 40 | { 1,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 41 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 42 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 43 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 44 | { 1,1,1,1,1 }, |
lukeocarwright | 7:33cb5f2db1ee | 45 | }; |
lukeocarwright | 7:33cb5f2db1ee | 46 | |
lukeocarwright | 14:9cfe0041cc4e | 47 | const int sin_wav[6][28] = {//sub 1 sin sprite |
lukeocarwright | 7:33cb5f2db1ee | 48 | { 0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 49 | { 0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 50 | { 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 51 | { 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1 }, |
lukeocarwright | 7:33cb5f2db1ee | 52 | { 0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 53 | { 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 54 | }; |
lukeocarwright | 14:9cfe0041cc4e | 55 | const int tri_wav[6][28] = {//sub 2 tri sprite |
lukeocarwright | 7:33cb5f2db1ee | 56 | { 0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 57 | { 0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 58 | { 0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 59 | { 1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 60 | { 0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1 }, |
lukeocarwright | 7:33cb5f2db1ee | 61 | { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 62 | }; |
lukeocarwright | 14:9cfe0041cc4e | 63 | const int square_wav[6][28] = {//sub 3 sqr sprite |
lukeocarwright | 7:33cb5f2db1ee | 64 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 65 | { 1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1 }, |
lukeocarwright | 7:33cb5f2db1ee | 66 | { 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 67 | { 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 68 | { 0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 69 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 70 | }; |
lukeocarwright | 18:204cd747b54a | 71 | //Gloabal Variables |
lukeocarwright | 19:08862f49cd9e | 72 | volatile int g_isr_flag; //used for sound generation |
lukeocarwright | 19:08862f49cd9e | 73 | volatile extern int silent_flag; //used for note release |
lukeocarwright | 19:08862f49cd9e | 74 | |
lukeocarwright | 14:9cfe0041cc4e | 75 | |
lukeocarwright | 7:33cb5f2db1ee | 76 | //constructor/destructor |
lukeocarwright | 7:33cb5f2db1ee | 77 | Front::Front() |
lukeocarwright | 7:33cb5f2db1ee | 78 | { |
lukeocarwright | 7:33cb5f2db1ee | 79 | } |
lukeocarwright | 7:33cb5f2db1ee | 80 | Front::~Front() |
lukeocarwright | 7:33cb5f2db1ee | 81 | { |
lukeocarwright | 7:33cb5f2db1ee | 82 | } |
lukeocarwright | 7:33cb5f2db1ee | 83 | //PUBLIC------------------------------------------------------------------------ |
lukeocarwright | 8:f305ea78b2b1 | 84 | |
lukeocarwright | 8:f305ea78b2b1 | 85 | void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu) |
lukeocarwright | 18:204cd747b54a | 86 | { |
lukeocarwright | 19:08862f49cd9e | 87 | //printf("G_ISR_FLAG= %d\n",g_isr_flag); //DEBUG |
lukeocarwright | 19:08862f49cd9e | 88 | frontsetup(lcd, pad, submenu, true); //Initialises front pannel display |
lukeocarwright | 19:08862f49cd9e | 89 | menuflag=1; //sets up flags |
lukeocarwright | 19:08862f49cd9e | 90 | release_flag=silent_flag=0; |
lukeocarwright | 19:08862f49cd9e | 91 | used=1; //initialises vairables |
lukeocarwright | 19:08862f49cd9e | 92 | envelope_in=0; |
lukeocarwright | 19:08862f49cd9e | 93 | a=d=s=r=17; //starting adsr values (1->35) |
lukeocarwright | 19:08862f49cd9e | 94 | noteon=false; |
lukeocarwright | 19:08862f49cd9e | 95 | printsliders(lcd,a,d,s,r,1); //prints initialsliders |
lukeocarwright | 19:08862f49cd9e | 96 | out=sound.sound_main(true,submenu,440); //initialises external variables |
lukeocarwright | 18:204cd747b54a | 97 | out=envelope.env_in(a,d,s,r,out,true); |
lukeocarwright | 19:08862f49cd9e | 98 | out=envelope.release(s,r,out,true); |
lukeocarwright | 18:204cd747b54a | 99 | pad.reset_buttons(); |
lukeocarwright | 19:08862f49cd9e | 100 | #ifdef CSV |
lukeocarwright | 19:08862f49cd9e | 101 | itterator=0; //sets itterator for CSV OUTPUT |
lukeocarwright | 19:08862f49cd9e | 102 | #endif |
lukeocarwright | 18:204cd747b54a | 103 | |
lukeocarwright | 8:f305ea78b2b1 | 104 | while (menuflag==1) { |
lukeocarwright | 18:204cd747b54a | 105 | #ifdef SLOW_TIME |
lukeocarwright | 19:08862f49cd9e | 106 | print_SLOWTIME_out(out,noteon,a,d,s,r,release_flag,silent_flag); |
lukeocarwright | 18:204cd747b54a | 107 | #endif |
lukeocarwright | 19:08862f49cd9e | 108 | if (noteon==true && g_isr_flag == 1) { |
lukeocarwright | 19:08862f49cd9e | 109 | pad.write_u16(out); |
lukeocarwright | 19:08862f49cd9e | 110 | envelope_in=(sound.sound_main(false,submenu,440)-32767); //value around 0 |
lukeocarwright | 19:08862f49cd9e | 111 | if (release_flag==0) { |
lukeocarwright | 19:08862f49cd9e | 112 | out=(envelope.env_in(a,d,s,r,envelope_in,false));//value around 32767 |
lukeocarwright | 19:08862f49cd9e | 113 | //out=envelope_in+32767; |
lukeocarwright | 19:08862f49cd9e | 114 | } else { |
lukeocarwright | 19:08862f49cd9e | 115 | out=envelope.release(s,r,envelope_in,false); |
lukeocarwright | 19:08862f49cd9e | 116 | if (silent_flag==1) { |
lukeocarwright | 19:08862f49cd9e | 117 | release_flag=0; |
lukeocarwright | 19:08862f49cd9e | 118 | silent_flag=0; |
lukeocarwright | 19:08862f49cd9e | 119 | noteon=false; |
lukeocarwright | 19:08862f49cd9e | 120 | out=envelope.env_in(a,d,s,r,out,true); |
lukeocarwright | 19:08862f49cd9e | 121 | out=0; |
lukeocarwright | 19:08862f49cd9e | 122 | } |
lukeocarwright | 19:08862f49cd9e | 123 | } |
lukeocarwright | 19:08862f49cd9e | 124 | g_isr_flag=0; |
lukeocarwright | 18:204cd747b54a | 125 | #ifdef CSV |
lukeocarwright | 19:08862f49cd9e | 126 | printf("%d,%d\n",itterator,out); |
lukeocarwright | 19:08862f49cd9e | 127 | itterator++; |
lukeocarwright | 18:204cd747b54a | 128 | #endif |
lukeocarwright | 18:204cd747b54a | 129 | } |
lukeocarwright | 13:27300c533dd1 | 130 | dir=pad.get_direction(); |
lukeocarwright | 13:27300c533dd1 | 131 | if (dir!=dir_1) { |
lukeocarwright | 13:27300c533dd1 | 132 | printf("dir =%d\n",dir); //debug |
lukeocarwright | 13:27300c533dd1 | 133 | if(dir==3) { |
lukeocarwright | 13:27300c533dd1 | 134 | used++; |
lukeocarwright | 13:27300c533dd1 | 135 | if (used>4) { |
lukeocarwright | 13:27300c533dd1 | 136 | used=4; |
lukeocarwright | 13:27300c533dd1 | 137 | } |
lukeocarwright | 13:27300c533dd1 | 138 | } |
lukeocarwright | 13:27300c533dd1 | 139 | if (dir==7) { |
lukeocarwright | 13:27300c533dd1 | 140 | used--; |
lukeocarwright | 13:27300c533dd1 | 141 | if(used<1) { |
lukeocarwright | 13:27300c533dd1 | 142 | used=1; |
lukeocarwright | 13:27300c533dd1 | 143 | } |
lukeocarwright | 13:27300c533dd1 | 144 | } |
lukeocarwright | 13:27300c533dd1 | 145 | if (dir==1) { |
lukeocarwright | 13:27300c533dd1 | 146 | if (used==1) { |
lukeocarwright | 13:27300c533dd1 | 147 | a=incrament_adsr(used,a,1); |
lukeocarwright | 13:27300c533dd1 | 148 | } |
lukeocarwright | 13:27300c533dd1 | 149 | if (used==2) { |
lukeocarwright | 13:27300c533dd1 | 150 | d=incrament_adsr(used,d,1); |
lukeocarwright | 13:27300c533dd1 | 151 | } |
lukeocarwright | 13:27300c533dd1 | 152 | if (used==3) { |
lukeocarwright | 13:27300c533dd1 | 153 | s=incrament_adsr(used,s,1); |
lukeocarwright | 13:27300c533dd1 | 154 | } |
lukeocarwright | 13:27300c533dd1 | 155 | if (used==4) { |
lukeocarwright | 13:27300c533dd1 | 156 | r=incrament_adsr(used,r,1); |
lukeocarwright | 13:27300c533dd1 | 157 | } |
lukeocarwright | 13:27300c533dd1 | 158 | } |
lukeocarwright | 13:27300c533dd1 | 159 | |
lukeocarwright | 13:27300c533dd1 | 160 | if (dir==5) { |
lukeocarwright | 13:27300c533dd1 | 161 | if (used==1) { |
lukeocarwright | 13:27300c533dd1 | 162 | a=incrament_adsr(used,a,-1); |
lukeocarwright | 13:27300c533dd1 | 163 | } |
lukeocarwright | 13:27300c533dd1 | 164 | if (used==2) { |
lukeocarwright | 13:27300c533dd1 | 165 | d=incrament_adsr(used,d,-1); |
lukeocarwright | 13:27300c533dd1 | 166 | } |
lukeocarwright | 13:27300c533dd1 | 167 | if (used==3) { |
lukeocarwright | 13:27300c533dd1 | 168 | s=incrament_adsr(used,s,-1); |
lukeocarwright | 13:27300c533dd1 | 169 | } |
lukeocarwright | 13:27300c533dd1 | 170 | if (used==4) { |
lukeocarwright | 13:27300c533dd1 | 171 | r=incrament_adsr(used,r,-1); |
lukeocarwright | 13:27300c533dd1 | 172 | } |
lukeocarwright | 13:27300c533dd1 | 173 | } |
lukeocarwright | 13:27300c533dd1 | 174 | frontsetup(lcd,pad,submenu,false); |
lukeocarwright | 13:27300c533dd1 | 175 | printsliders(lcd,a,d,s,r,used); |
lukeocarwright | 18:204cd747b54a | 176 | wait_ms(50); |
lukeocarwright | 18:204cd747b54a | 177 | } //END if DIR |
lukeocarwright | 18:204cd747b54a | 178 | if ( pad.A_pressed()) { //NOTE ON |
lukeocarwright | 18:204cd747b54a | 179 | printf("NOTE_ON\n"); |
lukeocarwright | 18:204cd747b54a | 180 | noteon=true; |
lukeocarwright | 18:204cd747b54a | 181 | out=envelope.env_in(a,d,s,r,out,true); |
lukeocarwright | 18:204cd747b54a | 182 | } |
lukeocarwright | 18:204cd747b54a | 183 | if ( pad.B_pressed()) { //NOTE OFF |
lukeocarwright | 19:08862f49cd9e | 184 | //printf("NOTE_OFF (W.release)\n"); |
lukeocarwright | 19:08862f49cd9e | 185 | release_flag=1; |
lukeocarwright | 19:08862f49cd9e | 186 | envelope_in=envelope.release(s,r,envelope_in,true); |
lukeocarwright | 19:08862f49cd9e | 187 | pad.reset_buttons(); |
lukeocarwright | 18:204cd747b54a | 188 | } |
lukeocarwright | 18:204cd747b54a | 189 | |
lukeocarwright | 18:204cd747b54a | 190 | if (pad.start_pressed()) { //go back menu |
lukeocarwright | 18:204cd747b54a | 191 | // printf("start pressed\n"); |
lukeocarwright | 18:204cd747b54a | 192 | printf("Waveforms Sub selected\n"); //debug |
lukeocarwright | 18:204cd747b54a | 193 | noteon=false; |
lukeocarwright | 18:204cd747b54a | 194 | menuflag=0; //sets flag |
lukeocarwright | 8:f305ea78b2b1 | 195 | } |
lukeocarwright | 13:27300c533dd1 | 196 | dir=dir_1; |
lukeocarwright | 19:08862f49cd9e | 197 | sleep(); //puts sleep until ISR wakes up |
lukeocarwright | 19:08862f49cd9e | 198 | } |
lukeocarwright | 8:f305ea78b2b1 | 199 | } |
lukeocarwright | 8:f305ea78b2b1 | 200 | |
lukeocarwright | 8:f305ea78b2b1 | 201 | //PRIVATE----------------------------------------------------------------------- |
lukeocarwright | 8:f305ea78b2b1 | 202 | |
lukeocarwright | 13:27300c533dd1 | 203 | void Front::frontsetup(N5110 &lcd, Gamepad &pad, int submenu, bool initial) |
lukeocarwright | 7:33cb5f2db1ee | 204 | { |
lukeocarwright | 13:27300c533dd1 | 205 | if (initial==true) { |
lukeocarwright | 13:27300c533dd1 | 206 | printsliders(lcd,17,17,17,17,1); |
lukeocarwright | 18:204cd747b54a | 207 | printf("front setup complete\n\n"); |
lukeocarwright | 13:27300c533dd1 | 208 | } |
lukeocarwright | 7:33cb5f2db1ee | 209 | lcd.clear(); |
lukeocarwright | 7:33cb5f2db1ee | 210 | lcd.printString("A D S R",3,5); |
lukeocarwright | 7:33cb5f2db1ee | 211 | printfader(lcd,3,3); |
lukeocarwright | 7:33cb5f2db1ee | 212 | printfader(lcd,15,3); |
lukeocarwright | 7:33cb5f2db1ee | 213 | printfader(lcd,27,3); |
lukeocarwright | 7:33cb5f2db1ee | 214 | printfader(lcd,39,3); |
lukeocarwright | 7:33cb5f2db1ee | 215 | lcd.drawRect(50,3,30,8,FILL_TRANSPARENT); |
lukeocarwright | 7:33cb5f2db1ee | 216 | printwav(lcd,submenu); |
lukeocarwright | 7:33cb5f2db1ee | 217 | lcd.refresh(); |
lukeocarwright | 15:1c67f064278e | 218 | } |
lukeocarwright | 13:27300c533dd1 | 219 | |
lukeocarwright | 13:27300c533dd1 | 220 | void Front::printsliders(N5110 &lcd, int a, int d, int s, int r, int used) |
lukeocarwright | 7:33cb5f2db1ee | 221 | { |
lukeocarwright | 13:27300c533dd1 | 222 | if(used==0) { |
lukeocarwright | 13:27300c533dd1 | 223 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 224 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 225 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 226 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 227 | } |
lukeocarwright | 13:27300c533dd1 | 228 | if(used==1) { |
lukeocarwright | 13:27300c533dd1 | 229 | printslider(lcd,3,a,true); |
lukeocarwright | 13:27300c533dd1 | 230 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 231 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 232 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 233 | } |
lukeocarwright | 13:27300c533dd1 | 234 | if(used==2) { |
lukeocarwright | 13:27300c533dd1 | 235 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 236 | printslider(lcd,15,d,true); |
lukeocarwright | 13:27300c533dd1 | 237 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 238 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 239 | } |
lukeocarwright | 13:27300c533dd1 | 240 | if(used==3) { |
lukeocarwright | 13:27300c533dd1 | 241 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 242 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 243 | printslider(lcd,27,s,true); |
lukeocarwright | 13:27300c533dd1 | 244 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 245 | } |
lukeocarwright | 13:27300c533dd1 | 246 | if(used==4) { |
lukeocarwright | 13:27300c533dd1 | 247 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 248 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 249 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 250 | printslider(lcd,39,r,true); |
lukeocarwright | 13:27300c533dd1 | 251 | } |
lukeocarwright | 13:27300c533dd1 | 252 | lcd.refresh(); |
lukeocarwright | 7:33cb5f2db1ee | 253 | } |
lukeocarwright | 13:27300c533dd1 | 254 | |
lukeocarwright | 13:27300c533dd1 | 255 | void Front::printslider(N5110 &lcd, int x_val, int y_val, bool use) |
lukeocarwright | 13:27300c533dd1 | 256 | { |
lukeocarwright | 13:27300c533dd1 | 257 | if (use==true) { |
lukeocarwright | 13:27300c533dd1 | 258 | lcd.drawRect(x_val,37-y_val,5,2,FILL_BLACK); |
lukeocarwright | 13:27300c533dd1 | 259 | } |
lukeocarwright | 13:27300c533dd1 | 260 | if (use==false) { |
lukeocarwright | 13:27300c533dd1 | 261 | lcd.drawRect(x_val,37-y_val,5,1,FILL_BLACK); |
lukeocarwright | 13:27300c533dd1 | 262 | } |
lukeocarwright | 13:27300c533dd1 | 263 | } |
lukeocarwright | 13:27300c533dd1 | 264 | |
lukeocarwright | 13:27300c533dd1 | 265 | |
lukeocarwright | 7:33cb5f2db1ee | 266 | void Front::printfader(N5110 &lcd, int x, int y) |
lukeocarwright | 7:33cb5f2db1ee | 267 | { |
lukeocarwright | 7:33cb5f2db1ee | 268 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 269 | lcd.drawSprite(x,y,35,5,(int *)fader); |
lukeocarwright | 7:33cb5f2db1ee | 270 | } |
lukeocarwright | 7:33cb5f2db1ee | 271 | |
lukeocarwright | 7:33cb5f2db1ee | 272 | void Front::printwav(N5110 &lcd, int submenu) |
lukeocarwright | 7:33cb5f2db1ee | 273 | { |
lukeocarwright | 7:33cb5f2db1ee | 274 | if (submenu==1) { |
lukeocarwright | 7:33cb5f2db1ee | 275 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 276 | lcd.drawSprite(51,4,6,28,(int *)sin_wav); |
lukeocarwright | 7:33cb5f2db1ee | 277 | } |
lukeocarwright | 7:33cb5f2db1ee | 278 | if (submenu==2) { |
lukeocarwright | 7:33cb5f2db1ee | 279 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 280 | lcd.drawSprite(51,4,6,28,(int *)tri_wav); |
lukeocarwright | 7:33cb5f2db1ee | 281 | } |
lukeocarwright | 7:33cb5f2db1ee | 282 | if (submenu==3) { |
lukeocarwright | 7:33cb5f2db1ee | 283 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 284 | lcd.drawSprite(51,4,6,28,(int *)square_wav); |
lukeocarwright | 7:33cb5f2db1ee | 285 | } |
lukeocarwright | 13:27300c533dd1 | 286 | } |
lukeocarwright | 13:27300c533dd1 | 287 | |
lukeocarwright | 13:27300c533dd1 | 288 | int Front::incrament_adsr(int used, int adsr, int ud) |
lukeocarwright | 13:27300c533dd1 | 289 | { |
lukeocarwright | 13:27300c533dd1 | 290 | if (ud==1) { |
lukeocarwright | 13:27300c533dd1 | 291 | adsr++; |
lukeocarwright | 13:27300c533dd1 | 292 | if (adsr>35) { |
lukeocarwright | 13:27300c533dd1 | 293 | adsr--; |
lukeocarwright | 13:27300c533dd1 | 294 | } |
lukeocarwright | 13:27300c533dd1 | 295 | } |
lukeocarwright | 13:27300c533dd1 | 296 | if (ud==-1) { |
lukeocarwright | 13:27300c533dd1 | 297 | adsr--; |
lukeocarwright | 13:27300c533dd1 | 298 | if (adsr<1) { |
lukeocarwright | 13:27300c533dd1 | 299 | adsr++; |
lukeocarwright | 13:27300c533dd1 | 300 | } |
lukeocarwright | 13:27300c533dd1 | 301 | } |
lukeocarwright | 13:27300c533dd1 | 302 | return(adsr); |
lukeocarwright | 19:08862f49cd9e | 303 | } |
lukeocarwright | 19:08862f49cd9e | 304 | |
lukeocarwright | 19:08862f49cd9e | 305 | #ifdef SLOW_TIME |
lukeocarwright | 19:08862f49cd9e | 306 | void Front::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 | 307 | { |
lukeocarwright | 19:08862f49cd9e | 308 | //Prints all data required in SLOW_TIME |
lukeocarwright | 19:08862f49cd9e | 309 | printf("OUTPUT:%d\n",out); |
lukeocarwright | 19:08862f49cd9e | 310 | printf("NOTEON: %d\n",noteon); |
lukeocarwright | 19:08862f49cd9e | 311 | printf("A:%d,D:%d,S:%d,R:%d\n",a,d,s,r); |
lukeocarwright | 19:08862f49cd9e | 312 | printf("RelFlag=%d, SilFlag=%d\n\n",release_flag,silent_flag); |
lukeocarwright | 19:08862f49cd9e | 313 | } |
lukeocarwright | 19:08862f49cd9e | 314 | #endif |