[vlc-devel] [PATCH 2/4] audiotrack: save original volume

Thomas Guillem thomas at gllm.fr
Tue Dec 1 17:58:35 CET 2020


In order to re-apply the gain > 1.f when audiotrack is restarted.

No functional changes for now since the sw gain is already saved. This
will be needed by next commits adding hw gain handling.
---
 modules/audio_output/audiotrack.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 20ed92bc57a..0af267b0416 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -2142,13 +2142,12 @@ VolumeSet( audio_output_t *p_aout, float volume )
     JNIEnv *env;
     float gain = 1.0f;
 
+    p_sys->volume = volume;
     if (volume > 1.f)
     {
-        p_sys->volume = 1.f;
-        gain = volume;
+        gain = volume * volume * volume;
+        volume = 1.f;
     }
-    else
-        p_sys->volume = volume;
 
     if( !p_sys->b_error && p_sys->p_audiotrack != NULL && ( env = GET_ENV() ) )
     {
@@ -2156,7 +2155,7 @@ VolumeSet( audio_output_t *p_aout, float volume )
     }
 
     aout_VolumeReport(p_aout, volume);
-    aout_GainRequest(p_aout, gain * gain * gain);
+    aout_GainRequest(p_aout, gain);
     return 0;
 }
 
-- 
2.28.0



More information about the vlc-devel mailing list