From 137dba352c0e2bcb63c439267076603b88b37882 Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Sun, 23 May 2021 10:19:48 +1000 Subject: [PATCH] attiny85: Port to new API --- ports/attiny85/main.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/ports/attiny85/main.c b/ports/attiny85/main.c index 2647de5..0a63a64 100644 --- a/ports/attiny85/main.c +++ b/ports/attiny85/main.c @@ -61,14 +61,22 @@ int main(void) { voice_wf_set_triangle(&poly_voice[1].wf, 659, 63); voice_wf_set_triangle(&poly_voice[2].wf, 784, 63); voice_wf_set_triangle(&poly_voice[3].wf, 880, 63); - adsr_config(&poly_voice[0].adsr, - 100, 0, 10, 10, 10, 10, 255, 192); - adsr_config(&poly_voice[1].adsr, - 100, 0, 10, 10, 10, 10, 255, 192); - adsr_config(&poly_voice[2].adsr, - 100, 0, 10, 10, 10, 10, 255, 192); - adsr_config(&poly_voice[3].adsr, - 100, 0, 10, 10, 10, 10, 255, 192); + + struct adsr_env_def_t voice_def = { + .time_scale = 100, + .delay_time = 0, + .attack_time = 10, + .decay_time = 10, + .sustain_time = 10, + .release_time = 10, + .peak_amp = 255, + .sustain_amp = 192 + }; + + adsr_config(&poly_voice[0].adsr, &voice_def); + adsr_config(&poly_voice[1].adsr, &voice_def); + adsr_config(&poly_voice[2].adsr, &voice_def); + adsr_config(&poly_voice[3].adsr, &voice_def); synth.enable = 0x0; sei();