]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
use the term'state' rather than 'mode' when taling about the active state. Use 'while...
authorMike Brady <mikebrady@eircom.net>
Tue, 12 Feb 2019 15:47:10 +0000 (15:47 +0000)
committerMike Brady <mikebrady@eircom.net>
Tue, 12 Feb 2019 15:47:10 +0000 (15:47 +0000)
activity_monitor.c
audio_alsa.c
common.h
dbus-service.c
metadata_hub.h
scripts/shairport-sync.conf
shairport.c

index ad0c528f228843a2f0b17d2a7a371d56690c0ccc..4377c89e3b92597735bdc7c06ae6a5bd3780cb39 100644 (file)
@@ -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;
 
index 711a1767a47e5fe363b01f66cd69e46aedc85164..dd114e2824179673701ac28412f04da7e662430d 100644 (file)
@@ -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\".");
       }
     }
 
index 6fdf38c1b3e2d45c5677d1554f24a3adbb3c5d7e..78c9ddda02701446604b8b76f74bf18a327b7ae7 100644 (file)
--- 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.
index 8656d91913eedde6055fba89d4372ae77795b75e..2ed17d0ab02cfae19345a90520cf5018bd943962 100644 (file)
@@ -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!");
index 9406851fd9b5e8337a26a187c9cc156a63483225..784f6621ffe59b582954eb49c30a0948a759bf6d 100644 (file)
@@ -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
index 4a6ebe29770365f70a2db8ccb96d7c3011e9528b..bf6ce4ba4ba0c1221421aa7cc683e549fc94e558 100644 (file)
@@ -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.
index 7cb2c39ad60bc5050ac613234d21d3edb5d9e52c..0959e5f2dbc9dbbbb1020b2f7b141a9b0bbd3308 100644 (file)
@@ -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);