Make it possible to change the key of ColorChord on ColorChord Embedded applications.

This commit is contained in:
cnlohr 2015-07-20 22:01:14 -04:00
parent 330c3da9bc
commit 87dbe51a52
4 changed files with 88 additions and 20 deletions

View file

@ -8,6 +8,8 @@ uint16_t ledAmpOut[NUM_LIN_LEDS];
uint8_t ledFreqOut[NUM_LIN_LEDS];
uint8_t ledFreqOutOld[NUM_LIN_LEDS];
uint8_t RootNoteOffset;
void UpdateLinearLEDs()
{
//Source material:
@ -188,7 +190,7 @@ void UpdateLinearLEDs()
uint16_t amp = ledAmpOut[j];
if( amp > 255 ) amp = 255;
uint32_t color = ECCtoHEX( ledFreqOut[j], 255, amp );
uint32_t color = ECCtoHEX( (ledFreqOut[j]+RootNoteOffset)%NOTERANGE, 255, amp );
ledOut[l*3+0] = ( color >> 0 ) & 0xff;
ledOut[l*3+1] = ( color >> 8 ) & 0xff;
ledOut[l*3+2] = ( color >>16 ) & 0xff;

View file

@ -19,6 +19,7 @@
extern uint8_t ledArray[];
extern uint8_t ledOut[]; //[NUM_LIN_LEDS*3]
extern uint8_t RootNoteOffset; //Set to define what the root note is. 0 = A.
void UpdateLinearLEDs();
uint32_t ECCtoHEX( uint8_t note, uint8_t sat, uint8_t val );