Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Write(int iter, byte[] fftData)
- {
- // Black background lights
- for (int x = 0; x < 91; x++)
- {
- for (int y = 0; y < 7; y++)
- {
- this.SetLed((x + iter) % 92, y, 0x00, 0x00, 0x00);
- }
- }
- // FFT Data to key lights (rainbow)
- for (int i = 0; i < 91; i++)
- {
- for (int k = 0; k < 7; k++)
- {
- if (fftData[(int)(i * 2.1 + 1)] > (255 / (15 + (i * 0.8))) * (7 - k))
- {
- if (i <= 30)
- {
- this.red = (byte)(7.0f * (Math.Sin((i / 60.0f) * 3.14f + 1.57f)));
- this.grn = (byte)(7.0f * (Math.Sin((i / 60.0f) * 3.14f)));
- this.blu = 0x00;
- }
- if (i > 30 && i <= 60)
- {
- this.red = 0x00;
- this.grn = (byte)(7.0f * (Math.Sin(((i - 30.0f) / 60.0f) * 3.14f + 1.57f)));
- this.blu = (byte)(7.0f * (Math.Sin(((i - 30.0f) / 60.0f) * 3.14f)));
- }
- if (i > 60)
- {
- this.red = (byte)(7.0f * (Math.Sin(((i - 60.0f) / 62.0f) * 3.14f)));
- this.grn = 0x00;
- this.blu = (byte)(7.0f * (Math.Sin(((i - 60.0f) / 62.0f) * 3.14f + 1.57f)));
- }
- this.SetLed(i, k, red, grn, blu);
- }-
- }
- }
- UpdateKeyboard();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement