1
0
mirror of https://github.com/sjlongland/atinysynth.git synced 2025-09-13 10:03:15 +10:00

attiny861: Port to new API

This commit is contained in:
Stuart Longland 2021-05-23 10:22:16 +10:00
parent 137dba352c
commit b46f9864e7
Signed by: stuartl
GPG Key ID: 6AA32EFB18079BAA

View File

@ -62,6 +62,20 @@ static volatile uint16_t amp_powerdown = 0;
/*! Number of I/O channels */
#define CHANNELS (8)
/*!
* Voice definitions for all the channels.
*/
const struct adsr_env_def_t voice_def = {
.time_scale = 100,
.delay_time = 0,
.attack_time = 10,
.decay_time = 10,
.sustain_time = ADSR_INFINITE,
.release_time = 10,
.peak_amp = 255,
.sustain_amp = 192
};
/*!
* I/O channel frequencies, note frequencies
* from http://www.phy.mtu.edu/~suits/notefreqs.html
@ -101,9 +115,7 @@ static void trigger_button(uint8_t b) {
if (voice) {
uint16_t freq = pgm_read_dword(&button_freq[b]);
adsr_config(&voice->adsr,
100, 0, 10, 10,
ADSR_INFINITE, 10, 255, 192);
adsr_config(&voice->adsr, &voice_def);
voice_wf_set_triangle(&voice->wf, freq, 127);
synth.enable |= (1 << b);