123456789101112131415161718192021222324252627282930313233343536 |
- #include <iostream>
- #include <cstdlib>
- #include "Launchpad.h"
- using namespace std;
- using namespace midi;
- // Platform-dependent sleep routines.
- #if defined(__WINDOWS_MM__)
- #include <windows.h>
- #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds )
- #else // Unix variants
- #include <unistd.h>
- #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) )
- #endif
- Launchpad l;
- void keyPressed(unsigned char x, unsigned char y, void* data)
- {
- std::cout << "(" << (int)x << ", " << (int)y << ")" << std::endl;
- l.setColor(x, y, LaunchpadColor(3, 3));
- }
- int main()
- {
- l.keyPressedCallback = keyPressed;
- l.setColorAll(LaunchpadColor(0, 1));
- cout << "Press a button to stop... " << endl;
- cin.ignore();
-
- return 0;
- }
|