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.
Front/Front.cpp@27:da783f414f67, 2020-05-24 (annotated)
- Committer:
- lukeocarwright
- Date:
- Sun May 24 21:13:36 2020 +0000
- Revision:
- 27:da783f414f67
- Parent:
- 26:a6033830d01c
- Child:
- 28:eb0f12304a45
Added X and Y buttons to select ocatve
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 | 24:c3bb1b0b2207 | 7 | Filter filter; |
lukeocarwright | 14:9cfe0041cc4e | 8 | |
lukeocarwright | 14:9cfe0041cc4e | 9 | //Sprites----------------------------------------------------------------------- |
lukeocarwright | 19:08862f49cd9e | 10 | const int fader[35][5] = { //Fader Sprite |
lukeocarwright | 7:33cb5f2db1ee | 11 | { 1,1,1,1,1 }, |
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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 16 | { 1,1,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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 21 | { 1,1,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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 26 | { 1,1,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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 31 | { 1,1,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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 36 | { 1,1,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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 41 | { 1,1,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 | { 0,0,1,0,0 }, |
lukeocarwright | 7:33cb5f2db1ee | 45 | { 1,1,1,1,1 }, |
lukeocarwright | 7:33cb5f2db1ee | 46 | }; |
lukeocarwright | 7:33cb5f2db1ee | 47 | |
lukeocarwright | 14:9cfe0041cc4e | 48 | const int sin_wav[6][28] = {//sub 1 sin sprite |
lukeocarwright | 7:33cb5f2db1ee | 49 | { 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 | 50 | { 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 | 51 | { 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 | 52 | { 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 | 53 | { 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 | 54 | { 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 | 55 | }; |
lukeocarwright | 14:9cfe0041cc4e | 56 | const int tri_wav[6][28] = {//sub 2 tri sprite |
lukeocarwright | 7:33cb5f2db1ee | 57 | { 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 | 58 | { 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 | 59 | { 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 | 60 | { 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 | 61 | { 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 | 62 | { 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 | 63 | }; |
lukeocarwright | 14:9cfe0041cc4e | 64 | const int square_wav[6][28] = {//sub 3 sqr sprite |
lukeocarwright | 7:33cb5f2db1ee | 65 | { 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 | 66 | { 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 | 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,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 | 69 | { 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 | 70 | { 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 | 71 | }; |
lukeocarwright | 25:f230af268e8b | 72 | |
lukeocarwright | 25:f230af268e8b | 73 | const int Low_pass[19][29]= {//LPF plot |
lukeocarwright | 25:f230af268e8b | 74 | { 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,0 }, |
lukeocarwright | 25:f230af268e8b | 75 | { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 76 | { 0,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 | 25:f230af268e8b | 77 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 78 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 79 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 80 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 81 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 82 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 83 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 84 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 85 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 86 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 87 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 88 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 89 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 90 | { 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,1,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 91 | { 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,1,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 92 | { 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,1,1,0,0 }, |
lukeocarwright | 25:f230af268e8b | 93 | }; |
lukeocarwright | 25:f230af268e8b | 94 | |
lukeocarwright | 25:f230af268e8b | 95 | const int High_pass[19][29]= {//HPF plot |
lukeocarwright | 25:f230af268e8b | 96 | { 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,0 }, |
lukeocarwright | 25:f230af268e8b | 97 | { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, |
lukeocarwright | 25:f230af268e8b | 98 | { 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,0 }, |
lukeocarwright | 25:f230af268e8b | 99 | { 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,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 100 | { 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 101 | { 0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 102 | { 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 103 | { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 104 | { 0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 105 | { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 106 | { 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 107 | { 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 108 | { 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 109 | { 0,0,0,0,1,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 | 25:f230af268e8b | 110 | { 0,0,0,0,1,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 | 25:f230af268e8b | 111 | { 0,0,0,1,1,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 | 25:f230af268e8b | 112 | { 0,0,0,1,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 | 25:f230af268e8b | 113 | { 0,0,0,1,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 | 25:f230af268e8b | 114 | { 0,0,1,1,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 | 25:f230af268e8b | 115 | }; |
lukeocarwright | 25:f230af268e8b | 116 | |
lukeocarwright | 25:f230af268e8b | 117 | const int Band_pass[19][29]= {//BPF plot |
lukeocarwright | 25:f230af268e8b | 118 | { 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,0 }, |
lukeocarwright | 25:f230af268e8b | 119 | { 0,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 | 25:f230af268e8b | 120 | { 0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 121 | { 0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 122 | { 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 123 | { 0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 124 | { 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 125 | { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 126 | { 0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 127 | { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 128 | { 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 129 | { 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 130 | { 0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 131 | { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 132 | { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 133 | { 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 134 | { 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 135 | { 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 }, |
lukeocarwright | 25:f230af268e8b | 136 | { 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 }, |
lukeocarwright | 25:f230af268e8b | 137 | }; |
lukeocarwright | 25:f230af268e8b | 138 | |
lukeocarwright | 18:204cd747b54a | 139 | //Gloabal Variables |
lukeocarwright | 19:08862f49cd9e | 140 | volatile int g_isr_flag; //used for sound generation |
lukeocarwright | 24:c3bb1b0b2207 | 141 | volatile extern int silent_flag; //used for note release |
lukeocarwright | 19:08862f49cd9e | 142 | |
lukeocarwright | 14:9cfe0041cc4e | 143 | |
lukeocarwright | 7:33cb5f2db1ee | 144 | //constructor/destructor |
lukeocarwright | 7:33cb5f2db1ee | 145 | Front::Front() |
lukeocarwright | 7:33cb5f2db1ee | 146 | { |
lukeocarwright | 7:33cb5f2db1ee | 147 | } |
lukeocarwright | 7:33cb5f2db1ee | 148 | Front::~Front() |
lukeocarwright | 7:33cb5f2db1ee | 149 | { |
lukeocarwright | 7:33cb5f2db1ee | 150 | } |
lukeocarwright | 7:33cb5f2db1ee | 151 | //PUBLIC------------------------------------------------------------------------ |
lukeocarwright | 8:f305ea78b2b1 | 152 | |
lukeocarwright | 8:f305ea78b2b1 | 153 | void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu) |
lukeocarwright | 18:204cd747b54a | 154 | { |
lukeocarwright | 19:08862f49cd9e | 155 | //printf("G_ISR_FLAG= %d\n",g_isr_flag); //DEBUG |
lukeocarwright | 25:f230af268e8b | 156 | frontsetup(lcd, pad, submenu,0, true); //Initialises front pannel display |
lukeocarwright | 24:c3bb1b0b2207 | 157 | initialise(pad,lcd,submenu); |
lukeocarwright | 24:c3bb1b0b2207 | 158 | frequency=frequency_convert(pad); |
lukeocarwright | 19:08862f49cd9e | 159 | menuflag=1; //sets up flags |
lukeocarwright | 19:08862f49cd9e | 160 | release_flag=silent_flag=0; |
lukeocarwright | 19:08862f49cd9e | 161 | used=1; //initialises vairables |
lukeocarwright | 25:f230af268e8b | 162 | filter_type=envelope_in=0; |
lukeocarwright | 19:08862f49cd9e | 163 | a=d=s=r=17; //starting adsr values (1->35) |
lukeocarwright | 19:08862f49cd9e | 164 | noteon=false; |
lukeocarwright | 19:08862f49cd9e | 165 | #ifdef CSV |
lukeocarwright | 19:08862f49cd9e | 166 | itterator=0; //sets itterator for CSV OUTPUT |
lukeocarwright | 19:08862f49cd9e | 167 | #endif |
lukeocarwright | 18:204cd747b54a | 168 | |
lukeocarwright | 8:f305ea78b2b1 | 169 | while (menuflag==1) { |
lukeocarwright | 18:204cd747b54a | 170 | #ifdef SLOW_TIME |
lukeocarwright | 19:08862f49cd9e | 171 | print_SLOWTIME_out(out,noteon,a,d,s,r,release_flag,silent_flag); |
lukeocarwright | 18:204cd747b54a | 172 | #endif |
lukeocarwright | 19:08862f49cd9e | 173 | if (noteon==true && g_isr_flag == 1) { |
lukeocarwright | 19:08862f49cd9e | 174 | pad.write_u16(out); |
lukeocarwright | 27:da783f414f67 | 175 | envelope_in=(sound.sound_main(false,submenu,frequency)-32767); //int around 0 |
lukeocarwright | 27:da783f414f67 | 176 | envelope_in=filter.filter_run(envelope_in,filter_type,false); |
lukeocarwright | 19:08862f49cd9e | 177 | if (release_flag==0) { |
lukeocarwright | 27:da783f414f67 | 178 | out=(envelope.env_in(a,d,s,r,envelope_in,false));//Uint around 32767 |
lukeocarwright | 19:08862f49cd9e | 179 | } else { |
lukeocarwright | 19:08862f49cd9e | 180 | out=envelope.release(s,r,envelope_in,false); |
lukeocarwright | 19:08862f49cd9e | 181 | if (silent_flag==1) { |
lukeocarwright | 19:08862f49cd9e | 182 | release_flag=0; |
lukeocarwright | 19:08862f49cd9e | 183 | silent_flag=0; |
lukeocarwright | 19:08862f49cd9e | 184 | noteon=false; |
lukeocarwright | 19:08862f49cd9e | 185 | out=envelope.env_in(a,d,s,r,out,true); |
lukeocarwright | 19:08862f49cd9e | 186 | out=0; |
lukeocarwright | 19:08862f49cd9e | 187 | } |
lukeocarwright | 19:08862f49cd9e | 188 | } |
lukeocarwright | 19:08862f49cd9e | 189 | g_isr_flag=0; |
lukeocarwright | 18:204cd747b54a | 190 | #ifdef CSV |
lukeocarwright | 19:08862f49cd9e | 191 | printf("%d,%d\n",itterator,out); |
lukeocarwright | 19:08862f49cd9e | 192 | itterator++; |
lukeocarwright | 18:204cd747b54a | 193 | #endif |
lukeocarwright | 18:204cd747b54a | 194 | } |
lukeocarwright | 13:27300c533dd1 | 195 | dir=pad.get_direction(); |
lukeocarwright | 13:27300c533dd1 | 196 | if (dir!=dir_1) { |
lukeocarwright | 13:27300c533dd1 | 197 | printf("dir =%d\n",dir); //debug |
lukeocarwright | 25:f230af268e8b | 198 | //used=parameter_manager(pad,dir,a,d,s,r); |
lukeocarwright | 13:27300c533dd1 | 199 | if(dir==3) { |
lukeocarwright | 13:27300c533dd1 | 200 | used++; |
lukeocarwright | 25:f230af268e8b | 201 | if (used>5) { |
lukeocarwright | 25:f230af268e8b | 202 | used=5; |
lukeocarwright | 13:27300c533dd1 | 203 | } |
lukeocarwright | 13:27300c533dd1 | 204 | } |
lukeocarwright | 13:27300c533dd1 | 205 | if (dir==7) { |
lukeocarwright | 13:27300c533dd1 | 206 | used--; |
lukeocarwright | 13:27300c533dd1 | 207 | if(used<1) { |
lukeocarwright | 13:27300c533dd1 | 208 | used=1; |
lukeocarwright | 13:27300c533dd1 | 209 | } |
lukeocarwright | 13:27300c533dd1 | 210 | } |
lukeocarwright | 13:27300c533dd1 | 211 | if (dir==1) { |
lukeocarwright | 13:27300c533dd1 | 212 | if (used==1) { |
lukeocarwright | 13:27300c533dd1 | 213 | a=incrament_adsr(used,a,1); |
lukeocarwright | 13:27300c533dd1 | 214 | } |
lukeocarwright | 13:27300c533dd1 | 215 | if (used==2) { |
lukeocarwright | 13:27300c533dd1 | 216 | d=incrament_adsr(used,d,1); |
lukeocarwright | 13:27300c533dd1 | 217 | } |
lukeocarwright | 13:27300c533dd1 | 218 | if (used==3) { |
lukeocarwright | 13:27300c533dd1 | 219 | s=incrament_adsr(used,s,1); |
lukeocarwright | 13:27300c533dd1 | 220 | } |
lukeocarwright | 13:27300c533dd1 | 221 | if (used==4) { |
lukeocarwright | 13:27300c533dd1 | 222 | r=incrament_adsr(used,r,1); |
lukeocarwright | 13:27300c533dd1 | 223 | } |
lukeocarwright | 26:a6033830d01c | 224 | if (used==5) { |
lukeocarwright | 26:a6033830d01c | 225 | filter_type=incrament_adsr(used,filter_type,-1); |
lukeocarwright | 26:a6033830d01c | 226 | printf("FILTER_TYPE=%d\n",filter_type); |
lukeocarwright | 26:a6033830d01c | 227 | } |
lukeocarwright | 13:27300c533dd1 | 228 | } |
lukeocarwright | 13:27300c533dd1 | 229 | |
lukeocarwright | 13:27300c533dd1 | 230 | if (dir==5) { |
lukeocarwright | 13:27300c533dd1 | 231 | if (used==1) { |
lukeocarwright | 13:27300c533dd1 | 232 | a=incrament_adsr(used,a,-1); |
lukeocarwright | 13:27300c533dd1 | 233 | } |
lukeocarwright | 13:27300c533dd1 | 234 | if (used==2) { |
lukeocarwright | 13:27300c533dd1 | 235 | d=incrament_adsr(used,d,-1); |
lukeocarwright | 13:27300c533dd1 | 236 | } |
lukeocarwright | 13:27300c533dd1 | 237 | if (used==3) { |
lukeocarwright | 13:27300c533dd1 | 238 | s=incrament_adsr(used,s,-1); |
lukeocarwright | 13:27300c533dd1 | 239 | } |
lukeocarwright | 13:27300c533dd1 | 240 | if (used==4) { |
lukeocarwright | 13:27300c533dd1 | 241 | r=incrament_adsr(used,r,-1); |
lukeocarwright | 13:27300c533dd1 | 242 | } |
lukeocarwright | 26:a6033830d01c | 243 | if (used==5) { |
lukeocarwright | 26:a6033830d01c | 244 | filter_type=incrament_adsr(used,filter_type,1); |
lukeocarwright | 26:a6033830d01c | 245 | printf("FILTER_TYPE=%d\n",filter_type); |
lukeocarwright | 26:a6033830d01c | 246 | } |
lukeocarwright | 13:27300c533dd1 | 247 | } |
lukeocarwright | 25:f230af268e8b | 248 | frontsetup(lcd,pad,submenu,filter_type,false); |
lukeocarwright | 13:27300c533dd1 | 249 | printsliders(lcd,a,d,s,r,used); |
lukeocarwright | 26:a6033830d01c | 250 | wait_ms(80); |
lukeocarwright | 18:204cd747b54a | 251 | } //END if DIR |
lukeocarwright | 18:204cd747b54a | 252 | if ( pad.A_pressed()) { //NOTE ON |
lukeocarwright | 18:204cd747b54a | 253 | printf("NOTE_ON\n"); |
lukeocarwright | 18:204cd747b54a | 254 | noteon=true; |
lukeocarwright | 18:204cd747b54a | 255 | out=envelope.env_in(a,d,s,r,out,true); |
lukeocarwright | 24:c3bb1b0b2207 | 256 | frequency=frequency_convert(pad); |
lukeocarwright | 18:204cd747b54a | 257 | } |
lukeocarwright | 18:204cd747b54a | 258 | if ( pad.B_pressed()) { //NOTE OFF |
lukeocarwright | 19:08862f49cd9e | 259 | //printf("NOTE_OFF (W.release)\n"); |
lukeocarwright | 19:08862f49cd9e | 260 | release_flag=1; |
lukeocarwright | 19:08862f49cd9e | 261 | envelope_in=envelope.release(s,r,envelope_in,true); |
lukeocarwright | 19:08862f49cd9e | 262 | pad.reset_buttons(); |
lukeocarwright | 18:204cd747b54a | 263 | } |
lukeocarwright | 27:da783f414f67 | 264 | if ( pad.X_pressed()) { |
lukeocarwright | 27:da783f414f67 | 265 | printf("X\n"); |
lukeocarwright | 27:da783f414f67 | 266 | pad.reset_buttons(); |
lukeocarwright | 27:da783f414f67 | 267 | } |
lukeocarwright | 27:da783f414f67 | 268 | if ( pad.Y_pressed()) { |
lukeocarwright | 27:da783f414f67 | 269 | printf("Y\n"); |
lukeocarwright | 27:da783f414f67 | 270 | pad.reset_buttons(); |
lukeocarwright | 27:da783f414f67 | 271 | } |
lukeocarwright | 18:204cd747b54a | 272 | |
lukeocarwright | 18:204cd747b54a | 273 | if (pad.start_pressed()) { //go back menu |
lukeocarwright | 18:204cd747b54a | 274 | // printf("start pressed\n"); |
lukeocarwright | 18:204cd747b54a | 275 | printf("Waveforms Sub selected\n"); //debug |
lukeocarwright | 18:204cd747b54a | 276 | noteon=false; |
lukeocarwright | 18:204cd747b54a | 277 | menuflag=0; //sets flag |
lukeocarwright | 8:f305ea78b2b1 | 278 | } |
lukeocarwright | 13:27300c533dd1 | 279 | dir=dir_1; |
lukeocarwright | 19:08862f49cd9e | 280 | sleep(); //puts sleep until ISR wakes up |
lukeocarwright | 19:08862f49cd9e | 281 | } |
lukeocarwright | 8:f305ea78b2b1 | 282 | } |
lukeocarwright | 8:f305ea78b2b1 | 283 | |
lukeocarwright | 8:f305ea78b2b1 | 284 | //PRIVATE----------------------------------------------------------------------- |
lukeocarwright | 8:f305ea78b2b1 | 285 | |
lukeocarwright | 25:f230af268e8b | 286 | void Front::frontsetup(N5110 &lcd, Gamepad &pad, int submenu, int filter_type, bool initial) |
lukeocarwright | 7:33cb5f2db1ee | 287 | { |
lukeocarwright | 13:27300c533dd1 | 288 | if (initial==true) { |
lukeocarwright | 13:27300c533dd1 | 289 | printsliders(lcd,17,17,17,17,1); |
lukeocarwright | 18:204cd747b54a | 290 | printf("front setup complete\n\n"); |
lukeocarwright | 25:f230af268e8b | 291 | |
lukeocarwright | 13:27300c533dd1 | 292 | } |
lukeocarwright | 7:33cb5f2db1ee | 293 | lcd.clear(); |
lukeocarwright | 7:33cb5f2db1ee | 294 | lcd.printString("A D S R",3,5); |
lukeocarwright | 7:33cb5f2db1ee | 295 | printfader(lcd,3,3); |
lukeocarwright | 7:33cb5f2db1ee | 296 | printfader(lcd,15,3); |
lukeocarwright | 7:33cb5f2db1ee | 297 | printfader(lcd,27,3); |
lukeocarwright | 7:33cb5f2db1ee | 298 | printfader(lcd,39,3); |
lukeocarwright | 7:33cb5f2db1ee | 299 | lcd.drawRect(50,3,30,8,FILL_TRANSPARENT); |
lukeocarwright | 7:33cb5f2db1ee | 300 | printwav(lcd,submenu); |
lukeocarwright | 26:a6033830d01c | 301 | printfilter(lcd, filter_type); |
lukeocarwright | 7:33cb5f2db1ee | 302 | lcd.refresh(); |
lukeocarwright | 15:1c67f064278e | 303 | } |
lukeocarwright | 13:27300c533dd1 | 304 | |
lukeocarwright | 24:c3bb1b0b2207 | 305 | void Front::initialise(Gamepad &pad, N5110 &lcd, int submenu) |
lukeocarwright | 24:c3bb1b0b2207 | 306 | { |
lukeocarwright | 24:c3bb1b0b2207 | 307 | out=sound.sound_main(true,submenu,440); //initialises external variables |
lukeocarwright | 27:da783f414f67 | 308 | out = filter.filter_run(out,1,true); //initialises LPF Filter |
lukeocarwright | 27:da783f414f67 | 309 | out = filter.filter_run(out,2,true); //initialises LPF Filter |
lukeocarwright | 27:da783f414f67 | 310 | out = filter.filter_run(out,3,true); //initialises LPF Filter |
lukeocarwright | 24:c3bb1b0b2207 | 311 | out=envelope.env_in(17,17,17,17,out,true); |
lukeocarwright | 24:c3bb1b0b2207 | 312 | out=envelope.release(17,17,out,true); |
lukeocarwright | 24:c3bb1b0b2207 | 313 | printsliders(lcd,17,17,17,17,1); //prints initialsliders |
lukeocarwright | 24:c3bb1b0b2207 | 314 | pad.reset_buttons(); |
lukeocarwright | 24:c3bb1b0b2207 | 315 | } |
lukeocarwright | 24:c3bb1b0b2207 | 316 | |
lukeocarwright | 13:27300c533dd1 | 317 | void Front::printsliders(N5110 &lcd, int a, int d, int s, int r, int used) |
lukeocarwright | 7:33cb5f2db1ee | 318 | { |
lukeocarwright | 13:27300c533dd1 | 319 | if(used==0) { |
lukeocarwright | 13:27300c533dd1 | 320 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 321 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 322 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 323 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 324 | } |
lukeocarwright | 13:27300c533dd1 | 325 | if(used==1) { |
lukeocarwright | 13:27300c533dd1 | 326 | printslider(lcd,3,a,true); |
lukeocarwright | 13:27300c533dd1 | 327 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 328 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 329 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 330 | } |
lukeocarwright | 13:27300c533dd1 | 331 | if(used==2) { |
lukeocarwright | 13:27300c533dd1 | 332 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 333 | printslider(lcd,15,d,true); |
lukeocarwright | 13:27300c533dd1 | 334 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 335 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 336 | } |
lukeocarwright | 13:27300c533dd1 | 337 | if(used==3) { |
lukeocarwright | 13:27300c533dd1 | 338 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 339 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 340 | printslider(lcd,27,s,true); |
lukeocarwright | 13:27300c533dd1 | 341 | printslider(lcd,39,r,false); |
lukeocarwright | 13:27300c533dd1 | 342 | } |
lukeocarwright | 13:27300c533dd1 | 343 | if(used==4) { |
lukeocarwright | 13:27300c533dd1 | 344 | printslider(lcd,3,a,false); |
lukeocarwright | 13:27300c533dd1 | 345 | printslider(lcd,15,d,false); |
lukeocarwright | 13:27300c533dd1 | 346 | printslider(lcd,27,s,false); |
lukeocarwright | 13:27300c533dd1 | 347 | printslider(lcd,39,r,true); |
lukeocarwright | 13:27300c533dd1 | 348 | } |
lukeocarwright | 25:f230af268e8b | 349 | if(used>=5) { |
lukeocarwright | 25:f230af268e8b | 350 | printslider(lcd,3,a,false); |
lukeocarwright | 25:f230af268e8b | 351 | printslider(lcd,15,d,false); |
lukeocarwright | 25:f230af268e8b | 352 | printslider(lcd,27,s,false); |
lukeocarwright | 25:f230af268e8b | 353 | printslider(lcd,39,r,false); |
lukeocarwright | 26:a6033830d01c | 354 | } |
lukeocarwright | 13:27300c533dd1 | 355 | lcd.refresh(); |
lukeocarwright | 7:33cb5f2db1ee | 356 | } |
lukeocarwright | 13:27300c533dd1 | 357 | |
lukeocarwright | 13:27300c533dd1 | 358 | void Front::printslider(N5110 &lcd, int x_val, int y_val, bool use) |
lukeocarwright | 13:27300c533dd1 | 359 | { |
lukeocarwright | 13:27300c533dd1 | 360 | if (use==true) { |
lukeocarwright | 13:27300c533dd1 | 361 | lcd.drawRect(x_val,37-y_val,5,2,FILL_BLACK); |
lukeocarwright | 13:27300c533dd1 | 362 | } |
lukeocarwright | 13:27300c533dd1 | 363 | if (use==false) { |
lukeocarwright | 13:27300c533dd1 | 364 | lcd.drawRect(x_val,37-y_val,5,1,FILL_BLACK); |
lukeocarwright | 13:27300c533dd1 | 365 | } |
lukeocarwright | 13:27300c533dd1 | 366 | } |
lukeocarwright | 13:27300c533dd1 | 367 | |
lukeocarwright | 13:27300c533dd1 | 368 | |
lukeocarwright | 7:33cb5f2db1ee | 369 | void Front::printfader(N5110 &lcd, int x, int y) |
lukeocarwright | 7:33cb5f2db1ee | 370 | { |
lukeocarwright | 7:33cb5f2db1ee | 371 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 372 | lcd.drawSprite(x,y,35,5,(int *)fader); |
lukeocarwright | 7:33cb5f2db1ee | 373 | } |
lukeocarwright | 7:33cb5f2db1ee | 374 | |
lukeocarwright | 7:33cb5f2db1ee | 375 | void Front::printwav(N5110 &lcd, int submenu) |
lukeocarwright | 7:33cb5f2db1ee | 376 | { |
lukeocarwright | 7:33cb5f2db1ee | 377 | if (submenu==1) { |
lukeocarwright | 7:33cb5f2db1ee | 378 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 379 | lcd.drawSprite(51,4,6,28,(int *)sin_wav); |
lukeocarwright | 7:33cb5f2db1ee | 380 | } |
lukeocarwright | 7:33cb5f2db1ee | 381 | if (submenu==2) { |
lukeocarwright | 7:33cb5f2db1ee | 382 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 383 | lcd.drawSprite(51,4,6,28,(int *)tri_wav); |
lukeocarwright | 7:33cb5f2db1ee | 384 | } |
lukeocarwright | 7:33cb5f2db1ee | 385 | if (submenu==3) { |
lukeocarwright | 7:33cb5f2db1ee | 386 | // x origin, y origin, rows, cols, sprite |
lukeocarwright | 7:33cb5f2db1ee | 387 | lcd.drawSprite(51,4,6,28,(int *)square_wav); |
lukeocarwright | 7:33cb5f2db1ee | 388 | } |
lukeocarwright | 13:27300c533dd1 | 389 | } |
lukeocarwright | 13:27300c533dd1 | 390 | |
lukeocarwright | 25:f230af268e8b | 391 | void Front::printfilter(N5110 &lcd, int filter_type) |
lukeocarwright | 25:f230af268e8b | 392 | { |
lukeocarwright | 25:f230af268e8b | 393 | if (filter_type>=1) { |
lukeocarwright | 25:f230af268e8b | 394 | lcd.drawLine(51,32,51,12,1); //y axis |
lukeocarwright | 25:f230af268e8b | 395 | lcd.drawLine(51,32,81,32,1); //x axis |
lukeocarwright | 25:f230af268e8b | 396 | if (filter_type==1) { |
lukeocarwright | 25:f230af268e8b | 397 | lcd.drawSprite(52,13,19,29,(int *)Low_pass); |
lukeocarwright | 25:f230af268e8b | 398 | lcd.printString("L",45,2); |
lukeocarwright | 25:f230af268e8b | 399 | } |
lukeocarwright | 25:f230af268e8b | 400 | if (filter_type==2) { |
lukeocarwright | 25:f230af268e8b | 401 | lcd.drawSprite(52,13,19,29,(int *)High_pass); |
lukeocarwright | 25:f230af268e8b | 402 | lcd.printString("H",45,2); |
lukeocarwright | 25:f230af268e8b | 403 | } |
lukeocarwright | 25:f230af268e8b | 404 | if (filter_type==3) { |
lukeocarwright | 25:f230af268e8b | 405 | lcd.drawSprite(52,13,19,29,(int *)Band_pass); |
lukeocarwright | 25:f230af268e8b | 406 | lcd.printString("B",45,2); |
lukeocarwright | 25:f230af268e8b | 407 | } |
lukeocarwright | 25:f230af268e8b | 408 | } |
lukeocarwright | 25:f230af268e8b | 409 | } |
lukeocarwright | 25:f230af268e8b | 410 | |
lukeocarwright | 25:f230af268e8b | 411 | int Front::parameter_manager(Gamepad &pad, int dir, int a, int d, int s, int r) |
lukeocarwright | 25:f230af268e8b | 412 | { |
lukeocarwright | 25:f230af268e8b | 413 | |
lukeocarwright | 25:f230af268e8b | 414 | return(used); |
lukeocarwright | 25:f230af268e8b | 415 | } |
lukeocarwright | 25:f230af268e8b | 416 | |
lukeocarwright | 13:27300c533dd1 | 417 | int Front::incrament_adsr(int used, int adsr, int ud) |
lukeocarwright | 13:27300c533dd1 | 418 | { |
lukeocarwright | 25:f230af268e8b | 419 | if (used<=4) { |
lukeocarwright | 25:f230af268e8b | 420 | if (ud==1) { |
lukeocarwright | 25:f230af268e8b | 421 | adsr++; |
lukeocarwright | 25:f230af268e8b | 422 | if (adsr>35) { |
lukeocarwright | 25:f230af268e8b | 423 | adsr--; |
lukeocarwright | 25:f230af268e8b | 424 | } |
lukeocarwright | 13:27300c533dd1 | 425 | } |
lukeocarwright | 25:f230af268e8b | 426 | if (ud==-1) { |
lukeocarwright | 25:f230af268e8b | 427 | adsr--; |
lukeocarwright | 25:f230af268e8b | 428 | if (adsr<1) { |
lukeocarwright | 25:f230af268e8b | 429 | adsr++; |
lukeocarwright | 25:f230af268e8b | 430 | } |
lukeocarwright | 13:27300c533dd1 | 431 | } |
lukeocarwright | 13:27300c533dd1 | 432 | } |
lukeocarwright | 26:a6033830d01c | 433 | if (used==5) { |
lukeocarwright | 26:a6033830d01c | 434 | adsr=incrament_filter(adsr,ud); |
lukeocarwright | 26:a6033830d01c | 435 | } |
lukeocarwright | 26:a6033830d01c | 436 | return(adsr); |
lukeocarwright | 26:a6033830d01c | 437 | } |
lukeocarwright | 26:a6033830d01c | 438 | |
lukeocarwright | 26:a6033830d01c | 439 | int Front::incrament_filter(int adsr, int ud) |
lukeocarwright | 26:a6033830d01c | 440 | { |
lukeocarwright | 26:a6033830d01c | 441 | if (ud==1) { |
lukeocarwright | 26:a6033830d01c | 442 | adsr++; |
lukeocarwright | 26:a6033830d01c | 443 | if (adsr>3) { |
lukeocarwright | 26:a6033830d01c | 444 | adsr--; |
lukeocarwright | 26:a6033830d01c | 445 | } |
lukeocarwright | 26:a6033830d01c | 446 | } |
lukeocarwright | 26:a6033830d01c | 447 | if (ud==-1) { |
lukeocarwright | 26:a6033830d01c | 448 | adsr--; |
lukeocarwright | 26:a6033830d01c | 449 | if (adsr<0) { |
lukeocarwright | 26:a6033830d01c | 450 | adsr++; |
lukeocarwright | 26:a6033830d01c | 451 | } |
lukeocarwright | 26:a6033830d01c | 452 | } |
lukeocarwright | 13:27300c533dd1 | 453 | return(adsr); |
lukeocarwright | 19:08862f49cd9e | 454 | } |
lukeocarwright | 19:08862f49cd9e | 455 | |
lukeocarwright | 24:c3bb1b0b2207 | 456 | int Front::frequency_convert(Gamepad &pad) |
lukeocarwright | 24:c3bb1b0b2207 | 457 | { |
lukeocarwright | 24:c3bb1b0b2207 | 458 | frequency=(440+(pad.read_pot1()*440)); |
lukeocarwright | 24:c3bb1b0b2207 | 459 | return(frequency); |
lukeocarwright | 24:c3bb1b0b2207 | 460 | } |
lukeocarwright | 24:c3bb1b0b2207 | 461 | |
lukeocarwright | 19:08862f49cd9e | 462 | #ifdef SLOW_TIME |
lukeocarwright | 19:08862f49cd9e | 463 | 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 | 464 | { |
lukeocarwright | 19:08862f49cd9e | 465 | //Prints all data required in SLOW_TIME |
lukeocarwright | 19:08862f49cd9e | 466 | printf("OUTPUT:%d\n",out); |
lukeocarwright | 19:08862f49cd9e | 467 | printf("NOTEON: %d\n",noteon); |
lukeocarwright | 19:08862f49cd9e | 468 | printf("A:%d,D:%d,S:%d,R:%d\n",a,d,s,r); |
lukeocarwright | 19:08862f49cd9e | 469 | printf("RelFlag=%d, SilFlag=%d\n\n",release_flag,silent_flag); |
lukeocarwright | 19:08862f49cd9e | 470 | } |
lukeocarwright | 19:08862f49cd9e | 471 | #endif |