|
|
@@ -71,6 +71,10 @@
|
|
|
# define AUDIO_DEFAULT_CLICKY_ON true
|
|
|
#endif
|
|
|
|
|
|
+#ifndef AUDIO_SHUTDOWN_DELAY
|
|
|
+# define AUDIO_SHUTDOWN_DELAY 250
|
|
|
+#endif
|
|
|
+
|
|
|
#ifndef AUDIO_TONE_STACKSIZE
|
|
|
# define AUDIO_TONE_STACKSIZE 8
|
|
|
#endif
|
|
|
@@ -114,9 +118,14 @@ extern uint16_t voices_timer;
|
|
|
#ifndef AUDIO_OFF_SONG
|
|
|
# define AUDIO_OFF_SONG SONG(AUDIO_OFF_SOUND)
|
|
|
#endif
|
|
|
+#ifndef GOODBYE_SONG
|
|
|
+# define GOODBYE_SONG SONG(GOODBYE_SOUND)
|
|
|
+#endif
|
|
|
+
|
|
|
float startup_song[][2] = STARTUP_SONG;
|
|
|
float audio_on_song[][2] = AUDIO_ON_SONG;
|
|
|
float audio_off_song[][2] = AUDIO_OFF_SONG;
|
|
|
+float goodbye_song[][2] = GOODBYE_SONG;
|
|
|
|
|
|
static bool audio_initialized = false;
|
|
|
static bool audio_driver_stopped = true;
|
|
|
@@ -210,6 +219,18 @@ void audio_startup(void) {
|
|
|
last_timestamp = timer_read();
|
|
|
}
|
|
|
|
|
|
+void audio_shutdown(void) {
|
|
|
+ uint16_t timer_start = timer_read();
|
|
|
+
|
|
|
+ PLAY_SONG(goodbye_song);
|
|
|
+
|
|
|
+ while (timer_elapsed(timer_start) < AUDIO_SHUTDOWN_DELAY) {
|
|
|
+ wait_ms(1);
|
|
|
+ }
|
|
|
+
|
|
|
+ stop_all_notes();
|
|
|
+}
|
|
|
+
|
|
|
void audio_toggle(void) {
|
|
|
if (audio_config.enable) {
|
|
|
stop_all_notes();
|