From 287eb7ad148abc8fe3fb014218d71e205fd9131d Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 24 May 2016 11:56:53 -0400 Subject: Converted audio play functions to *_user (#349) * Updated personal layouts * tweaked personal * Nightly - Audio Cleanup Refactored the LUTs. Abstracted some of the registers out of audio to use more functional names. Split audio into audio and audio_pwm. WIP * nightly - collapsed code * Added check for note playing to LEDs * Usability tweaks * TWEAE * nightly added extra kcs to keymap common * turned on Plank audio * Added backlight breathing to atomic * reverted accidental merge * Added music and audio toggles to Quantum.c * Redid the audio callbacks * Adjusted default planck layout to use the user tone naming * tabs to spaces * Rewrote the ALL recipe to allow for faster parallel make * tabs to spaces * Renamed custom event functions to be 'startup_user' and 'shutdown_user'. Also moved the prototypes around. * Tweaked pvc atomic layout to work with the pvc planck. * updates midi scale calling --- keyboard/planck/keymaps/default/keymap.c | 43 +++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'keyboard/planck/keymaps/default/keymap.c') diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 36d496416e..3d62898171 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -174,21 +174,16 @@ const uint16_t PROGMEM fn_actions[] = { }; #ifdef AUDIO_ENABLE -float tone_startup[][2] = { - {440.0*pow(2.0,(31)/12.0), 12}, - {440.0*pow(2.0,(28)/12.0), 8}, - {440.0*pow(2.0,(19)/12.0), 8}, - {440.0*pow(2.0,(24)/12.0), 8}, - {440.0*pow(2.0,(28)/12.0), 20} -}; +float tone_startup[][2] = SONG(STARTUP_SOUND); float tone_qwerty[][2] = SONG(QWERTY_SOUND); float tone_dvorak[][2] = SONG(DVORAK_SOUND); float tone_colemak[][2] = SONG(COLEMAK_SOUND); float tone_plover[][2] = SONG(PLOVER_SOUND); float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); -float goodbye[][2] = SONG(GOODBYE_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); #endif @@ -288,16 +283,34 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) }; void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - _delay_ms(20); // stops the tick - PLAY_NOTE_ARRAY(tone_startup, false, 0); - #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif } #ifdef AUDIO_ENABLE -void play_goodbye_tone() + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() { - PLAY_NOTE_ARRAY(goodbye, false, 0); - _delay_ms(150); + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); } + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_NOTE_ARRAY(music_scale, false, 0); +} + #endif -- cgit v1.2.3