Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
88dd3b4f
Commit
88dd3b4f
authored
May 19, 2016
by
Andrew Eikum
Committed by
Alexandre Julliard
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Support downmixing 5.1 to stereo.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4fbe6f3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
0 deletions
+56
-0
dsound_convert.c
dlls/dsound/dsound_convert.c
+46
-0
dsound_private.h
dlls/dsound/dsound_private.h
+2
-0
mixer.c
dlls/dsound/mixer.c
+8
-0
No files found.
dlls/dsound/dsound_convert.c
View file @
88dd3b4f
...
...
@@ -157,6 +157,13 @@ void putieee32(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, floa
*
fbuf
=
value
;
}
void
putieee32_sum
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
pos
,
DWORD
channel
,
float
value
)
{
BYTE
*
buf
=
(
BYTE
*
)
dsb
->
device
->
tmp_buffer
;
float
*
fbuf
=
(
float
*
)(
buf
+
pos
+
sizeof
(
float
)
*
channel
);
*
fbuf
+=
value
;
}
void
put_mono2stereo
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
pos
,
DWORD
channel
,
float
value
)
{
dsb
->
put_aux
(
dsb
,
pos
,
0
,
value
);
...
...
@@ -206,6 +213,45 @@ 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 */
switch
(
channel
){
case
4
:
/* back left */
value
*=
0
.
056
f
;
/* (1/9) / (sum of left volumes) */
dsb
->
put_aux
(
dsb
,
pos
,
0
,
value
);
break
;
case
0
:
/* front left */
value
*=
0
.
503
;
/* 1 / (sum of left volumes) */
dsb
->
put_aux
(
dsb
,
pos
,
0
,
value
);
break
;
case
5
:
/* back right */
value
*=
0
.
056
f
;
/* (1/9) / (sum of right volumes) */
dsb
->
put_aux
(
dsb
,
pos
,
1
,
value
);
break
;
case
1
:
/* front right */
value
*=
0
.
503
f
;
/* 1 / (sum of right volumes) */
dsb
->
put_aux
(
dsb
,
pos
,
1
,
value
);
break
;
case
2
:
/* front centre */
value
*=
0
.
252
f
;
/* 0.5 / (sum of left/right volumes) */
dsb
->
put_aux
(
dsb
,
pos
,
0
,
value
);
dsb
->
put_aux
(
dsb
,
pos
,
1
,
value
);
break
;
case
3
:
/* LFE */
value
*=
0
.
189
f
;
/* 0.375 / (sum of left/right volumes) */
dsb
->
put_aux
(
dsb
,
pos
,
0
,
value
);
dsb
->
put_aux
(
dsb
,
pos
,
1
,
value
);
break
;
}
}
void
mixieee32
(
float
*
src
,
float
*
dst
,
unsigned
samples
)
{
TRACE
(
"%p - %p %d
\n
"
,
src
,
dst
,
samples
);
...
...
dlls/dsound/dsound_private.h
View file @
88dd3b4f
...
...
@@ -47,6 +47,7 @@ typedef float (*bitsgetfunc)(const IDirectSoundBufferImpl *, DWORD, DWORD);
typedef
void
(
*
bitsputfunc
)(
const
IDirectSoundBufferImpl
*
,
DWORD
,
DWORD
,
float
);
extern
const
bitsgetfunc
getbpp
[
5
]
DECLSPEC_HIDDEN
;
void
putieee32
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
pos
,
DWORD
channel
,
float
value
)
DECLSPEC_HIDDEN
;
void
putieee32_sum
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
pos
,
DWORD
channel
,
float
value
)
DECLSPEC_HIDDEN
;
void
mixieee32
(
float
*
src
,
float
*
dst
,
unsigned
samples
)
DECLSPEC_HIDDEN
;
typedef
void
(
*
normfunc
)(
const
void
*
,
void
*
,
unsigned
);
extern
const
normfunc
normfunctions
[
4
]
DECLSPEC_HIDDEN
;
...
...
@@ -177,6 +178,7 @@ void put_mono2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel,
void
put_stereo2quad
(
const
IDirectSoundBufferImpl
*
dsb
,
DWORD
pos
,
DWORD
channel
,
float
value
)
DECLSPEC_HIDDEN
;
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
;
HRESULT
secondarybuffer_create
(
DirectSoundDevice
*
device
,
const
DSBUFFERDESC
*
dsbd
,
IDirectSoundBuffer
**
buffer
)
DECLSPEC_HIDDEN
;
...
...
dlls/dsound/mixer.c
View file @
88dd3b4f
...
...
@@ -173,6 +173,12 @@ void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb)
dsb
->
mix_channels
=
2
;
dsb
->
put
=
put_stereo2surround51
;
}
else
if
(
ichannels
==
6
&&
ochannels
==
2
)
{
dsb
->
mix_channels
=
6
;
dsb
->
put
=
put_surround512stereo
;
dsb
->
put_aux
=
putieee32_sum
;
}
else
{
if
(
ichannels
>
2
)
...
...
@@ -495,6 +501,8 @@ static DWORD DSOUND_MixInBuffer(IDirectSoundBufferImpl *dsb, float *mix_buffer,
/* Resample buffer to temporary buffer specifically allocated for this purpose, if needed */
oldpos
=
dsb
->
sec_mixpos
;
if
(
dsb
->
put_aux
==
putieee32_sum
)
memset
(
dsb
->
device
->
tmp_buffer
,
0
,
dsb
->
device
->
tmp_buffer_len
);
DSOUND_MixToTemporary
(
dsb
,
frames
);
ibuf
=
dsb
->
device
->
tmp_buffer
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment