|
@@ -0,0 +1,60 @@
|
|
|
+#include "Sequencer.h"
|
|
|
+#include "ConfigurationScreen.h"
|
|
|
+#include "colors.h"
|
|
|
+#include <iostream>
|
|
|
+
|
|
|
+ConfigurationScreen::ConfigurationScreen(Sequencer& seq)
|
|
|
+ : parent(seq)
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigurationScreen::keyPressed(unsigned char x, unsigned char y)
|
|
|
+{
|
|
|
+ std::cout << "config clicked x=" << (int)x << ", y=" << (int)y << std::endl;
|
|
|
+
|
|
|
+ if(x == 8) { // very right
|
|
|
+ } else if(y == 8) { // very top
|
|
|
+ bool playing = sequencer.player.isPlaying();
|
|
|
+ switch(x) {
|
|
|
+ case 5:
|
|
|
+ disable();
|
|
|
+ sequencer.playbackScreen.enable();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(y == 0) { // bpm
|
|
|
+ unsigned int bit = (1 << (configWidth - x - 1));
|
|
|
+ unsigned int beatsCount = sequencer.beats.size() ^ bit;
|
|
|
+ std::cout << "set number of beats to " << beatsCount << std::endl;
|
|
|
+ sequencer.beats.resize(beatsCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ refreshAll();
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigurationScreen::keyReleased(unsigned char x, unsigned char y)
|
|
|
+{
|
|
|
+ refreshAll();
|
|
|
+}
|
|
|
+
|
|
|
+void ConfigurationScreen::refresh(unsigned char x, unsigned char y)
|
|
|
+{
|
|
|
+ if(x == 8) { // very right
|
|
|
+ } else if(y == 8) { // very top
|
|
|
+ switch(x) {
|
|
|
+ case 5:
|
|
|
+ setColor(x, y, colors::activeOption);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(y == 0) { // bpm
|
|
|
+ unsigned int beatsCount = sequencer.beats.size();
|
|
|
+ if(beatsCount & (1 << (configWidth - x - 1))) {
|
|
|
+ setColor(x, y, colors::activeBeatsCount);
|
|
|
+ } else {
|
|
|
+ setColor(x, y, colors::inactiveBeatsCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|