From e5501d48155a7c2855d4c30249e8d2d40b7c621a Mon Sep 17 00:00:00 2001
From: fauxpark <fauxpark@gmail.com>
Date: Wed, 25 Dec 2019 19:17:02 +1100
Subject: [PATCH] Make the keyboard beep when Audio is enabled and `\a` is
 encountered in a sendstring

---
 quantum/quantum.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/quantum/quantum.c b/quantum/quantum.c
index 4c501785c0..695da5fdcb 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -57,6 +57,9 @@ float goodbye_song[][2] = GOODBYE_SONG;
 #    ifdef DEFAULT_LAYER_SONGS
 float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
 #    endif
+#    ifdef SENDSTRING_BELL
+float bell_song[][2] = SONG(TERMINAL_SOUND);
+#    endif
 #endif
 
 static void do_code16(uint16_t code, void (*f)(uint8_t)) {
@@ -470,6 +473,13 @@ void send_string_with_delay_P(const char *str, uint8_t interval) {
 }
 
 void send_char(char ascii_code) {
+#if defined(AUDIO_ENABLE) && defined(SENDSTRING_BELL)
+    if (ascii_code == '\a') { // BEL
+        PLAY_SONG(bell_song);
+        return;
+    }
+#endif
+
     uint8_t keycode    = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]);
     bool    is_shifted = pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code]);
     bool    is_altgred = pgm_read_byte(&ascii_to_altgr_lut[(uint8_t)ascii_code]);