Skip to content

Commit

Permalink
Colored octaves
Browse files Browse the repository at this point in the history
  • Loading branch information
Kermalis committed Feb 18, 2019
1 parent 2a9ec37 commit cc5dacc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions GBAMusicStudio/UI/PianoControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#endregion

using Kermalis.GBAMusicStudio.Util;
using Sanford.Multimedia.Midi;
using System;
using System.Collections;
Expand All @@ -40,7 +41,7 @@ public class PianoKey : Control
public bool Pressed { get; private set; } = false;

SolidBrush onBrush = new SolidBrush(Color.SkyBlue);
SolidBrush offBrush = new SolidBrush(Color.White);
SolidBrush offBrush;
public Color NoteOnColor
{
get
Expand Down Expand Up @@ -89,10 +90,12 @@ public int NoteID
}
}

public PianoKey(PianoControl piano)
public PianoKey(PianoControl piano, int noteId)
{
owner = piano;
TabStop = false;
NoteID = noteId;
offBrush = new SolidBrush(new HSLColor(160.0, 0.0, KeyTypeTable[noteID % 12] == KeyType.White ? noteID / 12 % 2 == 0 ? 240.0 : 120.0 : 0.0));
}

public void PressPianoKey()
Expand Down Expand Up @@ -338,15 +341,14 @@ void CreatePianoKeys()

for (int i = 0; i < keys.Length; i++)
{
keys[i] = new PianoKey(this) { NoteID = i + LowNoteID };
keys[i] = new PianoKey(this, i + LowNoteID);

if (KeyTypeTable[keys[i].NoteID % 12] == KeyType.White)
{
WhiteKeyCount++;
}
else
{
keys[i].NoteOffColor = Color.Black;
keys[i].BringToFront();
}

Expand Down

0 comments on commit cc5dacc

Please sign in to comment.