|
@@ -34,6 +34,14 @@ Launchpad::Launchpad()
|
|
|
{
|
|
|
throw "no launchpad for midi input found";
|
|
|
}
|
|
|
+
|
|
|
+ for(KeyCoordinate x = 0; x < width; x++) {
|
|
|
+ for(KeyCoordinate y = 0; y < height; y++) {
|
|
|
+ if(x != 8 || y != 8) {
|
|
|
+ setKeyPressed(x, y, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void Launchpad::midiMessageCallback(double timeStamp, Message &message, void *userData)
|
|
@@ -134,8 +142,15 @@ void Launchpad::setColorAll(const LaunchpadColor& color)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+bool Launchpad::getKeyPressed(KeyCoordinate x, KeyCoordinate y)
|
|
|
+{
|
|
|
+ return keyBeingPressed[x][y];
|
|
|
+}
|
|
|
+
|
|
|
void Launchpad::keyPressed(unsigned char x, unsigned char y)
|
|
|
{
|
|
|
+ setKeyPressed(x, y, true);
|
|
|
+
|
|
|
if(keyPressedCallback)
|
|
|
{
|
|
|
keyPressedCallback(x, y, keyEventCallbackData);
|
|
@@ -148,6 +163,13 @@ void Launchpad::keyReleased(unsigned char x, unsigned char y)
|
|
|
{
|
|
|
keyReleasedCallback(x, y, keyEventCallbackData);
|
|
|
}
|
|
|
+
|
|
|
+ setKeyPressed(x, y, false);
|
|
|
+}
|
|
|
+
|
|
|
+void Launchpad::setKeyPressed(KeyCoordinate x, KeyCoordinate y, bool pressed)
|
|
|
+{
|
|
|
+ keyBeingPressed[x][y] = pressed;
|
|
|
}
|
|
|
|
|
|
} // namespace
|