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
605cd62c
Commit
605cd62c
authored
Nov 16, 2012
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Nov 22, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Create a primary_pwfx separately from pwfx.
parent
a0f039a6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
23 deletions
+31
-23
dsound.c
dlls/dsound/dsound.c
+27
-8
dsound_main.c
dlls/dsound/dsound_main.c
+0
-10
dsound_private.h
dlls/dsound/dsound_private.h
+3
-5
mixer.c
dlls/dsound/mixer.c
+1
-0
primary.c
dlls/dsound/primary.c
+0
-0
No files found.
dlls/dsound/dsound.c
View file @
605cd62c
...
...
@@ -305,21 +305,36 @@ static HRESULT WINAPI IDirectSound8Impl_SetCooperativeLevel(IDirectSound8 *iface
DWORD
level
)
{
IDirectSoundImpl
*
This
=
impl_from_IDirectSound8
(
iface
);
DirectSoundDevice
*
device
=
This
->
device
;
DWORD
oldlevel
;
HRESULT
hr
=
S_OK
;
TRACE
(
"(%p,%p,%s)
\n
"
,
This
,
hwnd
,
dumpCooperativeLevel
(
level
));
if
(
!
This
->
device
)
{
if
(
!
device
)
{
WARN
(
"not initialized
\n
"
);
return
DSERR_UNINITIALIZED
;
}
if
(
level
==
DSSCL_PRIORITY
||
level
==
DSSCL_EXCLUSIVE
)
{
WARN
(
"level=%s not fully supported
\n
"
,
level
==
DSSCL_PRIORITY
?
"DSSCL_PRIORITY"
:
"DSSCL_EXCLUSIVE"
);
level
==
DSSCL_PRIORITY
?
"DSSCL_PRIORITY"
:
"DSSCL_EXCLUSIVE"
);
}
This
->
device
->
priolevel
=
level
;
return
DS_OK
;
RtlAcquireResourceExclusive
(
&
device
->
buffer_list_lock
,
TRUE
);
EnterCriticalSection
(
&
device
->
mixlock
);
oldlevel
=
device
->
priolevel
;
device
->
priolevel
=
level
;
if
((
level
==
DSSCL_WRITEPRIMARY
)
!=
(
oldlevel
==
DSSCL_WRITEPRIMARY
))
{
hr
=
DSOUND_ReopenDevice
(
device
,
level
==
DSSCL_WRITEPRIMARY
);
if
(
FAILED
(
hr
))
device
->
priolevel
=
oldlevel
;
else
DSOUND_PrimaryOpen
(
device
);
}
LeaveCriticalSection
(
&
device
->
mixlock
);
RtlReleaseResource
(
&
device
->
buffer_list_lock
);
return
hr
;
}
static
HRESULT
WINAPI
IDirectSound8Impl_Compact
(
IDirectSound8
*
iface
)
...
...
@@ -612,20 +627,24 @@ static HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
device
->
guid
=
GUID_NULL
;
/* Set default wave format (may need it for waveOutOpen) */
device
->
pwfx
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WAVEFORMATEX
));
if
(
device
->
pwfx
==
NULL
)
{
device
->
pwfx
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WAVEFORMATEXTENSIBLE
));
device
->
primary_pwfx
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WAVEFORMATEXTENSIBLE
));
if
(
!
device
->
pwfx
||
!
device
->
primary_pwfx
)
{
WARN
(
"out of memory
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
primary_pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
pwfx
);
HeapFree
(
GetProcessHeap
(),
0
,
device
);
return
DSERR_OUTOFMEMORY
;
}
device
->
pwfx
->
wFormatTag
=
WAVE_FORMAT_PCM
;
device
->
pwfx
->
nSamplesPerSec
=
ds_default_sample_rate
;
device
->
pwfx
->
wBitsPerSample
=
ds_default_bits_per_sample
;
device
->
pwfx
->
nSamplesPerSec
=
22050
;
device
->
pwfx
->
wBitsPerSample
=
8
;
device
->
pwfx
->
nChannels
=
2
;
device
->
pwfx
->
nBlockAlign
=
device
->
pwfx
->
wBitsPerSample
*
device
->
pwfx
->
nChannels
/
8
;
device
->
pwfx
->
nAvgBytesPerSec
=
device
->
pwfx
->
nSamplesPerSec
*
device
->
pwfx
->
nBlockAlign
;
device
->
pwfx
->
cbSize
=
0
;
memcpy
(
device
->
primary_pwfx
,
device
->
pwfx
,
sizeof
(
*
device
->
pwfx
));
InitializeCriticalSection
(
&
(
device
->
mixlock
));
device
->
mixlock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": DirectSoundDevice.mixlock"
);
...
...
dlls/dsound/dsound_main.c
View file @
605cd62c
...
...
@@ -93,8 +93,6 @@ WCHAR wine_vxd_drv[] = { 'w','i','n','e','m','m','.','v','x','d', 0 };
/* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */
int
ds_hel_buflen
=
32768
*
2
;
int
ds_snd_queue_max
=
10
;
int
ds_default_sample_rate
=
44100
;
int
ds_default_bits_per_sample
=
16
;
static
HINSTANCE
instance
;
/*
...
...
@@ -151,19 +149,11 @@ void setup_dsound_options(void)
ds_snd_queue_max
=
atoi
(
buffer
);
if
(
!
get_config_key
(
hkey
,
appkey
,
"DefaultSampleRate"
,
buffer
,
MAX_PATH
))
ds_default_sample_rate
=
atoi
(
buffer
);
if
(
!
get_config_key
(
hkey
,
appkey
,
"DefaultBitsPerSample"
,
buffer
,
MAX_PATH
))
ds_default_bits_per_sample
=
atoi
(
buffer
);
if
(
appkey
)
RegCloseKey
(
appkey
);
if
(
hkey
)
RegCloseKey
(
hkey
);
TRACE
(
"ds_hel_buflen = %d
\n
"
,
ds_hel_buflen
);
TRACE
(
"ds_snd_queue_max = %d
\n
"
,
ds_snd_queue_max
);
TRACE
(
"ds_default_sample_rate = %d
\n
"
,
ds_default_sample_rate
);
TRACE
(
"ds_default_bits_per_sample = %d
\n
"
,
ds_default_bits_per_sample
);
}
static
const
char
*
get_device_id
(
LPCGUID
pGuid
)
...
...
dlls/dsound/dsound_private.h
View file @
605cd62c
...
...
@@ -32,9 +32,6 @@
extern
int
ds_hel_buflen
DECLSPEC_HIDDEN
;
extern
int
ds_snd_queue_max
DECLSPEC_HIDDEN
;
extern
int
ds_snd_shadow_maxsize
DECLSPEC_HIDDEN
;
extern
int
ds_default_sample_rate
DECLSPEC_HIDDEN
;
extern
int
ds_default_bits_per_sample
DECLSPEC_HIDDEN
;
/*****************************************************************************
* Predeclare the interface implementation structures
...
...
@@ -72,8 +69,8 @@ struct DirectSoundDevice
GUID
guid
;
DSCAPS
drvcaps
;
DWORD
priolevel
;
PWAVEFORMATEX
pwfx
;
UINT
timerID
,
playing_offs_bytes
,
in_mmdev_bytes
,
prebuf
,
helfrags
;
PWAVEFORMATEX
pwfx
,
primary_pwfx
;
UINT
timerID
,
playing_offs_bytes
,
in_mmdev_bytes
,
prebuf
;
DWORD
fraglen
;
LPBYTE
buffer
;
DWORD
writelead
,
buflen
,
state
,
playpos
,
mixpos
;
...
...
@@ -211,6 +208,7 @@ HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device) DECLSPEC_HIDDEN;
HRESULT
DSOUND_PrimaryGetPosition
(
DirectSoundDevice
*
device
,
LPDWORD
playpos
,
LPDWORD
writepos
)
DECLSPEC_HIDDEN
;
LPWAVEFORMATEX
DSOUND_CopyFormat
(
LPCWAVEFORMATEX
wfex
)
DECLSPEC_HIDDEN
;
HRESULT
DSOUND_ReopenDevice
(
DirectSoundDevice
*
device
,
BOOL
forcewave
)
DECLSPEC_HIDDEN
;
HRESULT
DSOUND_PrimaryOpen
(
DirectSoundDevice
*
device
)
DECLSPEC_HIDDEN
;
HRESULT
primarybuffer_create
(
DirectSoundDevice
*
device
,
IDirectSoundBufferImpl
**
ppdsb
,
const
DSBUFFERDESC
*
dsbd
)
DECLSPEC_HIDDEN
;
void
primarybuffer_destroy
(
IDirectSoundBufferImpl
*
This
)
DECLSPEC_HIDDEN
;
...
...
dlls/dsound/mixer.c
View file @
605cd62c
...
...
@@ -112,6 +112,7 @@ void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb)
TRACE
(
"(%p)
\n
"
,
dsb
);
pwfxe
=
(
WAVEFORMATEXTENSIBLE
*
)
dsb
->
pwfx
;
dsb
->
freqAdjust
=
(
float
)
dsb
->
freq
/
dsb
->
device
->
pwfx
->
nSamplesPerSec
;
if
((
pwfxe
->
Format
.
wFormatTag
==
WAVE_FORMAT_IEEE_FLOAT
)
||
((
pwfxe
->
Format
.
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
)
&&
(
IsEqualGUID
(
&
pwfxe
->
SubFormat
,
&
KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
))))
...
...
dlls/dsound/primary.c
View file @
605cd62c
This diff is collapsed.
Click to expand it.
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