Files
Radxa_MIXER/sources/shairport-native-volume.patch
T

38 lines
1.2 KiB
Diff

--- a/dbus-service.c
+++ b/dbus-service.c
@@ -715,6 +715,7 @@
if (((iv >= -30.0) && (iv <= 0.0)) || (iv == -144.0)) {
debug(2, ">> set volume to %7.4f.", iv);
config.airplay_volume = iv;
+ rtsp_set_native_volume(iv);
} else {
debug(1, ">> invalid volume: %f. Ignored.", iv);
shairport_sync_set_volume(skeleton, config.airplay_volume);
--- a/rtsp.h
+++ b/rtsp.h
@@ -31,6 +31,7 @@
// this will release the play lock only if the conn has it or if the conn is NULL
void stop_play(); // stop and drop a playing connection
+void rtsp_set_native_volume(double volume);
#ifdef CONFIG_AIRPLAY_2
ssize_t read_encrypted(int fd, pair_cipher_bundle *ctx, void *buf, size_t count);
--- a/rtsp.c
+++ b/rtsp.c
@@ -278,6 +278,14 @@
// other devices.
// If a conn has play lock, kill the connection completely.
+
+/* Update the existing player gain, without an additional gain stage. */
+void rtsp_set_native_volume(double volume) {
+ pthread_rwlock_rdlock(&principal_conn_lock);
+ if (principal_conn != NULL)
+ player_volume_without_notification(volume, principal_conn);
+ pthread_rwlock_unlock(&principal_conn_lock);
+}
void stop_play() {
pthread_rwlock_wrlock(&principal_conn_lock);