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
4fbe6f3e
Commit
4fbe6f3e
authored
May 19, 2016
by
Andrew Eikum
Committed by
Alexandre Julliard
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Allow inactive devices to change the primary format.
Signed-off-by:
Andrew Eikum
<
aeikum@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
49aacb47
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
25 deletions
+20
-25
primary.c
dlls/dsound/primary.c
+20
-25
No files found.
dlls/dsound/primary.c
View file @
4fbe6f3e
...
...
@@ -479,35 +479,30 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
RtlAcquireResourceExclusive
(
&
(
device
->
buffer_list_lock
),
TRUE
);
EnterCriticalSection
(
&
(
device
->
mixlock
));
if
(
device
->
priolevel
==
DSSCL_WRITEPRIMARY
)
{
old_fmt
=
device
->
primary_pwfx
;
device
->
primary_pwfx
=
DSOUND_CopyFormat
(
passed_fmt
);
fmtex
=
(
WAVEFORMATEXTENSIBLE
*
)
device
->
primary_pwfx
;
if
(
device
->
primary_pwfx
==
NULL
)
{
err
=
DSERR_OUTOFMEMORY
;
goto
out
;
}
old_fmt
=
device
->
primary_pwfx
;
device
->
primary_pwfx
=
DSOUND_CopyFormat
(
passed_fmt
);
fmtex
=
(
WAVEFORMATEXTENSIBLE
*
)
device
->
primary_pwfx
;
if
(
device
->
primary_pwfx
==
NULL
)
{
err
=
DSERR_OUTOFMEMORY
;
goto
out
;
}
if
(
fmtex
->
Format
.
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
fmtex
->
Samples
.
wValidBitsPerSample
==
0
)
{
TRACE
(
"Correcting 0 valid bits per sample
\n
"
);
fmtex
->
Samples
.
wValidBitsPerSample
=
fmtex
->
Format
.
wBitsPerSample
;
}
if
(
fmtex
->
Format
.
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
&&
fmtex
->
Samples
.
wValidBitsPerSample
==
0
)
{
TRACE
(
"Correcting 0 valid bits per sample
\n
"
);
fmtex
->
Samples
.
wValidBitsPerSample
=
fmtex
->
Format
.
wBitsPerSample
;
}
if
(
device
->
priolevel
==
DSSCL_WRITEPRIMARY
||
device
->
nrofbuffers
==
0
)
err
=
DSOUND_ReopenDevice
(
device
,
TRUE
);
if
(
FAILED
(
err
))
{
ERR
(
"No formats could be opened
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
primary_pwfx
);
device
->
primary_pwfx
=
old_fmt
;
}
else
HeapFree
(
GetProcessHeap
(),
0
,
old_fmt
);
if
(
FAILED
(
err
)
&&
device
->
priolevel
==
DSSCL_WRITEPRIMARY
)
{
ERR
(
"No formats could be opened
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
device
->
primary_pwfx
);
device
->
primary_pwfx
=
old_fmt
;
}
else
{
WAVEFORMATEX
*
wfx
=
DSOUND_CopyFormat
(
passed_fmt
);
if
(
wfx
)
{
HeapFree
(
GetProcessHeap
(),
0
,
device
->
primary_pwfx
);
device
->
primary_pwfx
=
wfx
;
}
else
err
=
DSERR_OUTOFMEMORY
;
/* ignore failures */
err
=
S_OK
;
HeapFree
(
GetProcessHeap
(),
0
,
old_fmt
);
}
out:
...
...
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