Commit ce64a751 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Implement mono retrigger

parent b5ebbd80
......@@ -13,6 +13,10 @@ INIT_LIST(notes, NUM_NOTES);
static uint16_t current_bend;
enum { GATE_START = 0x5f };
static uint16_t gate_countdown;
void mono_set_pitch(void);
const float detune_factor[NUM_VOICES] = {
......@@ -41,8 +45,9 @@ mono_note_on(uint8_t n)
l_push(notes, n);
mono_set_pitch();
gate_countdown = GATE_START;
for_each_voice(v) {
gate_on(v);
gate_off(v);
}
}
......@@ -104,9 +109,29 @@ mono_pitch_bend(uint16_t bend)
mono_set_pitch();
}
void
mono_update_gate(uint8_t delta)
{
if (gate_countdown == 0) {
return;
}
if (delta < gate_countdown) {
gate_countdown -= delta;
return;
}
gate_countdown = 0;
for_each_voice(v) {
gate_on(v);
}
}
void
mono_update_clock(uint8_t delta)
{
vibrato_update(delta);
mono_set_pitch();
mono_update_gate(delta);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment