Jelajahi Sumber

sequence expansion

Fabian Peter Hammerle 10 tahun lalu
induk
melakukan
7eb8a2e760
4 mengubah file dengan 94 tambahan dan 15 penghapusan
  1. 24 12
      ConfigurationScreen.cpp
  2. 4 2
      colors.h
  3. 65 0
      hardcopy.1
  4. 1 1
      midi

+ 24 - 12
ConfigurationScreen.cpp

@@ -22,11 +22,18 @@ void ConfigurationScreen::keyPressed(unsigned char x, unsigned char y)
                 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);
+        switch(y) {
+            case 0: { // number of beats
+                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);
+                } break;
+            case 1: { // sequence expansion
+                unsigned int factor = x + 2;
+                sequencer.beats.expand(factor);
+                sequencer.player.setBpm(sequencer.player.getBpm() * factor);
+                } break;
         }
     }
 
@@ -48,13 +55,18 @@ void ConfigurationScreen::refresh(unsigned char x, unsigned char y)
                 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);
-            }
+        switch(y) {
+            case 0: { // number of beats
+                unsigned int beatsCount = sequencer.beats.size();
+                if(beatsCount & (1 << (configWidth - x - 1))) {
+                    setColor(x, y, colors::activeBeatsCount);
+                } else {
+                    setColor(x, y, colors::inactiveBeatsCount);
+                }
+                } break;
+            case 1: // sequence expansion
+               setColor(x, y, colors::sequenceExpansionButton); 
+               break;
         }
     }
 }

+ 4 - 2
colors.h

@@ -12,7 +12,9 @@ Color activeMessage(3, 2);
 Color activeOption(3, 3);
 Color inactiveOption(1, 2);
 
-Color inactiveBeatsCount(0, 1);
-Color activeBeatsCount(1, 3);
+Color inactiveBeatsCount(1, 0);
+Color activeBeatsCount(3, 1);
+
+Color sequenceExpansionButton(0, 1);
 
 }; // color

+ 65 - 0
hardcopy.1

@@ -0,0 +1,65 @@
+path: /home/fabianpeter/.scripts:/home/fabianpeter/.scripts:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/b
+in:/usr/games:/usr/local/games
+python path: :/home/fabianpeter/.scripts/lib:/home/fabianpeter/.scripts/lib
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer $ ;s
+bash: syntax error near unexpected token `;'
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer $ ls
+bin    CMakeLists.txt  ConfigurationScreen.cpp  main.cpp  PlaybackScreen.cpp  Player.cpp  Screen.cpp  Sequencer.cpp
+build  colors.h        ConfigurationScreen.h    midi      PlaybackScreen.h    Player.h    Screen.h    Sequencer.h
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer $ cd midi
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer/midi $ ./build
+-- Configuring done
+-- Generating done
+-- Build files have been written to: /home/fabianpeter/projects/informatics/applications/launchpad-sequencer/midi/lib
+[100%] Built target midi
+-- Configuring done
+-- Generating done
+-- Build files have been written to: /home/fabianpeter/projects/informatics/applications/launchpad-sequencer/midi/test
+s/bin
+[ 10%] Built target beat-sequence-expansion
+[ 20%] Built target beat-sequence-player
+[ 30%] Built target beat-sequence-reducation
+[ 40%] Built target callback-clock
+[ 50%] Built target clock
+[ 60%] Built target launchpad
+[ 70%] Built target launchpad-screen
+[ 80%] Built target message-comparison
+[ 90%] Built target message-list-find
+[100%] Built target midiout
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer/midi $ cd ..
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer $ ls
+bin    CMakeLists.txt  ConfigurationScreen.cpp  main.cpp  PlaybackScreen.cpp  Player.cpp  Screen.cpp  Sequencer.cpp
+build  colors.h        ConfigurationScreen.h    midi      PlaybackScreen.h    Player.h    Screen.h    Sequencer.h
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer $ ls
+bin    CMakeLists.txt  ConfigurationScreen.cpp  main.cpp  PlaybackScreen.cpp  Player.cpp  Screen.cpp  Sequencer.cpp
+build  colors.h        ConfigurationScreen.h    midi      PlaybackScreen.h    Player.h    Screen.h    Sequencer.h
+fabianpeter@arma-nova ~/projects/informatics/applications/launchpad-sequencer $
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 1 - 1
midi

@@ -1 +1 @@
-Subproject commit affb35bea9180b5fac0792582daf51399dbf3f0c
+Subproject commit 377f02d6f9189f8a6e5f911ea9dbfe7fb62c1911