summaryrefslogtreecommitdiff
path: root/quantum/audio
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-07-20 23:57:11 -0400
committerJack Humbert <jack.humb@gmail.com>2017-07-23 14:59:29 -0400
commit6a3c66776cb10888b24400526241b46deeb051a8 (patch)
tree7604aafe7087d9ab40aa0bb6bc603975e31d7e2e /quantum/audio
parent8edb67b08242f2ab641d7e658a0a7adb579bbae2 (diff)
clean-up planck and preonic keymaps, move audio stuff around
Diffstat (limited to 'quantum/audio')
-rw-r--r--quantum/audio/audio.c14
-rw-r--r--quantum/audio/audio.h2
-rw-r--r--quantum/audio/song_list.h42
3 files changed, 52 insertions, 6 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index c924f2bd58..5b85630932 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -13,6 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <stdio.h>
#include <string.h>
//#include <math.h>
@@ -119,9 +120,17 @@ audio_config_t audio_config;
uint16_t envelope_index = 0;
bool glissando = true;
+#ifndef STARTUP_SONG
+ #define STARTUP_SONG SONG(STARTUP_SOUND)
+#endif
+float startup_song[][2] = STARTUP_SONG;
+
void audio_init()
{
+ if (audio_initialized)
+ return;
+
// Check EEPROM
if (!eeconfig_is_enabled())
{
@@ -169,6 +178,11 @@ void audio_init()
#endif
audio_initialized = true;
+
+ if (audio_config.enable) {
+ PLAY_NOTE_ARRAY(startup_song, false, LEGATO);
+ }
+
}
void stop_all_notes()
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h
index 27fdc2ab63..ad3abeb78a 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)
// The global float array for the song must be used here.
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
-
+#define PLAY_SONG(song) PLAY_NOTE_ARRAY(song, false, STACCATO)
bool is_playing_notes(void);
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h
index db2d1a94cd..6960bee6da 100644
--- a/quantum/audio/song_list.h
+++ b/quantum/audio/song_list.h
@@ -18,9 +18,7 @@
#ifndef SONG_LIST_H
#define SONG_LIST_H
-#define COIN_SOUND \
- E__NOTE(_A5 ),\
- HD_NOTE(_E6 ),
+#define NO_SOUND
#define ODE_TO_JOY \
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
@@ -55,18 +53,29 @@
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
+#define STARTUP_SOUND \
+ E__NOTE(_E6), \
+ E__NOTE(_A6), \
+ ED_NOTE(_E7),
+
#define GOODBYE_SOUND \
E__NOTE(_E7), \
E__NOTE(_A6), \
ED_NOTE(_E6),
-#define STARTUP_SOUND \
+#define PLANCK_SOUND \
ED_NOTE(_E7 ), \
E__NOTE(_CS7), \
E__NOTE(_E6 ), \
E__NOTE(_A6 ), \
M__NOTE(_CS7, 20),
+#define PREONIC_SOUND \
+ M__NOTE(_B5, 20), \
+ E__NOTE(_B6), \
+ M__NOTE(_DS6, 20), \
+ E__NOTE(_B6),
+
#define QWERTY_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
@@ -107,7 +116,8 @@
S__NOTE(_REST), \
ED_NOTE(_E7 ),
-#define MUSIC_SCALE_SOUND \
+
+#define MUSIC_ON_SOUND \
E__NOTE(_A5 ), \
E__NOTE(_B5 ), \
E__NOTE(_CS6), \
@@ -117,6 +127,18 @@
E__NOTE(_GS6), \
E__NOTE(_A6 ),
+#define MUSIC_SCALE_SOUND MUSIC_ON_SOUND
+
+#define MUSIC_OFF_SOUND \
+ E__NOTE(_A6 ), \
+ E__NOTE(_GS6 ), \
+ E__NOTE(_FS6), \
+ E__NOTE(_E6 ), \
+ E__NOTE(_D6 ), \
+ E__NOTE(_CS6), \
+ E__NOTE(_B5), \
+ E__NOTE(_A5 ),
+
#define CAPS_LOCK_ON_SOUND \
E__NOTE(_A3), \
E__NOTE(_B3),
@@ -141,6 +163,16 @@
E__NOTE(_E5), \
E__NOTE(_D5),
+#define AG_NORM_SOUND \
+ E__NOTE(_A5), \
+ E__NOTE(_A5),
+
+#define AG_SWAP_SOUND \
+ SD_NOTE(_B5), \
+ SD_NOTE(_A5), \
+ SD_NOTE(_B5), \
+ SD_NOTE(_A5),
+
#define UNICODE_WINDOWS \
E__NOTE(_B5), \
S__NOTE(_E6),