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
8de6b7da
Commit
8de6b7da
authored
Jul 05, 2007
by
Romain Iehl
Committed by
Alexandre Julliard
Jul 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Simplify the calculation of sound attenuation due to distance.
parent
3a8ae53d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
15 deletions
+2
-15
sound3d.c
dlls/dsound/sound3d.c
+2
-15
No files found.
dlls/dsound/sound3d.c
View file @
8de6b7da
...
...
@@ -53,8 +53,6 @@
#include "dsdriver.h"
#include "dsound_private.h"
/* default intensity level for human ears */
#define DEFAULT_INTENSITY 0.000000000001f
/* default velocity of sound in the air */
#define DEFAULT_VELOCITY 340
...
...
@@ -167,9 +165,6 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
{
/* volume, at which the sound will be played after all calcs. */
D3DVALUE
lVolume
=
0
;
/* intensity (used for distance related stuff) */
double
flIntensity
;
double
flTemp
;
/* stuff for distance related stuff calc. */
D3DVECTOR
vDistance
;
D3DVALUE
flDistance
=
0
;
...
...
@@ -223,16 +218,8 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
if
(
flDistance
<
dsb
->
ds3db_ds3db
.
flMinDistance
)
flDistance
=
dsb
->
ds3db_ds3db
.
flMinDistance
;
/* the following formula is taken from my physics book. I think it's ok for the *real* world...i hope m$ does it that way */
lVolume
+=
10000
;
/* ms likes working with negative volume...i don't */
lVolume
/=
1000
;
/* convert hundreths of dB into B */
/* intensity level (loudness) = log10(Intensity/DefaultIntensity)...therefore */
flIntensity
=
pow
(
10
,
lVolume
)
*
DEFAULT_INTENSITY
;
flTemp
=
(
flDistance
/
dsb
->
ds3db_ds3db
.
flMinDistance
)
*
(
flDistance
/
dsb
->
ds3db_ds3db
.
flMinDistance
);
flIntensity
/=
flTemp
;
lVolume
=
log10
(
flIntensity
/
DEFAULT_INTENSITY
);
lVolume
*=
1000
;
/* convert back to hundreths of dB */
lVolume
-=
10000
;
/* we need to do it in ms way */
/* attenuation proportional to the distance squared, converted to millibels as in lVolume*/
lVolume
-=
log10
(
flDistance
/
dsb
->
ds3db_ds3db
.
flMinDistance
*
flDistance
/
dsb
->
ds3db_ds3db
.
flMinDistance
)
*
1000
;
TRACE
(
"dist. att: Distance = %f, MinDistance = %f => adjusting volume %d to %f
\n
"
,
flDistance
,
dsb
->
ds3db_ds3db
.
flMinDistance
,
dsb
->
ds3db_lVolume
,
lVolume
);
/* conning */
...
...
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