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
a4a9d50d
Commit
a4a9d50d
authored
Sep 28, 2008
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Oct 06, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Fix volume and panning for primary buffer.
Fixes failing dsound tests in wine.
parent
d3908e69
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
29 deletions
+39
-29
dsound.c
dlls/dsound/dsound.c
+1
-1
dsound_private.h
dlls/dsound/dsound_private.h
+2
-0
primary.c
dlls/dsound/primary.c
+36
-28
No files found.
dlls/dsound/dsound.c
View file @
a4a9d50d
...
@@ -1471,7 +1471,7 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
...
@@ -1471,7 +1471,7 @@ HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGUID lpcG
device
->
drvcaps
.
dwFlags
|=
DSCAPS_EMULDRIVER
;
device
->
drvcaps
.
dwFlags
|=
DSCAPS_EMULDRIVER
;
device
->
drvcaps
.
dwMinSecondarySampleRate
=
DSBFREQUENCY_MIN
;
device
->
drvcaps
.
dwMinSecondarySampleRate
=
DSBFREQUENCY_MIN
;
device
->
drvcaps
.
dwMaxSecondarySampleRate
=
DSBFREQUENCY_MAX
;
device
->
drvcaps
.
dwMaxSecondarySampleRate
=
DSBFREQUENCY_MAX
;
device
->
drvcaps
.
dwPrimaryBuffers
=
1
;
ZeroMemory
(
&
device
->
volpan
,
sizeof
(
device
->
volpan
))
;
}
}
hr
=
DSOUND_PrimaryCreate
(
device
);
hr
=
DSOUND_PrimaryCreate
(
device
);
...
...
dlls/dsound/dsound_private.h
View file @
a4a9d50d
...
@@ -108,6 +108,8 @@ struct DirectSoundDevice
...
@@ -108,6 +108,8 @@ struct DirectSoundDevice
LPBYTE
tmp_buffer
,
mix_buffer
;
LPBYTE
tmp_buffer
,
mix_buffer
;
DWORD
tmp_buffer_len
,
mix_buffer_len
;
DWORD
tmp_buffer_len
,
mix_buffer_len
;
DSVOLUMEPAN
volpan
;
mixfunc
mixfunction
;
mixfunc
mixfunction
;
normfunc
normfunction
;
normfunc
normfunction
;
...
...
dlls/dsound/primary.c
View file @
a4a9d50d
...
@@ -169,6 +169,9 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
...
@@ -169,6 +169,9 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
return
err
;
return
err
;
}
}
}
}
if
(
device
->
hwbuf
)
IDsDriverBuffer_SetVolumePan
(
device
->
hwbuf
,
&
device
->
volpan
);
DSOUND_RecalcPrimary
(
device
);
DSOUND_RecalcPrimary
(
device
);
device
->
prebuf
=
ds_snd_queue_max
;
device
->
prebuf
=
ds_snd_queue_max
;
if
(
device
->
helfrags
<
ds_snd_queue_min
)
if
(
device
->
helfrags
<
ds_snd_queue_min
)
...
@@ -582,7 +585,6 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
...
@@ -582,7 +585,6 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
)
{
)
{
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DWORD
ampfactors
;
DWORD
ampfactors
;
DSVOLUMEPAN
volpan
;
HRESULT
hres
=
DS_OK
;
HRESULT
hres
=
DS_OK
;
TRACE
(
"(%p,%d)
\n
"
,
iface
,
vol
);
TRACE
(
"(%p,%d)
\n
"
,
iface
,
vol
);
...
@@ -600,18 +602,18 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
...
@@ -600,18 +602,18 @@ static HRESULT WINAPI PrimaryBufferImpl_SetVolume(
EnterCriticalSection
(
&
(
device
->
mixlock
));
EnterCriticalSection
(
&
(
device
->
mixlock
));
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
device
->
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
device
->
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
DSOUND_AmpFactorToVolPan
(
&
volpan
);
DSOUND_AmpFactorToVolPan
(
&
device
->
volpan
);
if
(
vol
!=
volpan
.
lVolume
)
{
if
(
vol
!=
device
->
volpan
.
lVolume
)
{
volpan
.
lVolume
=
vol
;
device
->
volpan
.
lVolume
=
vol
;
DSOUND_RecalcVolPan
(
&
volpan
);
DSOUND_RecalcVolPan
(
&
device
->
volpan
);
if
(
device
->
hwbuf
)
{
if
(
device
->
hwbuf
)
{
hres
=
IDsDriverBuffer_SetVolumePan
(
device
->
hwbuf
,
&
volpan
);
hres
=
IDsDriverBuffer_SetVolumePan
(
device
->
hwbuf
,
&
device
->
volpan
);
if
(
hres
!=
DS_OK
)
if
(
hres
!=
DS_OK
)
WARN
(
"IDsDriverBuffer_SetVolumePan failed
\n
"
);
WARN
(
"IDsDriverBuffer_SetVolumePan failed
\n
"
);
}
else
{
}
else
{
ampfactors
=
(
volpan
.
dwTotalLeftAmpFactor
&
0xffff
)
|
(
volpan
.
dwTotalRightAmpFactor
<<
16
);
ampfactors
=
(
device
->
volpan
.
dwTotalLeftAmpFactor
&
0xffff
)
|
(
device
->
volpan
.
dwTotalRightAmpFactor
<<
16
);
waveOutSetVolume
(
device
->
hwo
,
ampfactors
);
waveOutSetVolume
(
device
->
hwo
,
ampfactors
);
}
}
}
}
...
@@ -627,7 +629,6 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
...
@@ -627,7 +629,6 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
)
{
)
{
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DWORD
ampfactors
;
DWORD
ampfactors
;
DSVOLUMEPAN
volpan
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
vol
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
vol
);
if
(
!
(
device
->
dsbd
.
dwFlags
&
DSBCAPS_CTRLVOLUME
))
{
if
(
!
(
device
->
dsbd
.
dwFlags
&
DSBCAPS_CTRLVOLUME
))
{
...
@@ -640,11 +641,14 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
...
@@ -640,11 +641,14 @@ static HRESULT WINAPI PrimaryBufferImpl_GetVolume(
return
DSERR_INVALIDPARAM
;
return
DSERR_INVALIDPARAM
;
}
}
if
(
!
device
->
hwbuf
)
{
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
device
->
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
device
->
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
DSOUND_AmpFactorToVolPan
(
&
volpan
);
DSOUND_AmpFactorToVolPan
(
&
device
->
volpan
);
*
vol
=
volpan
.
lVolume
;
}
*
vol
=
device
->
volpan
.
lVolume
;
return
DS_OK
;
return
DS_OK
;
}
}
...
@@ -907,7 +911,6 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
...
@@ -907,7 +911,6 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
)
{
)
{
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DWORD
ampfactors
;
DWORD
ampfactors
;
DSVOLUMEPAN
volpan
;
HRESULT
hres
=
DS_OK
;
HRESULT
hres
=
DS_OK
;
TRACE
(
"(%p,%d)
\n
"
,
iface
,
pan
);
TRACE
(
"(%p,%d)
\n
"
,
iface
,
pan
);
...
@@ -924,19 +927,22 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
...
@@ -924,19 +927,22 @@ static HRESULT WINAPI PrimaryBufferImpl_SetPan(
/* **** */
/* **** */
EnterCriticalSection
(
&
(
device
->
mixlock
));
EnterCriticalSection
(
&
(
device
->
mixlock
));
if
(
!
device
->
hwbuf
)
{
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
device
->
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
device
->
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
DSOUND_AmpFactorToVolPan
(
&
volpan
);
DSOUND_AmpFactorToVolPan
(
&
device
->
volpan
);
if
(
pan
!=
volpan
.
lPan
)
{
}
volpan
.
lPan
=
pan
;
if
(
pan
!=
device
->
volpan
.
lPan
)
{
DSOUND_RecalcVolPan
(
&
volpan
);
device
->
volpan
.
lPan
=
pan
;
DSOUND_RecalcVolPan
(
&
device
->
volpan
);
if
(
device
->
hwbuf
)
{
if
(
device
->
hwbuf
)
{
hres
=
IDsDriverBuffer_SetVolumePan
(
device
->
hwbuf
,
&
volpan
);
hres
=
IDsDriverBuffer_SetVolumePan
(
device
->
hwbuf
,
&
device
->
volpan
);
if
(
hres
!=
DS_OK
)
if
(
hres
!=
DS_OK
)
WARN
(
"IDsDriverBuffer_SetVolumePan failed
\n
"
);
WARN
(
"IDsDriverBuffer_SetVolumePan failed
\n
"
);
}
else
{
}
else
{
ampfactors
=
(
volpan
.
dwTotalLeftAmpFactor
&
0xffff
)
|
(
volpan
.
dwTotalRightAmpFactor
<<
16
);
ampfactors
=
(
device
->
volpan
.
dwTotalLeftAmpFactor
&
0xffff
)
|
(
device
->
volpan
.
dwTotalRightAmpFactor
<<
16
);
waveOutSetVolume
(
device
->
hwo
,
ampfactors
);
waveOutSetVolume
(
device
->
hwo
,
ampfactors
);
}
}
}
}
...
@@ -952,7 +958,6 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
...
@@ -952,7 +958,6 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
)
{
)
{
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DirectSoundDevice
*
device
=
((
PrimaryBufferImpl
*
)
iface
)
->
device
;
DWORD
ampfactors
;
DWORD
ampfactors
;
DSVOLUMEPAN
volpan
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pan
);
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pan
);
if
(
!
(
device
->
dsbd
.
dwFlags
&
DSBCAPS_CTRLPAN
))
{
if
(
!
(
device
->
dsbd
.
dwFlags
&
DSBCAPS_CTRLPAN
))
{
...
@@ -965,11 +970,14 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
...
@@ -965,11 +970,14 @@ static HRESULT WINAPI PrimaryBufferImpl_GetPan(
return
DSERR_INVALIDPARAM
;
return
DSERR_INVALIDPARAM
;
}
}
if
(
!
device
->
hwbuf
)
{
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
waveOutGetVolume
(
device
->
hwo
,
&
ampfactors
);
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
device
->
volpan
.
dwTotalLeftAmpFactor
=
ampfactors
&
0xffff
;
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
device
->
volpan
.
dwTotalRightAmpFactor
=
ampfactors
>>
16
;
DSOUND_AmpFactorToVolPan
(
&
volpan
);
DSOUND_AmpFactorToVolPan
(
&
device
->
volpan
);
*
pan
=
volpan
.
lPan
;
}
*
pan
=
device
->
volpan
.
lPan
;
return
DS_OK
;
return
DS_OK
;
}
}
...
...
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