Signed-off-by: Nikola Pavlica pavlica.nikola@gmail.com --- 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 26dbb3220a..0da9823298 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; } }
Signed-off-by: Nikola Pavlica pavlica.nikola@gmail.com --- dlls/dsound/dsound_convert.c | 47 ++++++++++++++++++++++++++++++++++++ dlls/dsound/dsound_private.h | 1 + dlls/dsound/mixer.c | 6 +++++ 3 files changed, 54 insertions(+)
diff --git a/dlls/dsound/dsound_convert.c b/dlls/dsound/dsound_convert.c index 0da9823298..db04ec1466 100644 --- a/dlls/dsound/dsound_convert.c +++ b/dlls/dsound/dsound_convert.c @@ -251,6 +251,53 @@ void put_surround512stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD c } }
+void put_surround712stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) +{ + /* based on analyzing a recording of a dsound downmix */ + switch(channel){ + + case 6: /* back left */ + value *= 0.24f; + dsb->put_aux(dsb, pos, 0, value); + break; + + case 4: /* surround left */ + value *= 0.24f; + dsb->put_aux(dsb, pos, 0, value); + break; + + case 0: /* front left */ + value *= 1.0f; + dsb->put_aux(dsb, pos, 0, value); + break; + + case 7: /* back right */ + value *= 0.24f; + dsb->put_aux(dsb, pos, 1, value); + break; + + case 5: /* surround right */ + value *= 0.24f; + dsb->put_aux(dsb, pos, 1, value); + break; + + case 1: /* front right */ + value *= 1.0f; + dsb->put_aux(dsb, pos, 1, value); + break; + + case 2: /* centre */ + value *= 0.7; + dsb->put_aux(dsb, pos, 0, value); + dsb->put_aux(dsb, pos, 1, value); + break; + + case 3: + /* LFE is totally ignored in dsound when downmixing to 2 channels */ + break; + } +} + void put_quad2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) { /* based on pulseaudio's downmix algorithm */ diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 45a100eee7..b04ce06275 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -179,6 +179,7 @@ void put_stereo2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel void put_mono2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; void put_stereo2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; void put_surround512stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; +void put_surround712stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; void put_quad2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd, diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c index 32bde3800e..05ca99b5df 100644 --- a/dlls/dsound/mixer.c +++ b/dlls/dsound/mixer.c @@ -179,6 +179,12 @@ void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) dsb->put = put_surround512stereo; dsb->put_aux = putieee32_sum; } + else if (ichannels == 8 && ochannels == 2) + { + dsb->mix_channels = 8; + dsb->put = put_surround712stereo; + dsb->put_aux = putieee32_sum; + } else if (ichannels == 4 && ochannels == 2) { dsb->mix_channels = 4;
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46996 Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Tue, Apr 23, 2019 at 08:04:23PM +0200, Nikola Pavlica wrote:
Signed-off-by: Nikola Pavlica pavlica.nikola@gmail.com
dlls/dsound/dsound_convert.c | 47 ++++++++++++++++++++++++++++++++++++ dlls/dsound/dsound_private.h | 1 + dlls/dsound/mixer.c | 6 +++++ 3 files changed, 54 insertions(+)
diff --git a/dlls/dsound/dsound_convert.c b/dlls/dsound/dsound_convert.c index 0da9823298..db04ec1466 100644 --- a/dlls/dsound/dsound_convert.c +++ b/dlls/dsound/dsound_convert.c @@ -251,6 +251,53 @@ void put_surround512stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD c } }
+void put_surround712stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) +{
- /* based on analyzing a recording of a dsound downmix */
- switch(channel){
- case 6: /* back left */
value *= 0.24f;
dsb->put_aux(dsb, pos, 0, value);
break;
- case 4: /* surround left */
value *= 0.24f;
dsb->put_aux(dsb, pos, 0, value);
break;
- case 0: /* front left */
value *= 1.0f;
dsb->put_aux(dsb, pos, 0, value);
break;
- case 7: /* back right */
value *= 0.24f;
dsb->put_aux(dsb, pos, 1, value);
break;
- case 5: /* surround right */
value *= 0.24f;
dsb->put_aux(dsb, pos, 1, value);
break;
- case 1: /* front right */
value *= 1.0f;
dsb->put_aux(dsb, pos, 1, value);
break;
- case 2: /* centre */
value *= 0.7;
dsb->put_aux(dsb, pos, 0, value);
dsb->put_aux(dsb, pos, 1, value);
break;
- case 3:
/* LFE is totally ignored in dsound when downmixing to 2 channels */
break;
- }
+}
void put_quad2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) { /* based on pulseaudio's downmix algorithm */ diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 45a100eee7..b04ce06275 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -179,6 +179,7 @@ void put_stereo2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel void put_mono2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; void put_stereo2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; void put_surround512stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; +void put_surround712stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN; void put_quad2stereo(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd, diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c index 32bde3800e..05ca99b5df 100644 --- a/dlls/dsound/mixer.c +++ b/dlls/dsound/mixer.c @@ -179,6 +179,12 @@ void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) dsb->put = put_surround512stereo; dsb->put_aux = putieee32_sum; }
- else if (ichannels == 8 && ochannels == 2)
- {
dsb->mix_channels = 8;
dsb->put = put_surround712stereo;
dsb->put_aux = putieee32_sum;
- } else if (ichannels == 4 && ochannels == 2) { dsb->mix_channels = 4;
-- 2.21.0
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Tue, Apr 23, 2019 at 08:04:22PM +0200, Nikola Pavlica wrote:
Signed-off-by: Nikola Pavlica pavlica.nikola@gmail.com
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 26dbb3220a..0da9823298 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;
}
2.21.0