Chore: Store gain_correct on stream details
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 31 Jan 2025 13:48:48 +0000 (14:48 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 31 Jan 2025 13:48:48 +0000 (14:48 +0100)
music_assistant/controllers/streams.py

index c5f5d11b6e23cfc0d79321042af340b5bd4ad6f9..11b966bd3aac5aa9f3b279db4ad1b0148c97462f 100644 (file)
@@ -795,6 +795,7 @@ class StreamsController(CoreController):
         filter_params = []
         extra_input_args = streamdetails.extra_input_args or []
         # handle volume normalization
+        gain_correct: float | None = None
         if streamdetails.volume_normalization_mode == VolumeNormalizationMode.DYNAMIC:
             # volume normalization using loudnorm filter (in dynamic mode)
             # which also collects the measurement on the fly during playback
@@ -818,6 +819,7 @@ class StreamsController(CoreController):
             gain_correct = streamdetails.target_loudness - streamdetails.loudness
             gain_correct = round(gain_correct, 2)
             filter_params.append(f"volume={gain_correct}dB")
+        streamdetails.volume_normalization_gain_correct = gain_correct
 
         # work out audio source for these streamdetails
         if streamdetails.stream_type == StreamType.CUSTOM: