From: Mike Brady Date: Sun, 30 Apr 2017 17:56:56 +0000 (+0100) Subject: Add alsa_use_playback_switch_for_mute to the configuration data structure, so visible... X-Git-Tag: 3.1d16~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2dea79fa417df202937b0099a119a50880348b2c;p=thirdparty%2Fshairport-sync.git Add alsa_use_playback_switch_for_mute to the configuration data structure, so visible for debug summary. --- diff --git a/audio_alsa.c b/audio_alsa.c index 297ea7ea..b173ccc1 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -90,7 +90,6 @@ static int has_softvol = 0; static int volume_set_request = 0; // set when an external request is made to set the volume. int mute_request_pending = 0; // set when an external request is made to mute or unmute. int mute_request_state = 0; // 1 = mute; 0 = unmute requested -int use_playback_switch_for_mute = 1; // set to 0 for some cards, e.g. VMWare Fusion's emulated sound card static snd_pcm_sframes_t (*alsa_pcm_write)(snd_pcm_t *, const void *, snd_pcm_uframes_t) = snd_pcm_writei; @@ -145,7 +144,7 @@ static int init(int argc, char **argv) { set_period_size_request = 0; set_buffer_size_request = 0; - use_playback_switch_for_mute = 1; + config.alsa_use_playback_switch_for_mute = 1; config.audio_backend_latency_offset = 0; config.audio_backend_buffer_desired_length = 0.15; @@ -247,9 +246,9 @@ static int init(int argc, char **argv) { /* Get the mute_using_playback_switch setting. */ if (config_lookup_string(config.cfg, "alsa.mute_using_playback_switch", &str)) { if (strcasecmp(str, "no") == 0) - use_playback_switch_for_mute = 0; + config.alsa_use_playback_switch_for_mute = 0; else if (strcasecmp(str, "yes") == 0) - use_playback_switch_for_mute = 1; + config.alsa_use_playback_switch_for_mute = 1; else die("Invalid mute_use_playback_switch option choice \"%s\". It should be \"yes\" or \"no\""); } @@ -429,7 +428,7 @@ static int init(int argc, char **argv) { */ } } - if ((use_playback_switch_for_mute==1) && (snd_mixer_selem_has_playback_switch(alsa_mix_elem))) { + if ((config.alsa_use_playback_switch_for_mute==1) && (snd_mixer_selem_has_playback_switch(alsa_mix_elem))) { audio_alsa.mute = &mute; // insert the mute function now we know it can do muting stuff debug(1, "Has mute ability we will use."); } @@ -1002,7 +1001,7 @@ void do_mute(int mute_state_requested) { // If the hardware isn't there, or we are not allowed to use it, nothing will be done // The caller must have the alsa mutex if (hardware_mixer && alsa_mix_handle) { - if (use_playback_switch_for_mute==1) { + if (config.alsa_use_playback_switch_for_mute==1) { if (mute_request_pending==0) mute_request_state = mute_state_requested; if (mute_request_state) { diff --git a/common.h b/common.h index cb4b4b02..4dd62b19 100644 --- a/common.h +++ b/common.h @@ -146,6 +146,7 @@ typedef struct { int loudness; float loudness_reference_volume_db; + int alsa_use_playback_switch_for_mute; } shairport_cfg; diff --git a/shairport.c b/shairport.c index 356de378..4320f659 100644 --- a/shairport.c +++ b/shairport.c @@ -1277,6 +1277,7 @@ int main(int argc, char **argv) { debug(1, "zeroconf regtype is \"%s\".", config.regtype); debug(1, "decoders_supported field is %d.", config.decoders_supported); debug(1, "use_apple_decoder is %d.", config.use_apple_decoder); + debug(1, "alsa_use_playback_switch_for_mute is %d.", config.alsa_use_playback_switch_for_mute); if (config.interface) debug(1, "mdns service interface \"%s\" requested.", config.interface); else