A MIDI piano synthesizer that implements the Karplus Strong physical modeling algorithm.
Dependencies: mbed USBDevice PinDetect
LEDController.h@8:deaedb59243e, 2016-04-13 (annotated)
- Committer:
- ndelfino
- Date:
- Wed Apr 13 17:44:36 2016 +0000
- Revision:
- 8:deaedb59243e
- Child:
- 11:f65806ee5833
Connected my code to Austin's. Made some fixes to the LEDController. Now lights will light up and turn off appropriately if they are in the same octave. Changed the values I was using for numerical identification of notes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ndelfino | 8:deaedb59243e | 1 | |
ndelfino | 8:deaedb59243e | 2 | #include "mbed.h" |
ndelfino | 8:deaedb59243e | 3 | |
ndelfino | 8:deaedb59243e | 4 | class LEDController{ |
ndelfino | 8:deaedb59243e | 5 | public: |
ndelfino | 8:deaedb59243e | 6 | |
ndelfino | 8:deaedb59243e | 7 | /* |
ndelfino | 8:deaedb59243e | 8 | * Constructor |
ndelfino | 8:deaedb59243e | 9 | */ |
ndelfino | 8:deaedb59243e | 10 | LEDController(); |
ndelfino | 8:deaedb59243e | 11 | |
ndelfino | 8:deaedb59243e | 12 | /* |
ndelfino | 8:deaedb59243e | 13 | * Identifies what note was passed in and passes this information along to chooseLEDForNote. |
ndelfino | 8:deaedb59243e | 14 | * @param key The integer representation of the note |
ndelfino | 8:deaedb59243e | 15 | * @param type This integer determines whether the event coming in is an "on" or "off" event |
ndelfino | 8:deaedb59243e | 16 | */ |
ndelfino | 8:deaedb59243e | 17 | void identifyKeyForLed(int key, int type); |
ndelfino | 8:deaedb59243e | 18 | |
ndelfino | 8:deaedb59243e | 19 | private: |
ndelfino | 8:deaedb59243e | 20 | /* |
ndelfino | 8:deaedb59243e | 21 | * Finds an available LED to light up or turn off depending on the type param. |
ndelfino | 8:deaedb59243e | 22 | * @param key[] This is the notes information such as the numerical key value and RGB values. |
ndelfino | 8:deaedb59243e | 23 | * @param type This integer determines whether the event coming in is an "on" or "off" event. |
ndelfino | 8:deaedb59243e | 24 | * @param signature Determines whether the note is sharp or not |
ndelfino | 8:deaedb59243e | 25 | */ |
ndelfino | 8:deaedb59243e | 26 | void chooseLedForKey(int key[4], int type, int signature); |
ndelfino | 8:deaedb59243e | 27 | |
ndelfino | 8:deaedb59243e | 28 | /* |
ndelfino | 8:deaedb59243e | 29 | * Sets the chosen LED to the proper color of the note passed in. |
ndelfino | 8:deaedb59243e | 30 | * @param key[] This is the notes information such as the numerical key value and RGB values. |
ndelfino | 8:deaedb59243e | 31 | * @param type This integer determines whether the event coming in is an "on" or "off" event. |
ndelfino | 8:deaedb59243e | 32 | * @param signature Determines whether the note is sharp or not |
ndelfino | 8:deaedb59243e | 33 | * @param led Determines which LED to light up |
ndelfino | 8:deaedb59243e | 34 | */ |
ndelfino | 8:deaedb59243e | 35 | void setLedToKey(int key[4], int type, int signature, int led); |
ndelfino | 8:deaedb59243e | 36 | |
ndelfino | 8:deaedb59243e | 37 | |
ndelfino | 8:deaedb59243e | 38 | }; |