diff options
| author | spl3g <spleefer6@yandex.ru> | 2025-10-10 13:34:07 +0300 |
|---|---|---|
| committer | spl3g <spleefer6@yandex.ru> | 2025-10-10 13:34:29 +0300 |
| commit | 145229b9ec9b0f50cdef537f1bae5f09c3198ead (patch) | |
| tree | 7e0757cc1f9ece826a95f5c2caf54ce6a2d653ed /src/main.c | |
| parent | febc94a11b127fd9ebb4153c06c9289949ffaab9 (diff) | |
Make envelope customizable
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 43 |
1 files changed, 38 insertions, 5 deletions
@@ -64,24 +64,57 @@ int init_sounds(app_state *state) { state->sound_thread = sound_thread; - synth_message param_message = { + synth_message param_messages[6] = { + { .type = MSG_PARAM_CHANGE, .param_change = { .param_type = PARAM_OSC, .value = OSC_SQUARE, }, - }; - mqueue_push(&state->msg_queue, param_message); - param_message = (synth_message){ + }, + { .type = MSG_PARAM_CHANGE, .param_change = { .param_type = PARAM_VOLUME, .value = 1, }, + }, + { + .type = MSG_PARAM_CHANGE, + .param_change = + { + .param_type = PARAM_ATTACK, + .value = 0.005 * SAMPLE_RATE, + }, + }, + { + .type = MSG_PARAM_CHANGE, + .param_change = + { + .param_type = PARAM_DECAY, + .value = 0.0010 * SAMPLE_RATE, + }, + }, + { + .type = MSG_PARAM_CHANGE, + .param_change = + { + .param_type = PARAM_SUSTAIN, + .value = 0.7, + }, + }, + { + .type = MSG_PARAM_CHANGE, + .param_change = + { + .param_type = PARAM_RELEASE, + .value = 1.000 * SAMPLE_RATE, + }, + }, }; - mqueue_push(&state->msg_queue, param_message); + mqueue_push_many(&state->msg_queue, param_messages, 6); return 0; } |
