#include #include "config.h" #include "audio_timer.h" void AudioTimer::update(void) { audio_block_t *in; in = receiveReadOnly(0); if (in) release(in); tick++; if (tick >= float(beat)*float(bpm) + 0.5) { if (sequencer_step_function != NULL) (*sequencer_step_function)(); tick = 0; } } uint32_t AudioTimer::get_tick(void) { return (tick); } void AudioTimer::set_bpm(uint8_t b) { bpm = b; } void AudioTimer::function(uint8_t steps, void(*func)()) { if (func != NULL) { sequencer_step_function = func; steps = bpm * steps / 4; } else sequencer_step_function = NULL; }