Browse Source

add action erease

develop^2
Carmine De Rosa 5 years ago
parent
commit
4a45a0ce21
  1. 3
      C/actions.cpp
  2. 3
      C/inputs.cpp
  3. 5
      C/main.cpp
  4. 17
      C/players.cpp
  5. BIN
      C/sonquencer
  6. 17
      README.md

3
C/actions.cpp

@ -0,0 +1,3 @@
void erease() {
}

3
C/inputs.cpp

@ -17,6 +17,9 @@ void inputActions(SDL_Event e) {
play = !play; play = !play;
step = 0; step = 0;
break; break;
case SDLK_e:
setErease = true;
break;
default: default:
break; break;
} }

5
C/main.cpp

@ -19,12 +19,14 @@ SDL_Renderer* renderer;
int pattern[PATTERN_ROWS][PATTERN_COLS]; int pattern[PATTERN_ROWS][PATTERN_COLS];
int matrix[] = {PATTERN_ROWS, PATTERN_COLS}; int matrix[] = {PATTERN_ROWS, PATTERN_COLS};
bool play = false; bool play = false;
bool setErease = false;
int step = 0; int step = 0;
#include "draw.cpp" #include "draw.cpp"
#include "players.cpp" #include "players.cpp"
#include "loaders.cpp" #include "loaders.cpp"
#include "inputs.cpp" #include "inputs.cpp"
#include "actions.cpp"
int main(int argc, char** argv) { int main(int argc, char** argv) {
@ -67,8 +69,6 @@ int main(int argc, char** argv) {
break; break;
default: default:
break; break;
} }
if( !done ) { gotEvent = SDL_PollEvent(&event); } if( !done ) { gotEvent = SDL_PollEvent(&event); }
@ -80,7 +80,6 @@ int main(int argc, char** argv) {
} }
} }
for( int i = 0; i < NUM_WAVEFORMS; i++ ) { for( int i = 0; i < NUM_WAVEFORMS; i++ ) {
Mix_FreeChunk(samples[i]); Mix_FreeChunk(samples[i]);
} }

17
C/players.cpp

@ -15,11 +15,18 @@ void playPattern(int *timer, int duration, int *step) {
} }
void setSample(int sample, int step) { void setSample(int sample, int step) {
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]);
if(setErease) {
for(int i=0; i<matrix[1]; i++) {
pattern[sample-1][i] = 0;
}
setErease = 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");
} }
printf("\n");
} }
} }

BIN
C/sonquencer

Binary file not shown.

17
README.md

@ -1 +1,16 @@
sonquencer
# Sonquencer
#### Keys (C version)
| Key | | |
| ---- | ------------- | ---------------------------------------- |
| 1 | Play sample 1 | Set the sample when sequencer is playing |
| 2 | Play sample 2 | Set the sample when sequencer is playing |
| 3 | Play sample 3 | Set the sample when sequencer is playing |
| 4 | Play sample 4 | Set the sample when sequencer is playing |
| P | Play/Stop | Play/Stop Sequencer |
| | | |
| | | |
| | | |
| | | |

Loading…
Cancel
Save