Add a D-Bus property "DisableStandby" to turn standby oo or off.
This commit is contained in:
+29
-8
@@ -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 {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<interface name="org.gnome.ShairportSync">
|
||||
<method name="Quit"/>
|
||||
<property name="DisableStandby" type="b" access="readwrite" />
|
||||
<property name="LoudnessFilterActive" type="b" access="readwrite" />
|
||||
<property name="LoudnessThreshold" type="d" access="readwrite" />
|
||||
<property name="DriftTolerance" type="d" access="readwrite" />
|
||||
|
||||
Reference in New Issue
Block a user