Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
e2d86e44
Commit
e2d86e44
authored
Mar 22, 2015
by
Mark Harmstone
Committed by
Vitaly Lipatov
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Implement EAX decorrelator.
parent
979108df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
dsound_eax.h
dlls/dsound/dsound_eax.h
+3
-0
eax.c
dlls/dsound/eax.c
+46
-0
No files found.
dlls/dsound/dsound_eax.h
View file @
e2d86e44
...
...
@@ -151,6 +151,9 @@ typedef struct {
unsigned
int
Offset
[
4
];
}
Early
;
DelayLine
Decorrelator
;
unsigned
int
DecoTap
[
3
];
unsigned
int
Offset
;
}
eax_buffer_info
;
...
...
dlls/dsound/eax.c
View file @
e2d86e44
...
...
@@ -92,11 +92,21 @@ static const EFXEAXREVERBPROPERTIES efx_presets[] = {
{
0
.
0625
f
,
0
.
5000
f
,
0
.
3162
f
,
0
.
8404
f
,
1
.
0000
f
,
7
.
5600
f
,
0
.
9100
f
,
1
.
0000
f
,
0
.
4864
f
,
0
.
0200
f
,
{
0
.
0000
f
,
0
.
0000
f
,
0
.
0000
f
},
2
.
4378
f
,
0
.
0300
f
,
{
0
.
0000
f
,
0
.
0000
f
,
0
.
0000
f
},
0
.
2500
f
,
0
.
0000
f
,
4
.
0000
f
,
1
.
0000
f
,
0
.
9943
f
,
5000
.
0000
f
,
250
.
0000
f
,
0
.
0000
f
,
0x0
}
/* psychotic */
};
static
const
float
DECO_FRACTION
=
0
.
15
f
;
static
const
float
DECO_MULTIPLIER
=
2
.
0
f
;
static
const
float
EARLY_LINE_LENGTH
[
4
]
=
{
0
.
0015
f
,
0
.
0045
f
,
0
.
0135
f
,
0
.
0405
f
};
static
const
float
LATE_LINE_LENGTH
[
4
]
=
{
0
.
0211
f
,
0
.
0311
f
,
0
.
0461
f
,
0
.
06
80
f
};
static
const
float
LATE_LINE_MULTIPLIER
=
4
.
0
f
;
static
float
lpFilter2P
(
FILTER
*
iir
,
unsigned
int
offset
,
float
input
)
{
float
*
history
=
&
iir
->
history
[
offset
*
2
];
...
...
@@ -273,6 +283,26 @@ static float lpCoeffCalc(float g, float cw)
return
a
;
}
static
void
UpdateDecorrelator
(
float
density
,
unsigned
int
frequency
,
eax_buffer_info
*
State
)
{
unsigned
int
index
;
float
length
;
/* The late reverb inputs are decorrelated to smooth the reverb tail and
* reduce harsh echos. The first tap occurs immediately, while the
* remaining taps are delayed by multiples of a fraction of the smallest
* cyclical delay time.
*
* offset[index] = (FRACTION (MULTIPLIER^index)) smallest_delay
*/
for
(
index
=
0
;
index
<
3
;
index
++
)
{
length
=
(
DECO_FRACTION
*
powf
(
DECO_MULTIPLIER
,
(
float
)
index
))
*
LATE_LINE_LENGTH
[
0
]
*
(
1
.
0
f
+
(
density
*
LATE_LINE_MULTIPLIER
));
State
->
DecoTap
[
index
]
=
fastf2u
(
length
*
frequency
);
}
}
static
float
CalcI3DL2HFreq
(
float
hfRef
,
unsigned
int
frequency
)
{
return
cosf
(
M_PI
*
2
.
0
f
*
hfRef
/
frequency
);
...
...
@@ -333,6 +363,13 @@ static BOOL AllocLines(unsigned int frequency, IDirectSoundBufferImpl *dsb)
totalSamples
+=
CalcLineLength
(
EARLY_LINE_LENGTH
[
index
],
totalSamples
,
frequency
,
&
dsb
->
eax
.
Early
.
Delay
[
index
]);
/* The decorrelator line is calculated from the lowest reverb density (a
* parameter value of 1). */
length
=
(
DECO_FRACTION
*
DECO_MULTIPLIER
*
DECO_MULTIPLIER
)
*
LATE_LINE_LENGTH
[
0
]
*
(
1
.
0
f
+
LATE_LINE_MULTIPLIER
);
totalSamples
+=
CalcLineLength
(
length
,
totalSamples
,
frequency
,
&
dsb
->
eax
.
Decorrelator
);
if
(
totalSamples
!=
dsb
->
eax
.
TotalSamples
)
{
TRACE
(
"New reverb buffer length: %u samples (%f sec)
\n
"
,
totalSamples
,
totalSamples
/
(
float
)
frequency
);
...
...
@@ -350,6 +387,7 @@ static BOOL AllocLines(unsigned int frequency, IDirectSoundBufferImpl *dsb)
/* Update all delays to reflect the new sample buffer. */
RealizeLineOffset
(
dsb
->
eax
.
SampleBuffer
,
&
dsb
->
eax
.
Delay
);
RealizeLineOffset
(
dsb
->
eax
.
SampleBuffer
,
&
dsb
->
eax
.
Decorrelator
);
for
(
index
=
0
;
index
<
4
;
index
++
)
{
RealizeLineOffset
(
dsb
->
eax
.
SampleBuffer
,
&
dsb
->
eax
.
Early
.
Delay
[
index
]);
...
...
@@ -390,6 +428,8 @@ static void ReverbUpdate(IDirectSoundBufferImpl *dsb)
UpdateEarlyLines
(
dsb
->
device
->
eax
.
eax_props
.
flGain
,
dsb
->
device
->
eax
.
eax_props
.
flReflectionsGain
,
dsb
->
device
->
eax
.
eax_props
.
flLateReverbDelay
,
&
dsb
->
eax
);
UpdateDecorrelator
(
dsb
->
device
->
eax
.
eax_props
.
flDensity
,
dsb
->
device
->
pwfx
->
nSamplesPerSec
,
&
dsb
->
eax
);
}
static
BOOL
ReverbDeviceUpdate
(
DirectSoundDevice
*
dev
)
...
...
@@ -428,6 +468,12 @@ void init_eax_buffer(IDirectSoundBufferImpl *dsb)
dsb
->
eax
.
Early
.
Offset
[
index
]
=
0
;
}
dsb
->
eax
.
Decorrelator
.
Mask
=
0
;
dsb
->
eax
.
Decorrelator
.
Line
=
NULL
;
dsb
->
eax
.
DecoTap
[
0
]
=
0
;
dsb
->
eax
.
DecoTap
[
1
]
=
0
;
dsb
->
eax
.
DecoTap
[
2
]
=
0
;
dsb
->
eax
.
Offset
=
0
;
ReverbUpdate
(
dsb
);
...
...
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