Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ef275fac
Commit
ef275fac
authored
Apr 23, 2023
by
Anton Baskanov
Committed by
Alexandre Julliard
May 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Store the frequency of 3D buffers separately.
parent
0433db1e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
20 deletions
+32
-20
buffer.c
dlls/dsound/buffer.c
+25
-15
dsound_private.h
dlls/dsound/dsound_private.h
+1
-0
sound3d.c
dlls/dsound/sound3d.c
+6
-5
No files found.
dlls/dsound/buffer.c
View file @
ef275fac
...
...
@@ -287,10 +287,17 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(IDirectSoundBuffer8 *i
AcquireSRWLockExclusive
(
&
This
->
lock
);
oldFreq
=
This
->
freq
;
This
->
freq
=
freq
;
if
(
freq
!=
oldFreq
)
DSOUND_RecalcFormat
(
This
);
if
(
This
->
dsbd
.
dwFlags
&
DSBCAPS_CTRL3D
)
{
oldFreq
=
This
->
ds3db_freq
;
This
->
ds3db_freq
=
freq
;
if
(
freq
!=
oldFreq
)
DSOUND_Calc3DBuffer
(
This
);
}
else
{
oldFreq
=
This
->
freq
;
This
->
freq
=
freq
;
if
(
freq
!=
oldFreq
)
DSOUND_RecalcFormat
(
This
);
}
ReleaseSRWLockExclusive
(
&
This
->
lock
);
...
...
@@ -700,7 +707,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetFrequency(IDirectSoundBuffer8 *i
return
DSERR_INVALIDPARAM
;
}
*
freq
=
This
->
freq
;
*
freq
=
(
This
->
dsbd
.
dwFlags
&
DSBCAPS_CTRL3D
)
?
This
->
ds3db_freq
:
This
->
freq
;
TRACE
(
"-> %ld
\n
"
,
*
freq
);
return
DS_OK
;
...
...
@@ -1100,15 +1107,6 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
dsb
->
sec_mixpos
=
0
;
dsb
->
state
=
STATE_STOPPED
;
/* calculate fragment size and write lead */
DSOUND_RecalcFormat
(
dsb
);
dsb
->
committedbuff
=
malloc
(
dsb
->
maxwritelead
);
if
(
!
dsb
->
committedbuff
)
{
IDirectSoundBuffer8_Release
(
&
dsb
->
IDirectSoundBuffer8_iface
);
return
DSERR_OUTOFMEMORY
;
}
if
(
dsb
->
dsbd
.
dwFlags
&
DSBCAPS_CTRL3D
)
{
dsb
->
ds3db_ds3db
.
dwSize
=
sizeof
(
DS3DBUFFER
);
dsb
->
ds3db_ds3db
.
vPosition
.
x
=
0
.
0
;
...
...
@@ -1127,11 +1125,23 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
dsb
->
ds3db_ds3db
.
flMaxDistance
=
DS3D_DEFAULTMAXDISTANCE
;
dsb
->
ds3db_ds3db
.
dwMode
=
DS3DMODE_NORMAL
;
dsb
->
ds3db_freq
=
dsbd
->
lpwfxFormat
->
nSamplesPerSec
;
dsb
->
ds3db_need_recalc
=
FALSE
;
DSOUND_Calc3DBuffer
(
dsb
);
}
else
}
else
{
DSOUND_RecalcVolPan
(
&
(
dsb
->
volpan
));
/* calculate fragment size and write lead */
DSOUND_RecalcFormat
(
dsb
);
}
dsb
->
committedbuff
=
malloc
(
dsb
->
maxwritelead
);
if
(
!
dsb
->
committedbuff
)
{
IDirectSoundBuffer8_Release
(
&
dsb
->
IDirectSoundBuffer8_iface
);
return
DSERR_OUTOFMEMORY
;
}
InitializeSRWLock
(
&
dsb
->
lock
);
/* register buffer */
...
...
dlls/dsound/dsound_private.h
View file @
ef275fac
...
...
@@ -164,6 +164,7 @@ struct IDirectSoundBufferImpl
/* DirectSound3DBuffer fields */
DS3DBUFFER
ds3db_ds3db
;
LONG
ds3db_lVolume
;
DWORD
ds3db_freq
;
BOOL
ds3db_need_recalc
;
/* Used for bit depth conversion */
int
mix_channels
;
...
...
dlls/dsound/sound3d.c
View file @
ef275fac
...
...
@@ -288,6 +288,8 @@ void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb)
}
TRACE
(
"panning: Angle = %f rad, lPan = %ld
\n
"
,
flAngle
,
dsb
->
volpan
.
lPan
);
dsb
->
freq
=
dsb
->
ds3db_freq
;
/* FIXME: Doppler Effect disabled since i have no idea which frequency to change and how to do it */
if
(
0
)
{
...
...
@@ -310,16 +312,15 @@ if(0)
if listener moves AWAY from buffer, its velocity component is NEGATIVE */
flListenerVel
=
ProjectVector
(
&
dsb
->
device
->
ds3dl
.
vVelocity
,
&
vDistance
);
/* formula taken from Gianicoli D.: Physics, 4th edition: */
/* FIXME: replace dsb->freq with appropriate frequency ! */
flFreq
=
dsb
->
freq
*
((
DEFAULT_VELOCITY
+
flListenerVel
)
/
(
DEFAULT_VELOCITY
+
flBufferVel
));
flFreq
=
dsb
->
ds3db_freq
*
((
DEFAULT_VELOCITY
+
flListenerVel
)
/
(
DEFAULT_VELOCITY
+
flBufferVel
));
TRACE
(
"doppler: Buffer velocity (component) = %f, Listener velocity (component) = %f => Doppler shift: %ld Hz -> %f Hz
\n
"
,
flBufferVel
,
flListenerVel
,
dsb
->
freq
,
flFreq
);
/* FIXME: replace following line with correct frequency setting ! */
flBufferVel
,
flListenerVel
,
dsb
->
ds3db_freq
,
flFreq
);
dsb
->
freq
=
flFreq
;
DSOUND_RecalcFormat
(
dsb
);
}
}
DSOUND_RecalcFormat
(
dsb
);
for
(
i
=
0
;
i
<
dsb
->
device
->
pwfx
->
nChannels
;
i
++
)
dsb
->
volpan
.
dwTotalAmpFactor
[
i
]
=
0
;
...
...
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