diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2017-07-20 23:57:11 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-23 14:59:29 -0400 |
| commit | 6a3c66776cb10888b24400526241b46deeb051a8 (patch) | |
| tree | 7604aafe7087d9ab40aa0bb6bc603975e31d7e2e /quantum/audio | |
| parent | 8edb67b08242f2ab641d7e658a0a7adb579bbae2 (diff) | |
| download | qmk_firmware-6a3c66776cb10888b24400526241b46deeb051a8.tar.gz qmk_firmware-6a3c66776cb10888b24400526241b46deeb051a8.zip | |
clean-up planck and preonic keymaps, move audio stuff around
Diffstat (limited to 'quantum/audio')
| -rw-r--r-- | quantum/audio/audio.c | 14 | ||||
| -rw-r--r-- | quantum/audio/audio.h | 2 | ||||
| -rw-r--r-- | quantum/audio/song_list.h | 42 |
3 files changed, 52 insertions, 6 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index c924f2bd5..5b8563093 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include <stdio.h> | 17 | #include <stdio.h> |
| 17 | #include <string.h> | 18 | #include <string.h> |
| 18 | //#include <math.h> | 19 | //#include <math.h> |
| @@ -119,9 +120,17 @@ audio_config_t audio_config; | |||
| 119 | uint16_t envelope_index = 0; | 120 | uint16_t envelope_index = 0; |
| 120 | bool glissando = true; | 121 | bool glissando = true; |
| 121 | 122 | ||
| 123 | #ifndef STARTUP_SONG | ||
| 124 | #define STARTUP_SONG SONG(STARTUP_SOUND) | ||
| 125 | #endif | ||
| 126 | float startup_song[][2] = STARTUP_SONG; | ||
| 127 | |||
| 122 | void audio_init() | 128 | void audio_init() |
| 123 | { | 129 | { |
| 124 | 130 | ||
| 131 | if (audio_initialized) | ||
| 132 | return; | ||
| 133 | |||
| 125 | // Check EEPROM | 134 | // Check EEPROM |
| 126 | if (!eeconfig_is_enabled()) | 135 | if (!eeconfig_is_enabled()) |
| 127 | { | 136 | { |
| @@ -169,6 +178,11 @@ void audio_init() | |||
| 169 | #endif | 178 | #endif |
| 170 | 179 | ||
| 171 | audio_initialized = true; | 180 | audio_initialized = true; |
| 181 | |||
| 182 | if (audio_config.enable) { | ||
| 183 | PLAY_NOTE_ARRAY(startup_song, false, LEGATO); | ||
| 184 | } | ||
| 185 | |||
| 172 | } | 186 | } |
| 173 | 187 | ||
| 174 | void stop_all_notes() | 188 | void stop_all_notes() |
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h index 27fdc2ab6..ad3abeb78 100644 --- a/quantum/audio/audio.h +++ b/quantum/audio/audio.h | |||
| @@ -99,7 +99,7 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) | |||
| 99 | // The global float array for the song must be used here. | 99 | // The global float array for the song must be used here. |
| 100 | #define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0])))) | 100 | #define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0])))) |
| 101 | #define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style)); | 101 | #define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style)); |
| 102 | 102 | #define PLAY_SONG(song) PLAY_NOTE_ARRAY(song, false, STACCATO) | |
| 103 | 103 | ||
| 104 | bool is_playing_notes(void); | 104 | bool is_playing_notes(void); |
| 105 | 105 | ||
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index db2d1a94c..6960bee6d 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h | |||
| @@ -18,9 +18,7 @@ | |||
| 18 | #ifndef SONG_LIST_H | 18 | #ifndef SONG_LIST_H |
| 19 | #define SONG_LIST_H | 19 | #define SONG_LIST_H |
| 20 | 20 | ||
| 21 | #define COIN_SOUND \ | 21 | #define NO_SOUND |
| 22 | E__NOTE(_A5 ),\ | ||
| 23 | HD_NOTE(_E6 ), | ||
| 24 | 22 | ||
| 25 | #define ODE_TO_JOY \ | 23 | #define ODE_TO_JOY \ |
| 26 | Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ | 24 | Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ |
| @@ -55,18 +53,29 @@ | |||
| 55 | E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \ | 53 | E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \ |
| 56 | E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4), | 54 | E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4), |
| 57 | 55 | ||
| 56 | #define STARTUP_SOUND \ | ||
| 57 | E__NOTE(_E6), \ | ||
| 58 | E__NOTE(_A6), \ | ||
| 59 | ED_NOTE(_E7), | ||
| 60 | |||
| 58 | #define GOODBYE_SOUND \ | 61 | #define GOODBYE_SOUND \ |
| 59 | E__NOTE(_E7), \ | 62 | E__NOTE(_E7), \ |
| 60 | E__NOTE(_A6), \ | 63 | E__NOTE(_A6), \ |
| 61 | ED_NOTE(_E6), | 64 | ED_NOTE(_E6), |
| 62 | 65 | ||
| 63 | #define STARTUP_SOUND \ | 66 | #define PLANCK_SOUND \ |
| 64 | ED_NOTE(_E7 ), \ | 67 | ED_NOTE(_E7 ), \ |
| 65 | E__NOTE(_CS7), \ | 68 | E__NOTE(_CS7), \ |
| 66 | E__NOTE(_E6 ), \ | 69 | E__NOTE(_E6 ), \ |
| 67 | E__NOTE(_A6 ), \ | 70 | E__NOTE(_A6 ), \ |
| 68 | M__NOTE(_CS7, 20), | 71 | M__NOTE(_CS7, 20), |
| 69 | 72 | ||
| 73 | #define PREONIC_SOUND \ | ||
| 74 | M__NOTE(_B5, 20), \ | ||
| 75 | E__NOTE(_B6), \ | ||
| 76 | M__NOTE(_DS6, 20), \ | ||
| 77 | E__NOTE(_B6), | ||
| 78 | |||
| 70 | #define QWERTY_SOUND \ | 79 | #define QWERTY_SOUND \ |
| 71 | E__NOTE(_GS6 ), \ | 80 | E__NOTE(_GS6 ), \ |
| 72 | E__NOTE(_A6 ), \ | 81 | E__NOTE(_A6 ), \ |
| @@ -107,7 +116,8 @@ | |||
| 107 | S__NOTE(_REST), \ | 116 | S__NOTE(_REST), \ |
| 108 | ED_NOTE(_E7 ), | 117 | ED_NOTE(_E7 ), |
| 109 | 118 | ||
| 110 | #define MUSIC_SCALE_SOUND \ | 119 | |
| 120 | #define MUSIC_ON_SOUND \ | ||
| 111 | E__NOTE(_A5 ), \ | 121 | E__NOTE(_A5 ), \ |
| 112 | E__NOTE(_B5 ), \ | 122 | E__NOTE(_B5 ), \ |
| 113 | E__NOTE(_CS6), \ | 123 | E__NOTE(_CS6), \ |
| @@ -117,6 +127,18 @@ | |||
| 117 | E__NOTE(_GS6), \ | 127 | E__NOTE(_GS6), \ |
| 118 | E__NOTE(_A6 ), | 128 | E__NOTE(_A6 ), |
| 119 | 129 | ||
| 130 | #define MUSIC_SCALE_SOUND MUSIC_ON_SOUND | ||
| 131 | |||
| 132 | #define MUSIC_OFF_SOUND \ | ||
| 133 | E__NOTE(_A6 ), \ | ||
| 134 | E__NOTE(_GS6 ), \ | ||
| 135 | E__NOTE(_FS6), \ | ||
| 136 | E__NOTE(_E6 ), \ | ||
| 137 | E__NOTE(_D6 ), \ | ||
| 138 | E__NOTE(_CS6), \ | ||
| 139 | E__NOTE(_B5), \ | ||
| 140 | E__NOTE(_A5 ), | ||
| 141 | |||
| 120 | #define CAPS_LOCK_ON_SOUND \ | 142 | #define CAPS_LOCK_ON_SOUND \ |
| 121 | E__NOTE(_A3), \ | 143 | E__NOTE(_A3), \ |
| 122 | E__NOTE(_B3), | 144 | E__NOTE(_B3), |
| @@ -141,6 +163,16 @@ | |||
| 141 | E__NOTE(_E5), \ | 163 | E__NOTE(_E5), \ |
| 142 | E__NOTE(_D5), | 164 | E__NOTE(_D5), |
| 143 | 165 | ||
| 166 | #define AG_NORM_SOUND \ | ||
| 167 | E__NOTE(_A5), \ | ||
| 168 | E__NOTE(_A5), | ||
| 169 | |||
| 170 | #define AG_SWAP_SOUND \ | ||
| 171 | SD_NOTE(_B5), \ | ||
| 172 | SD_NOTE(_A5), \ | ||
| 173 | SD_NOTE(_B5), \ | ||
| 174 | SD_NOTE(_A5), | ||
| 175 | |||
| 144 | #define UNICODE_WINDOWS \ | 176 | #define UNICODE_WINDOWS \ |
| 145 | E__NOTE(_B5), \ | 177 | E__NOTE(_B5), \ |
| 146 | S__NOTE(_E6), | 178 | S__NOTE(_E6), |
