diff options
Diffstat (limited to 'apps/plugins/midi/sequencer.c')
-rw-r--r-- | apps/plugins/midi/sequencer.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c index c4ddfcf95a..f0af3fecd0 100644 --- a/apps/plugins/midi/sequencer.c +++ b/apps/plugins/midi/sequencer.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include "synth.h" | 22 | #include "synth.h" |
23 | 23 | ||
24 | extern struct plugin_api * rb; | 24 | extern struct plugin_api * rb; |
25 | extern int playingTime IBSS_ATTR; | ||
26 | extern int samplesThisSecond IBSS_ATTR; | ||
25 | 27 | ||
26 | long tempo=375000; | 28 | long tempo=375000; |
27 | 29 | ||
@@ -239,7 +241,7 @@ inline void pressNote(int ch, int note, int vol) | |||
239 | { | 241 | { |
240 | if(drumSet[note]!=NULL) | 242 | if(drumSet[note]!=NULL) |
241 | { | 243 | { |
242 | if(note<35) | 244 | if(note<35) |
243 | printf("NOTE LESS THAN 35, AND A DRUM PATCH EXISTS FOR THIS? WHAT THE HELL?"); | 245 | printf("NOTE LESS THAN 35, AND A DRUM PATCH EXISTS FOR THIS? WHAT THE HELL?"); |
244 | 246 | ||
245 | struct GWaveform * wf = drumSet[note]->waveforms[0]; | 247 | struct GWaveform * wf = drumSet[note]->waveforms[0]; |
@@ -364,6 +366,16 @@ static void sendEvent(struct Event * ev) | |||
364 | } | 366 | } |
365 | } | 367 | } |
366 | 368 | ||
369 | void rewindFile() | ||
370 | { | ||
371 | int i=0; | ||
372 | for(i=0; i<mf->numTracks; i++) | ||
373 | { | ||
374 | mf->tracks[i]->delta = 0; | ||
375 | mf->tracks[i]->pos = 0; | ||
376 | } | ||
377 | } | ||
378 | |||
367 | int tick(void) ICODE_ATTR; | 379 | int tick(void) ICODE_ATTR; |
368 | int tick(void) | 380 | int tick(void) |
369 | { | 381 | { |
@@ -419,6 +431,15 @@ int tick(void) | |||
419 | } | 431 | } |
420 | } | 432 | } |
421 | 433 | ||
434 | samplesThisSecond += numberOfSamples; | ||
435 | |||
436 | while(samplesThisSecond >= SAMPLE_RATE) | ||
437 | { | ||
438 | samplesThisSecond -= SAMPLE_RATE; | ||
439 | playingTime++; | ||
440 | // printf("Time: %d sec\n", playingTime); | ||
441 | } | ||
442 | |||
422 | if(tracksAdv != 0) | 443 | if(tracksAdv != 0) |
423 | return 1; | 444 | return 1; |
424 | else | 445 | else |