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.
39 lines
630 B
39 lines
630 B
#include <Audio.h>
|
|
#include "config.h"
|
|
#include "sequencer_timer.h"
|
|
|
|
void AudioSequencerTimer::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 AudioSequencerTimer::get_tick(void)
|
|
{
|
|
return (tick);
|
|
}
|
|
|
|
void AudioSequencerTimer::set_bpm(uint8_t b)
|
|
{
|
|
bpm = b;
|
|
}
|
|
|
|
void AudioSequencerTimer::step_function(void(*func)())
|
|
{
|
|
if (func != NULL)
|
|
sequencer_step_function = func;
|
|
else
|
|
sequencer_step_function = NULL;
|
|
}
|
|
|