Browse Source

load banks

develop^2
Carmine De Rosa 5 years ago
parent
commit
bff0e63559
  1. 28
      C/actions.cpp
  2. 3
      C/inputs.cpp
  3. 3
      C/main.cpp
  4. 8
      C/patterns/pattern2
  5. 20
      C/players.cpp
  6. BIN
      C/sonquencer

28
C/actions.cpp

@ -1,3 +1,29 @@
void erease() {
void setSample(int sample, int step) {
if(setErease) {
for(int i=0; i<matrix[1]; i++) {
pattern[sample-1][i] = 0;
}
setErease = false;
} else if(selectPattern) {
loadPattern(sample);
selectPattern = false;
} else if(selectBank) {
loadBank(sample);
selectBank = false;
} else {
pattern[sample-1][step-1] = 1;
for(int i=0; i<matrix[0]; i++) {
for(int y=0; y<matrix[1]; y++) {
printf("%d ", pattern[i][y]);
}
printf("\n");
}
}
} }

3
C/inputs.cpp

@ -23,6 +23,9 @@ void inputActions(SDL_Event e) {
case SDLK_o: case SDLK_o:
selectPattern = true; selectPattern = true;
break; break;
case SDLK_b:
selectBank = true;
break;
default: default:
break; break;

3
C/main.cpp

@ -21,13 +21,14 @@ int matrix[] = {PATTERN_ROWS, PATTERN_COLS};
bool play = false; bool play = false;
bool setErease = false; bool setErease = false;
bool selectPattern = false; bool selectPattern = false;
bool selectBank = false;
int step = 0; int step = 0;
#include "draw.cpp" #include "draw.cpp"
#include "loaders.cpp" #include "loaders.cpp"
#include "actions.cpp"
#include "players.cpp" #include "players.cpp"
#include "inputs.cpp" #include "inputs.cpp"
#include "actions.cpp"
int main(int argc, char** argv) { int main(int argc, char** argv) {

8
C/patterns/pattern2

@ -1,6 +1,6 @@
bank 2 bank 2
rows 4 rows 4
10000101
01000011
00100001
00010001
1000010010000001
0100001101000011
0010000100100001
0001000100010001

20
C/players.cpp

@ -13,23 +13,3 @@ void playPattern(int *timer, int duration, int *step) {
*step = *step < matrix[1] ? *step+1 : 1; *step = *step < matrix[1] ? *step+1 : 1;
} }
} }
void setSample(int sample, int step) {
if(setErease) {
for(int i=0; i<matrix[1]; i++) {
pattern[sample-1][i] = 0;
}
setErease = false;
} else if(selectPattern) {
loadPattern(sample);
selectPattern = false;
} else {
pattern[sample-1][step-1] = 1;
for(int i=0; i<matrix[0]; i++) {
for(int y=0; y<matrix[1]; y++) {
printf("%d ", pattern[i][y]);
}
printf("\n");
}
}
}

BIN
C/sonquencer

Binary file not shown.
Loading…
Cancel
Save