You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
407 B
18 lines
407 B
|
|
void playPattern(int *timer, int duration, int *step) {
|
|
*timer = *timer >= duration ? 0 : *timer+1;
|
|
usleep(1000);
|
|
|
|
if(*timer == 0) {
|
|
for(int i=0; i<matrix[0]; i++) {
|
|
if(pattern[i][*step-1]-'0' == 1) {
|
|
Mix_PlayChannel(-1, samples[i], 0);
|
|
}
|
|
}
|
|
*step = *step < matrix[1]-1 ? *step+1 : 1;
|
|
}
|
|
}
|
|
|
|
void playSample(int sample) {
|
|
Mix_PlayChannel(-1, samples[sample-1], 0);
|
|
}
|