Nikola Pavlica : dsound: Revised 5.1 to stereo downmix.

Alexandre Julliard julliard at winehq.org
Fri Aug 23 09:31:26 CDT 2019


Module: wine
Branch: stable
Commit: 6c105094e42f16d65f31efabcfc3939f92a81854
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6c105094e42f16d65f31efabcfc3939f92a81854

Author: Nikola Pavlica <pavlica.nikola at gmail.com>
Date:   Tue Apr 23 20:04:22 2019 +0200

dsound: Revised 5.1 to stereo downmix.

Signed-off-by: Nikola Pavlica <pavlica.nikola at gmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 87eaa2f593d3a6b2e1440de3bf4c6b37ef089fcf)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/dsound/dsound_convert.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/dlls/dsound/dsound_convert.c b/dlls/dsound/dsound_convert.c
index 26dbb32..6171b16 100644
--- a/dlls/dsound/dsound_convert.c
+++ b/dlls/dsound/dsound_convert.c
@@ -216,39 +216,37 @@ void put_stereo2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD c
 
 void put_surround512stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value)
 {
-    /* based on pulseaudio's downmix algorithm */
+    /* based on analyzing a recording of a dsound downmix */
     switch(channel){
 
-    case 4: /* back left */
-        value *= 0.056f; /* (1/9) / (sum of left volumes) */
+    case 4: /* surround left */
+        value *= 0.24f;
         dsb->put_aux(dsb, pos, 0, value);
         break;
 
     case 0: /* front left */
-        value *= 0.503f; /* 1 / (sum of left volumes) */
+        value *= 1.0f;
         dsb->put_aux(dsb, pos, 0, value);
         break;
 
-    case 5: /* back right */
-        value *= 0.056f; /* (1/9) / (sum of right volumes) */
+    case 5: /* surround right */
+        value *= 0.24f;
         dsb->put_aux(dsb, pos, 1, value);
         break;
 
     case 1: /* front right */
-        value *= 0.503f; /* 1 / (sum of right volumes) */
+        value *= 1.0f;
         dsb->put_aux(dsb, pos, 1, value);
         break;
 
-    case 2: /* front centre */
-        value *= 0.252f; /* 0.5 / (sum of left/right volumes) */
+    case 2: /* centre */
+        value *= 0.7;
         dsb->put_aux(dsb, pos, 0, value);
         dsb->put_aux(dsb, pos, 1, value);
         break;
 
-    case 3: /* LFE */
-        value *= 0.189f; /* 0.375 / (sum of left/right volumes) */
-        dsb->put_aux(dsb, pos, 0, value);
-        dsb->put_aux(dsb, pos, 1, value);
+    case 3:
+        /* LFE is totally ignored in dsound when downmixing to 2 channels */
         break;
     }
 }




More information about the wine-cvs mailing list