|
|
|
@ -12,10 +12,10 @@ void AudioTimer::update(void) |
|
|
|
|
|
|
|
|
|
tick++; |
|
|
|
|
|
|
|
|
|
if (tick >= float(beat)*float(bpm) + 0.5) |
|
|
|
|
if (tick >= _steps) |
|
|
|
|
{ |
|
|
|
|
if (sequencer_step_function != NULL) |
|
|
|
|
(*sequencer_step_function)(); |
|
|
|
|
if (step_function != NULL) |
|
|
|
|
(*step_function)(); |
|
|
|
|
tick = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -30,13 +30,14 @@ void AudioTimer::set_bpm(uint8_t b) |
|
|
|
|
bpm = b; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AudioTimer::function(uint8_t steps, void(*func)()) |
|
|
|
|
void AudioTimer::function(uint8_t stepping, void(*func)()) |
|
|
|
|
{ |
|
|
|
|
steps = stepping; |
|
|
|
|
if (func != NULL) |
|
|
|
|
{ |
|
|
|
|
sequencer_step_function = func; |
|
|
|
|
steps = bpm * steps / 4; |
|
|
|
|
step_function = func; |
|
|
|
|
_steps = beat * float(bpm) * 4.0 / float(stepping) + 0.5; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
sequencer_step_function = NULL; |
|
|
|
|
step_function = NULL; |
|
|
|
|
} |
|
|
|
|