From 4e3726bfe11b02757c5724211d2a0fc62c7f66e8 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 15 Aug 2021 13:51:50 -0700 Subject: [PATCH] Fixup Audio startup and add to documents (#13606) * Fixup Audio startup and add to documents * fix doc descriptions --- docs/feature_audio.md | 26 ++++++++++++++++++++++++++ quantum/audio/audio.c | 3 +++ quantum/quantum.c | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/feature_audio.md b/docs/feature_audio.md index 9ffbc2cba82..5b84dc77473 100644 --- a/docs/feature_audio.md +++ b/docs/feature_audio.md @@ -167,6 +167,32 @@ The available keycodes for audio are: !> These keycodes turn all of the audio functionality on and off. Turning it off means that audio feedback, audio clicky, music mode, etc. are disabled, completely. +## Audio Config + +| Settings | Default | Description | +|---------------------------------|----------------------|-------------------------------------------------------------------------------| +|`AUDIO_PIN` | *Not defined* |Configures the pin that the speaker is connected to. | +|`AUDIO_PIN_ALT` | *Not defined* |Configures the pin for a second speaker or second pin connected to one speaker.| +|`AUDIO_PIN_ALT_AS_NEGATIVE` | *Not defined* |Enables support for one speaker connected to two pins. | +|`AUDIO_INIT_DELAY` | *Not defined* |Enables delay during startup song to accomidate for USB startup issues. | +|`AUDIO_ENABLE_TONE_MULTIPLEXING` | *Not defined* |Enables time splicing/multiplexing to create multiple tones simutaneously. | +|`STARTUP_SONG` | `STARTUP_SOUND` |Plays when the keyboard starts up (audio.c) | +|`GOODBYE_SONG` | `GOODBYE_SOUND` |Plays when you press the RESET key (quantum.c) | +|`AG_NORM_SONG` | `AG_NORM_SOUND` |Plays when you press AG_NORM (process_magic.c) | +|`AG_SWAP_SONG` | `AG_SWAP_SOUND` |Plays when you press AG_SWAP (process_magic.c) | +|`CG_NORM_SONG` | `AG_NORM_SOUND` |Plays when you press CG_NORM (process_magic.c) | +|`CG_SWAP_SONG` | `AG_SWAP_SOUND` |Plays when you press CG_SWAP (process_magic.c) | +|`MUSIC_ON_SONG` | `MUSIC_ON_SOUND` |Plays when music mode is activated (process_music.c) | +|`MUSIC_OFF_SONG` | `MUSIC_OFF_SOUND` |Plays when music mode is deactivated (process_music.c) | +|`MIDI_ON_SONG` | `MUSIC_ON_SOUND` |Plays when midi mode is activated (process_music.c) | +|`MIDI_OFF_SONG` | `MUSIC_OFF_SOUND` |Plays when midi mode is deactivated (process_music.c) | +|`CHROMATIC_SONG` | `CHROMATIC_SOUND` |Plays when the chromatic music mode is selected (process_music.c) | +|`GUITAR_SONG` | `GUITAR_SOUND` |Plays when the guitar music mode is selected (process_music.c) | +|`VIOLIN_SONG` | `VIOLIN_SOUND` |Plays when the violin music mode is selected (process_music.c) | +|`MAJOR_SONG` | `MAJOR_SOUND` |Plays when the major music mode is selected (process_music.c) | +|`DEFAULT_LAYER_SONGS` | *Not defined* |Plays song when switched default layers with [`set_single_persistent_default_layer(layer)`](ref_functions.md#setting-the-persistent-default-layer)(quantum.c) | +|`SENDSTRING_BELL` | *Not defined* |Plays chime when the "enter" ("\a") character is sent (send_string.c) | + ## Tempo the 'speed' at which SONGs are played is dictated by the set Tempo, which is measured in beats-per-minute. Note lengths are defined relative to that. The initial/default tempo is set to 120 bpm, but can be configured by setting `TEMPO_DEFAULT` in `config.c`. diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index 46277dd70bf..49bb309e80f 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -139,6 +139,9 @@ void audio_init() { audio_initialized = true; } stop_all_notes(); +#ifndef AUDIO_INIT_DELAY + audio_startup(); +#endif } void audio_startup(void) { diff --git a/quantum/quantum.c b/quantum/quantum.c index d173388714c..e60378afe4b 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -398,7 +398,7 @@ void matrix_init_quantum() { } void matrix_scan_quantum() { -#if defined(AUDIO_ENABLE) +#if defined(AUDIO_ENABLE) && defined(AUDIO_INIT_DELAY) // There are some tasks that need to be run a little bit // after keyboard startup, or else they will not work correctly // because of interaction with the USB device state, which