[vlc-commits] amem: use gain request

Rémi Denis-Courmont git at videolan.org
Thu Jul 19 19:35:27 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 19 17:52:08 2012 +0300| [6057849282c14e5d73504baf65ede0f083d25598] | committer: Rémi Denis-Courmont

amem: use gain request

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6057849282c14e5d73504baf65ede0f083d25598
---

 modules/audio_output/amem.c |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/amem.c b/modules/audio_output/amem.c
index fbd0af8..4b904e1 100644
--- a/modules/audio_output/amem.c
+++ b/modules/audio_output/amem.c
@@ -109,6 +109,27 @@ static int MuteSet (audio_output_t *aout, bool mute)
     return sys->set_volume (sys->opaque, sys->volume, mute) ? -1 : 0;
 }
 
+static int SoftVolumeSet (audio_output_t *aout, float vol)
+{
+    aout_sys_t *sys = aout->sys;
+
+    vol = vol * vol * vol;
+    if (!sys->mute && aout_GainRequest (aout, vol))
+        return -1;
+    sys->volume = vol;
+    return 0;
+}
+
+static int SoftMuteSet (audio_output_t *aout, bool mute)
+{
+    aout_sys_t *sys = aout->sys;
+
+    if (aout_GainRequest (aout, mute ? 0.f : sys->volume))
+        return -1;
+    sys->mute = mute;
+    return 0;
+}
+
 typedef int (*vlc_audio_format_cb) (void **, char *, unsigned *, unsigned *);
 
 static int Open (vlc_object_t *obj)
@@ -221,7 +242,10 @@ static int Open (vlc_object_t *obj)
         aout->mute_set = MuteSet;
     }
     else
-        aout_VolumeSoftInit (aout);
+    {
+        aout->volume_set = SoftVolumeSet;
+        aout->mute_set = SoftMuteSet;
+    }
     return VLC_SUCCESS;
 
 error:



More information about the vlc-commits mailing list