diff options
author | Mike Brady <mikebrady@eircom.net> | 2019-01-11 14:48:00 +0000 |
---|---|---|
committer | Mike Brady <mikebrady@eircom.net> | 2019-01-11 14:48:00 +0000 |
commit | a74261bbd35e2821e5ef4f22496ff6dafff4181f (patch) | |
tree | b3cb262b0a95d35d1c15f8da380519f4cecbc120 /dbus-service.c | |
parent | b9d78c8af64f5e5af4a92fba3e616e3573c20142 (diff) |
Add a D-Bus property "DisableStandby" to turn standby oo or off.
Diffstat (limited to 'dbus-service.c')
-rw-r--r-- | dbus-service.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/dbus-service.c b/dbus-service.c index c163ddb..9ae1d0a 100644 --- a/dbus-service.c +++ b/dbus-service.c @@ -378,14 +378,27 @@ gboolean notify_verbosity_callback(ShairportSyncDiagnostics *skeleton, return TRUE; } +gboolean notify_disable_standby_callback(ShairportSync *skeleton, + __attribute__((unused)) gpointer user_data) { + // debug(1, "\"notify_disable_standby_callback\" called."); + if (shairport_sync_get_disable_standby(skeleton)) { + debug(1, ">> activating disable standby"); + config.keep_dac_busy = 1; + } else { + debug(1, ">> deactivating disable standby"); + config.keep_dac_busy = 0; + } + return TRUE; +} + gboolean notify_loudness_filter_active_callback(ShairportSync *skeleton, __attribute__((unused)) gpointer user_data) { - debug(1, "\"notify_loudness_filter_active_callback\" called."); + // debug(1, "\"notify_loudness_filter_active_callback\" called."); if (shairport_sync_get_loudness_filter_active(skeleton)) { - debug(1, "activating loudness filter"); + debug(1, ">> activating loudness filter"); config.loudness = 1; } else { - debug(1, "deactivating loudness filter"); + debug(1, ">> deactivating loudness filter"); config.loudness = 0; } return TRUE; @@ -395,10 +408,10 @@ gboolean notify_loudness_threshold_callback(ShairportSync *skeleton, __attribute__((unused)) gpointer user_data) { gdouble th = shairport_sync_get_loudness_threshold(skeleton); if ((th <= 0.0) && (th >= -100.0)) { - debug(1, "Setting loudness threshhold to %f.", th); + debug(1, ">> setting loudness threshhold to %f.", th); config.loudness_reference_volume_db = th; } else { - debug(1, "Invalid loudness threshhold: %f. Ignored.", th); + debug(1, ">> invalid loudness threshhold: %f. Ignored.", th); shairport_sync_set_loudness_threshold(skeleton, config.loudness_reference_volume_db); } return TRUE; @@ -408,10 +421,10 @@ gboolean notify_drift_tolerance_callback(ShairportSync *skeleton, __attribute__((unused)) gpointer user_data) { gdouble dt = shairport_sync_get_drift_tolerance(skeleton); if ((dt >= 0.0) && (dt <= 2.0)) { - debug(1, "Setting drift tolerance to %f.", dt); + debug(1, ">> setting drift tolerance to %f seconds", dt); config.tolerance = dt; } else { - debug(1, "Invalid drift tolerance: %f. Ignored.", dt); + debug(1, ">> invalid drift tolerance: %f seconds. Ignored.", dt); shairport_sync_set_drift_tolerance(skeleton, config.tolerance); } return TRUE; @@ -611,7 +624,9 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name G_CALLBACK(notify_alacdecoder_callback), NULL); g_signal_connect(shairportSyncSkeleton, "notify::volume-control-profile", G_CALLBACK(notify_volume_control_profile_callback), NULL); - g_signal_connect(shairportSyncSkeleton, "notify::loudness-filter-active", + g_signal_connect(shairportSyncSkeleton, "notify::disable-standby", + G_CALLBACK(notify_disable_standby_callback), NULL); +g_signal_connect(shairportSyncSkeleton, "notify::loudness-filter-active", G_CALLBACK(notify_loudness_filter_active_callback), NULL); g_signal_connect(shairportSyncSkeleton, "notify::loudness-threshold", G_CALLBACK(notify_loudness_threshold_callback), NULL); @@ -710,6 +725,12 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name else shairport_sync_set_volume_control_profile(SHAIRPORT_SYNC(shairportSyncSkeleton), "flat"); + if (config.keep_dac_busy == 0) { + shairport_sync_set_disable_standby(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE); + } else { + shairport_sync_set_disable_standby(SHAIRPORT_SYNC(shairportSyncSkeleton), TRUE); + } + if (config.loudness == 0) { shairport_sync_set_loudness_filter_active(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE); } else { |