summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-04-15 13:44:07 -0400
committerJack Humbert <jack.humb@gmail.com>2016-04-15 13:44:07 -0400
commitee2ee7f4f049dda385a9db7dddd8e7e91681315b (patch)
tree05010164aa11846bb055b436292966befe80aac3
parentbb0836c62016f482f517771a9f5a8dbc68bd0a1c (diff)
audio note length fixes
-rw-r--r--keyboard/planck/keymaps/default/keymap.c46
-rw-r--r--quantum/audio.c7
-rw-r--r--quantum/keymap_common.c10
3 files changed, 33 insertions, 30 deletions
diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c
index 151a6b4f46..dee2840f2d 100644
--- a/keyboard/planck/keymaps/default/keymap.c
+++ b/keyboard/planck/keymaps/default/keymap.c
@@ -147,30 +147,30 @@ const uint16_t PROGMEM fn_actions[] = {
#ifdef AUDIO_ENABLE
float tone_qw[][2] = {
- {440.0*pow(2.0,(67)/12.0), 400},
- {440.0*pow(2.0,(60)/12.0), 400},
- {0, 800},
- {440.0*pow(2.0,(67)/12.0), 1600}
+ {440.0*pow(2.0,(59)/12.0), 8},
+ {440.0*pow(2.0,(60)/12.0), 8},
+ {0, 4},
+ {440.0*pow(2.0,(67)/12.0), 16}
};
float tone_cm[][2] = {
- {440.0*pow(2.0,(67)/12.0), 400},
- {440.0*pow(2.0,(60)/12.0), 400},
- {0, 800},
- {440.0*pow(2.0,(67)/12.0), 1000},
- {0, 200},
- {440.0*pow(2.0,(67)/12.0), 1000}
+ {440.0*pow(2.0,(59)/12.0), 8},
+ {440.0*pow(2.0,(60)/12.0), 8},
+ {0, 4},
+ {440.0*pow(2.0,(67)/12.0), 16},
+ {0, 4},
+ {440.0*pow(2.0,(71)/12.0), 16}
};
float tone_dv[][2] = {
- {440.0*pow(2.0,(67)/12.0), 400},
- {440.0*pow(2.0,(60)/12.0), 400},
- {0, 800},
- {440.0*pow(2.0,(67)/12.0), 800},
- {0, 200},
- {440.0*pow(2.0,(67)/12.0), 800},
- {0, 200},
- {440.0*pow(2.0,(67)/12.0), 800}
+ {440.0*pow(2.0,(59)/12.0), 8},
+ {440.0*pow(2.0,(60)/12.0), 8},
+ {0, 4},
+ {440.0*pow(2.0,(67)/12.0), 16},
+ {0, 4},
+ {440.0*pow(2.0,(69)/12.0), 16},
+ {0, 4},
+ {440.0*pow(2.0,(67)/12.0), 16}
};
#endif
@@ -246,11 +246,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
#ifdef AUDIO_ENABLE
float start_up[][2] = {
- {440.0*pow(2.0,(67)/12.0), 650},
- {440.0*pow(2.0,(64)/12.0), 450},
- {440.0*pow(2.0,(55)/12.0), 450},
- {440.0*pow(2.0,(60)/12.0), 450},
- {440.0*pow(2.0,(64)/12.0), 1000}
+ {440.0*pow(2.0,(67)/12.0), 12},
+ {440.0*pow(2.0,(64)/12.0), 8},
+ {440.0*pow(2.0,(55)/12.0), 8},
+ {440.0*pow(2.0,(60)/12.0), 8},
+ {440.0*pow(2.0,(64)/12.0), 20}
};
#endif
diff --git a/quantum/audio.c b/quantum/audio.c
index f29d941d7c..50e5505fe0 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 ae6cddb343..e3030a8869 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -33,11 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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