• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Pipewireパッケージ(ちょっと変更)


Commit MetaInfo

Revisiónc5cc364794df56ff8e843181935caf64712e36f7 (tree)
Tiempo2023-10-03 14:15:17
AutorChristian Glombek <lorbus@fedo...>
CommiterChristian Glombek

Log Message

module-raop-sink: Fix volume calculation

The volume interval that RAOP devices understand is [-30,0],
where -30.0 equals min vol, and 0.0 equals max. vol.

The local system volume is represented as a cubic (volumetric)
value in the [0,1] interval.

So cube root system volume value, scale by 30 and
translate -30 to map to target output range.

The special value -144 denotes volume mute. Send a corresponding RTSP
message when mute is not already toggled on.

Cambiar Resumen

Diferencia incremental

--- a/src/modules/module-raop-sink.c
+++ b/src/modules/module-raop-sink.c
@@ -148,9 +148,9 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
148148 #define DEFAULT_CHANNELS 2
149149 #define DEFAULT_POSITION "[ FL FR ]"
150150
151-#define VOLUME_MAX 0.0
152-#define VOLUME_DEF -30.0
153-#define VOLUME_MIN -144.0
151+#define VOLUME_MAX 0.0
152+#define VOLUME_MIN -30.0
153+#define VOLUME_MUTE -144.0
154154
155155 #define MODULE_USAGE "( raop.ip=<ip address of host> ) " \
156156 "( raop.port=<remote port> ) " \
@@ -1723,6 +1723,10 @@ static void stream_props_changed(struct impl *impl, uint32_t id, const struct sp
17231723 {
17241724 bool mute;
17251725 if (spa_pod_get_bool(&prop->value, &mute) == 0) {
1726+ if (!impl->mute) {
1727+ impl->volume = VOLUME_MUTE;
1728+ rtsp_send_volume(impl);
1729+ }
17261730 impl->mute = mute;
17271731 }
17281732 spa_pod_builder_prop(&b, SPA_PROP_softMute, 0);
@@ -1744,7 +1748,7 @@ static void stream_props_changed(struct impl *impl, uint32_t id, const struct sp
17441748 soft_vols[i] = 1.0f;
17451749 }
17461750 volume /= n_vols;
1747- volume = SPA_CLAMPF(20.0 * log10(volume), VOLUME_MIN, VOLUME_MAX);
1751+ volume = SPA_CLAMPF(cbrt(volume) * 30 - 30, VOLUME_MIN, VOLUME_MAX);
17481752 impl->volume = volume;
17491753
17501754 rtsp_send_volume(impl);