From ee2ee7f4f049dda385a9db7dddd8e7e91681315b Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 15 Apr 2016 13:44:07 -0400 Subject: audio note length fixes --- quantum/audio.c | 7 ++++++- quantum/keymap_common.c | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'quantum') diff --git a/quantum/audio.c b/quantum/audio.c index f29d941d7..50e5505fe 100644 --- a/quantum/audio.c +++ b/quantum/audio.c @@ -255,7 +255,12 @@ ISR(TIMER3_COMPA_vect) { note_position++; - if (note_position >= note_length) { + bool end_of_note = false; + if (ICR3 > 0) + end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF)); + else + end_of_note = (note_position >= (note_length * 0x7FF)); + if (end_of_note) { current_note++; if (current_note >= notes_length) { if (notes_repeat) { diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index ae6cddb34..e3030a886 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -33,11 +33,9 @@ along with this program. If not, see . #include "audio.h" float goodbye[][2] = { - {440.0*pow(2.0,(67)/12.0), 400}, - {0, 50}, - {440.0*pow(2.0,(60)/12.0), 400}, - {0, 50}, - {440.0*pow(2.0,(55)/12.0), 600}, + {440.0*pow(2.0,(67)/12.0), 8}, + {440.0*pow(2.0,(60)/12.0), 8}, + {440.0*pow(2.0,(55)/12.0), 12}, }; #endif @@ -90,7 +88,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) action_t action; clear_keyboard(); #ifdef AUDIO_ENABLE - play_notes(&goodbye, 5, false); + play_notes(&goodbye, 3, false); #endif _delay_ms(250); #ifdef ATREUS_ASTAR -- cgit v1.2.3-24-g4f1b