From: Mike Brady Date: Tue, 12 Feb 2019 15:47:10 +0000 (+0000) Subject: use the term'state' rather than 'mode' when taling about the active state. Use 'while... X-Git-Tag: 3.3RC0~64^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5af6179875a60076426cd9459b1a4e87e5fad413;p=thirdparty%2Fshairport-sync.git use the term'state' rather than 'mode' when taling about the active state. Use 'while_active' rather than 'while active' --- diff --git a/activity_monitor.c b/activity_monitor.c index ad0c528f..4377c89e 100644 --- a/activity_monitor.c +++ b/activity_monitor.c @@ -132,7 +132,7 @@ void activity_monitor_signify_activity(int active) { going_active( config.cmd_blocking); // note -- will be executed with the mutex locked, but that's okay } else if ((state == am_active) && (player_state == ps_inactive) && - (config.active_mode_timeout == 0.0)) { + (config.active_state_timeout == 0.0)) { going_inactive( config.cmd_blocking); // note -- will be executed with the mutex locked, but that's okay } @@ -189,14 +189,14 @@ void *activity_monitor_thread_code(void *arg) { // debug(1,"am_state: am_active"); while (player_state != ps_inactive) pthread_cond_wait(&activity_monitor_cv, &activity_monitor_mutex); - if (config.active_mode_timeout == 0.0) { + if (config.active_state_timeout == 0.0) { state = am_inactive; // going_inactive(); // this is done in activity_monitor_signify_activity } else { state = am_timing_out; uint64_t time_to_wait_for_wakeup_fp = - (uint64_t)(config.active_mode_timeout * 1000000); // resolution of microseconds + (uint64_t)(config.active_state_timeout * 1000000); // resolution of microseconds time_to_wait_for_wakeup_fp = time_to_wait_for_wakeup_fp << 32; time_to_wait_for_wakeup_fp = time_to_wait_for_wakeup_fp / 1000000; diff --git a/audio_alsa.c b/audio_alsa.c index 711a1767..dd114e28 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -989,12 +989,12 @@ static int init(int argc, char **argv) { else if ((strcasecmp(str, "yes") == 0) || (strcasecmp(str, "on") == 0) || (strcasecmp(str, "always") == 0)) { config.disable_standby_mode = disable_standby_always; config.keep_dac_busy = 1; - } else if (strcasecmp(str, "while active") == 0) + } else if (strcasecmp(str, "while_active") == 0) config.disable_standby_mode = disable_standby_while_active; else { warn("Invalid disable_standby_mode option choice \"%s\". It should be " - "\"always\", \"while active\" or \"never\". " - "It is set to \"while active\"."); + "\"always\", \"while_active\" or \"never\". " + "It is set to \"while_active\"."); } } diff --git a/common.h b/common.h index 6fdf38c1..78c9ddda 100644 --- a/common.h +++ b/common.h @@ -186,7 +186,7 @@ typedef struct { double audio_backend_latency_offset; // this will be the offset in seconds to compensate for any // fixed latency there might be in the audio path double audio_backend_silent_lead_in_time; // the length of the silence that should precede a play. - double active_mode_timeout; // the amount of time from when play ends to when the system leaves + double active_state_timeout; // the amount of time from when play ends to when the system leaves // into the "active" mode. uint32_t volume_range_db; // the range, in dB, from max dB to min dB. Zero means use the mixer's // native range. diff --git a/dbus-service.c b/dbus-service.c index 8656d919..2ed17d0a 100644 --- a/dbus-service.c +++ b/dbus-service.c @@ -441,7 +441,7 @@ gboolean notify_disable_standby_mode_callback(ShairportSync *skeleton, } else if ((strcasecmp(th, "yes") == 0) || (strcasecmp(th, "on") == 0) || (strcasecmp(th, "always") == 0)) { config.disable_standby_mode = disable_standby_always; config.keep_dac_busy = 1; - } else if (strcasecmp(th, "while active") == 0) + } else if (strcasecmp(th, "while_active") == 0) config.disable_standby_mode = disable_standby_while_active; else { warn("An unrecognised disable_standby_mode: \"%s\" was requested via D-Bus interface.", th); @@ -453,7 +453,7 @@ gboolean notify_disable_standby_mode_callback(ShairportSync *skeleton, shairport_sync_set_disable_standby_mode(skeleton, "always"); break; case disable_standby_while_active: - shairport_sync_set_disable_standby_mode(skeleton, "while active"); + shairport_sync_set_disable_standby_mode(skeleton, "while_active"); break; default: break; @@ -753,8 +753,8 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name debug(1, ">> disable standby mode set to \"always\""); break; case disable_standby_while_active: - shairport_sync_set_disable_standby_mode(SHAIRPORT_SYNC(shairportSyncSkeleton), "while active"); - debug(1, ">> disable standby mode set to \"while active\""); + shairport_sync_set_disable_standby_mode(SHAIRPORT_SYNC(shairportSyncSkeleton), "while_active"); + debug(1, ">> disable standby mode set to \"while_active\""); break; default: debug(1,"invalid disable_standby mode!"); diff --git a/metadata_hub.h b/metadata_hub.h index 9406851f..784f6621 100644 --- a/metadata_hub.h +++ b/metadata_hub.h @@ -12,10 +12,10 @@ enum play_status_type { PS_PLAYING, } play_status_type; -enum active_mode_type { +enum active_state_type { AM_INACTIVE = 0, AM_ACTIVE, -} active_mode_type; +} active_state_type; enum shuffle_status_type { SS_NOT_AVAILABLE = 0, @@ -82,7 +82,7 @@ typedef struct metadata_bundle { enum play_status_type player_state; // this is the state of the actual player itself, which can be a bit noisy. - enum active_mode_type active_state; + enum active_state_type active_state; int speaker_volume; // this is the actual speaker volume, allowing for the main volume and the // speaker volume control diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index 4a6ebe29..bf6ce4ba 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -56,10 +56,10 @@ sessioncontrol = // run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line // run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line -// "active" mode starts when play begins and ends when the active_mode_timeout has elapsed after play ends, unless another play session starts before the timeout has fully elapsed. -// run_this_before_entering_active_mode = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line -// run_this_after_exiting_active_mode = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line -// active_mode_timeout = 10; // wait for this number of seconds after play ends before leaving the active mode, unless another play session begins. +// "active" state starts when play begins and ends when the active_state_timeout has elapsed after play ends, unless another play session starts before the timeout has fully elapsed. +// run_this_before_entering_active_state = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line +// run_this_after_exiting_active_state = "/full/path/to/application and args"; // make sure the application has executable permission. If it's a script, include the shebang (#!/bin/...) on the first line +// active_state_timeout = 10; // wait for this number of seconds after play ends before leaving the active state, unless another play session begins. // run_this_if_an_unfixable_error_is_detected = "/full/path/to/application and args"; // if a problem occurs that can't be cleared by Shairport Sync itself, hook a program on here to deal with it. An error code-string is passed as the last argument. // Many of these "unfixable" problems are caused by malfunctioning output devices, and sometimes it is necessary to restart the whole device to clear the problem. @@ -86,7 +86,7 @@ alsa = // use_mmap_if_available = "yes"; // Use this optional advanced setting to control whether MMAP-based output is used to communicate with the DAC. Default is "yes" // use_hardware_mute_if_available = "no"; // Use this optional advanced setting to control whether the hardware in the DAC is used for muting. Default is "no", for compatibility with other audio players. // maximum_stall_time = 0.200; // Use this optional advanced setting to control how long to wait for data to be consumed by the output device before considering it an error. It should never approach 200 ms. -// disable_standby_mode = "no"; // Some DACs make small "popping" noises when they go in and out of standby mode. Set this to "yes" to keep the DAC active all the time. +// disable_standby_mode = "while_active"; // Some DACs make small "popping" noises when they go in and out of standby mode. Settings can be: "always", "while_active" or "never". Default is "while_active". You can use "yes" instead of "always" and "no instead of "never". }; // Parameters for the "sndio" audio back end. All are optional. diff --git a/shairport.c b/shairport.c index 7cb2c39a..0959e5f2 100644 --- a/shairport.c +++ b/shairport.c @@ -336,7 +336,7 @@ int parse_options(int argc, char **argv) { // nothing else comes in first. config.fixedLatencyOffset = 11025; // this sounds like it works properly. config.diagnostic_drop_packet_fraction = 0.0; - config.active_mode_timeout = 10.0; + config.active_state_timeout = 10.0; config.volume_range_hw_priority = 1; // if combining software and hardware volume control, give the hardware priority // i.e. when reducing volume, reduce the hw first before reducing the software. @@ -737,23 +737,23 @@ int parse_options(int argc, char **argv) { config.cmd_stop = (char *)str; } - if (config_lookup_string(config.cfg, "sessioncontrol.run_this_before_entering_active_mode", + if (config_lookup_string(config.cfg, "sessioncontrol.run_this_before_entering_active_state", &str)) { config.cmd_active_start = (char *)str; } - if (config_lookup_string(config.cfg, "sessioncontrol.run_this_after_exiting_active_mode", + if (config_lookup_string(config.cfg, "sessioncontrol.run_this_after_exiting_active_state", &str)) { config.cmd_active_stop = (char *)str; } - if (config_lookup_float(config.cfg, "sessioncontrol.active_mode_timeout", &dvalue)) { + if (config_lookup_float(config.cfg, "sessioncontrol.active_state_timeout", &dvalue)) { if (dvalue < 0.0) - warn("Invalid value \"%f\" for sessioncontrol.active_mode_timeout. It must be positive. " + warn("Invalid value \"%f\" for sessioncontrol.active_state_timeout. It must be positive. " "The default of %f will be used instead.", - dvalue, config.active_mode_timeout); + dvalue, config.active_state_timeout); else - config.active_mode_timeout = dvalue; + config.active_state_timeout = dvalue; } if (config_lookup_string(config.cfg, @@ -1542,9 +1542,9 @@ int main(int argc, char **argv) { debug(1, "wait-cmd status is %d.", config.cmd_blocking); debug(1, "run_this_before_play_begins may return output is %d.", config.cmd_start_returns_output); debug(1, "run_this_if_an_unfixable_error_is_detected action is \"%s\".", config.cmd_unfixable); - debug(1, "run_this_before_entering_active_mode action is \"%s\".", config.cmd_active_start); - debug(1, "run_this_after_exiting_active_mode action is \"%s\".", config.cmd_active_stop); - debug(1, "active_mode_timeout is %f seconds.", config.active_mode_timeout); + debug(1, "run_this_before_entering_active_state action is \"%s\".", config.cmd_active_start); + debug(1, "run_this_after_exiting_active_state action is \"%s\".", config.cmd_active_stop); + debug(1, "active_state_timeout is %f seconds.", config.active_state_timeout); debug(1, "mdns backend \"%s\".", config.mdns_name); debug(2, "userSuppliedLatency is %d.", config.userSuppliedLatency); debug(1, "stuffing option is \"%d\" (0-basic, 1-soxr).", config.packet_stuffing);