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
5438df17
Commit
5438df17
authored
Jan 14, 2003
by
Rok Mandeljc
Committed by
Alexandre Julliard
Jan 14, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cone support.
parent
5261df03
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
3 deletions
+39
-3
sound3d.c
dlls/dsound/sound3d.c
+39
-3
No files found.
dlls/dsound/sound3d.c
View file @
5438df17
...
...
@@ -165,7 +165,12 @@ static void WINAPI DSOUND_Mix3DBuffer(IDirectSound3DBufferImpl *ds3db)
/* stuff for distance related stuff calc. */
D3DVECTOR
vDistance
;
D3DVALUE
fDistance
;
/* stuff for cone angle calc. */
DWORD
dwAlpha
,
dwTheta
,
dwInsideConeAngle
,
dwOutsideConeAngle
;
D3DVECTOR
vConeOrientation
;
DWORD
dwConstVolAng
;
/* Volume/Angle constant */
if
(
ds3db
->
dsb
->
dsound
->
listener
==
NULL
)
return
;
...
...
@@ -203,12 +208,43 @@ static void WINAPI DSOUND_Mix3DBuffer(IDirectSound3DBufferImpl *ds3db)
...hope it works */
iPower
=
fDistance
/
ds3db
->
ds3db
.
flMinDistance
-
1
;
/* this sucks, but for unknown reason damn thing works only if you reduce it for 1 */
lAttuneation
=
(((
pow
(
2
,
iPower
)
-
1
)
*
DSBVOLUME_MIN
)
+
lVolume
)
/
pow
(
2
,
iPower
);
lAttuneation
*=
dsl
->
ds3dl
.
flRolloffFactor
;
/* attuneation according to rolloff factor */
lAttuneation
/=
5
;
/* i've figured this value wih trying (without it, sound is too quiet */
TRACE
(
"distance att.: distance = %f, min distance = %f => adjusting volume %ld for attuneation %ld
\n
"
,
fDistance
,
ds3db
->
ds3db
.
flMinDistance
,
lVolume
,
lAttuneation
);
lVolume
=
lVolume
+
lAttuneation
;
lVolume
+=
lAttuneation
;
/* conning */
/* correct me if I'm wrong, but i believe 'D3DVECTORS' used below are only points
between which vectors are yet to be calculated */
vConeOrientation
=
VectorBetweenTwoPoints
(
&
ds3db
->
ds3db
.
vPosition
,
&
ds3db
->
ds3db
.
vConeOrientation
);
/* I/O ConeAngles are defined in both directions; for comparing, we need only half of their values */
dwOutsideConeAngle
=
ds3db
->
ds3db
.
dwOutsideConeAngle
/
2
;
dwInsideConeAngle
=
ds3db
->
ds3db
.
dwInsideConeAngle
/
2
;
dwTheta
=
AngleBetweenVectorsDeg
(
&
vDistance
,
&
vConeOrientation
);
/* actual conning */
if
(
dwTheta
<=
dwInsideConeAngle
)
{
lAttuneation
=
0
;
TRACE
(
"conning: angle (%ld) < InsideConeAngle (%ld), leaving volume at %ld
\n
"
,
dwTheta
,
dwInsideConeAngle
,
lVolume
);
}
if
(
dwTheta
>
dwOutsideConeAngle
)
{
/* attuneation is equal to lConeOutsideVolume */
lAttuneation
=
ds3db
->
ds3db
.
lConeOutsideVolume
;
TRACE
(
"conning: angle (%ld) > OutsideConeAngle (%ld), attuneation = %ld, final volume = %ld
\n
"
,
dwTheta
,
dwOutsideConeAngle
,
\
ds3db
->
ds3db
.
lConeOutsideVolume
,
lVolume
);
}
if
(
dwTheta
>
dwInsideConeAngle
&&
dwTheta
<=
dwOutsideConeAngle
)
{
dwAlpha
=
dwTheta
-
dwInsideConeAngle
;
dwConstVolAng
=
((
lVolume
+
ds3db
->
ds3db
.
lConeOutsideVolume
)
-
lVolume
)
/
(
dwOutsideConeAngle
-
dwInsideConeAngle
);
lAttuneation
=
dwAlpha
*
dwConstVolAng
;
TRACE
(
"conning: angle = %ld, attuneation = %ld, final Volume = %ld
\n
"
,
dwTheta
,
dwAlpha
*
dwConstVolAng
,
lVolume
);
}
lVolume
+=
lAttuneation
;
TRACE
(
"final volume = %ld
\n
"
,
lVolume
);
/* at l
e
ast, we got the desired volume */
/* at last, we got the desired volume */
ds3db
->
dsb
->
volpan
.
lVolume
=
lVolume
;
DSOUND_RecalcVolPan
(
&
ds3db
->
dsb
->
volpan
);
DSOUND_ForceRemix
(
ds3db
->
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