aboutsummaryrefslogtreecommitdiff
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)
downloadqmk_firmware-ee2ee7f4f049dda385a9db7dddd8e7e91681315b.tar.gz
qmk_firmware-ee2ee7f4f049dda385a9db7dddd8e7e91681315b.zip
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 151a6b4f4..dee2840f2 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[] = {
147 147
148#ifdef AUDIO_ENABLE 148#ifdef AUDIO_ENABLE
149float tone_qw[][2] = { 149float tone_qw[][2] = {
150 {440.0*pow(2.0,(67)/12.0), 400}, 150 {440.0*pow(2.0,(59)/12.0), 8},
151 {440.0*pow(2.0,(60)/12.0), 400}, 151 {440.0*pow(2.0,(60)/12.0), 8},
152 {0, 800}, 152 {0, 4},
153 {440.0*pow(2.0,(67)/12.0), 1600} 153 {440.0*pow(2.0,(67)/12.0), 16}
154}; 154};
155 155
156float tone_cm[][2] = { 156float tone_cm[][2] = {
157 {440.0*pow(2.0,(67)/12.0), 400}, 157 {440.0*pow(2.0,(59)/12.0), 8},
158 {440.0*pow(2.0,(60)/12.0), 400}, 158 {440.0*pow(2.0,(60)/12.0), 8},
159 {0, 800}, 159 {0, 4},
160 {440.0*pow(2.0,(67)/12.0), 1000}, 160 {440.0*pow(2.0,(67)/12.0), 16},
161 {0, 200}, 161 {0, 4},
162 {440.0*pow(2.0,(67)/12.0), 1000} 162 {440.0*pow(2.0,(71)/12.0), 16}
163}; 163};
164 164
165float tone_dv[][2] = { 165float tone_dv[][2] = {
166 {440.0*pow(2.0,(67)/12.0), 400}, 166 {440.0*pow(2.0,(59)/12.0), 8},
167 {440.0*pow(2.0,(60)/12.0), 400}, 167 {440.0*pow(2.0,(60)/12.0), 8},
168 {0, 800}, 168 {0, 4},
169 {440.0*pow(2.0,(67)/12.0), 800}, 169 {440.0*pow(2.0,(67)/12.0), 16},
170 {0, 200}, 170 {0, 4},
171 {440.0*pow(2.0,(67)/12.0), 800}, 171 {440.0*pow(2.0,(69)/12.0), 16},
172 {0, 200}, 172 {0, 4},
173 {440.0*pow(2.0,(67)/12.0), 800} 173 {440.0*pow(2.0,(67)/12.0), 16}
174}; 174};
175#endif 175#endif
176 176
@@ -246,11 +246,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
246 246
247#ifdef AUDIO_ENABLE 247#ifdef AUDIO_ENABLE
248float start_up[][2] = { 248float start_up[][2] = {
249 {440.0*pow(2.0,(67)/12.0), 650}, 249 {440.0*pow(2.0,(67)/12.0), 12},
250 {440.0*pow(2.0,(64)/12.0), 450}, 250 {440.0*pow(2.0,(64)/12.0), 8},
251 {440.0*pow(2.0,(55)/12.0), 450}, 251 {440.0*pow(2.0,(55)/12.0), 8},
252 {440.0*pow(2.0,(60)/12.0), 450}, 252 {440.0*pow(2.0,(60)/12.0), 8},
253 {440.0*pow(2.0,(64)/12.0), 1000} 253 {440.0*pow(2.0,(64)/12.0), 20}
254}; 254};
255#endif 255#endif
256 256
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) {
255 255
256 256
257 note_position++; 257 note_position++;
258 if (note_position >= note_length) { 258 bool end_of_note = false;
259 if (ICR3 > 0)
260 end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF));
261 else
262 end_of_note = (note_position >= (note_length * 0x7FF));
263 if (end_of_note) {
259 current_note++; 264 current_note++;
260 if (current_note >= notes_length) { 265 if (current_note >= notes_length) {
261 if (notes_repeat) { 266 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 <http://www.gnu.org/licenses/>.
33 #include "audio.h" 33 #include "audio.h"
34 34
35 float goodbye[][2] = { 35 float goodbye[][2] = {
36 {440.0*pow(2.0,(67)/12.0), 400}, 36 {440.0*pow(2.0,(67)/12.0), 8},
37 {0, 50}, 37 {440.0*pow(2.0,(60)/12.0), 8},
38 {440.0*pow(2.0,(60)/12.0), 400}, 38 {440.0*pow(2.0,(55)/12.0), 12},
39 {0, 50},
40 {440.0*pow(2.0,(55)/12.0), 600},
41 }; 39 };
42#endif 40#endif
43 41
@@ -90,7 +88,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
90 action_t action; 88 action_t action;
91 clear_keyboard(); 89 clear_keyboard();
92 #ifdef AUDIO_ENABLE 90 #ifdef AUDIO_ENABLE
93 play_notes(&goodbye, 5, false); 91 play_notes(&goodbye, 3, false);
94 #endif 92 #endif
95 _delay_ms(250); 93 _delay_ms(250);
96 #ifdef ATREUS_ASTAR 94 #ifdef ATREUS_ASTAR