Commit 820ce99a authored by Jacob Vosmaer's avatar Jacob Vosmaer

Simplify gate retrigger: AS3310s reset faster

parent 037a854c
......@@ -115,8 +115,6 @@ uint16_t dac_note_pitch(uint8_t v, uint8_t note) {
dac_semitone_offset((note - MIDI_LOWEST) % NUM_SEMITONES));
}
static uint8_t gate_counters[NUM_VOICES];
void gate_on_legato(uint8_t v) {
struct gate *g = gate(v);
if (!g) {
......@@ -132,7 +130,6 @@ void gate_off(uint8_t v) {
return;
}
gate_counters[v] = 0;
*(g->port) &= ~(g->mask);
}
......@@ -143,29 +140,8 @@ void gate_on(uint8_t v) {
gate_off(v);
// RETRIG_DELAY should be as low as possible to reduce MIDI latency, but
// high enough to allow the hardware envelope generators in the CrowBX
// to reset. I know 0x3f to be too low.
enum { RETRIG_DELAY = 0x5f };
gate_counters[v] = RETRIG_DELAY;
}
void gate_update(uint8_t delta) {
for_each_voice (v) {
if (gate_counters[v] == 0) {
continue;
}
if (delta < gate_counters[v]) {
gate_counters[v] -= delta;
continue;
}
gate_counters[v] = 0;
gate_on_legato(v);
pitch_env_trigger(v);
}
pitch_env_trigger(v);
gate_on_legato(v);
}
void gate_init(void) {
......@@ -528,7 +504,6 @@ void do_clock_update(void) {
}
vibrato_update(delta);
gate_update(delta);
pitch_update_clock(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