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
fcc8a1be
Commit
fcc8a1be
authored
Sep 08, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Oct 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmsynth: Simplify IDirectMusicSynth8_Open checks.
parent
b5903214
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
66 deletions
+60
-66
synth.c
dlls/dmsynth/synth.c
+60
-66
No files found.
dlls/dmsynth/synth.c
View file @
fcc8a1be
...
...
@@ -313,85 +313,79 @@ static ULONG WINAPI synth_Release(IDirectMusicSynth8 *iface)
static
HRESULT
WINAPI
synth_Open
(
IDirectMusicSynth8
*
iface
,
DMUS_PORTPARAMS
*
params
)
{
struct
synth
*
This
=
impl_from_IDirectMusicSynth8
(
iface
);
BOOL
modified
=
FALSE
;
const
DMUS_PORTPARAMS
def
=
{
.
dwValidParams
=
DMUS_PORTPARAMS_VOICES
|
DMUS_PORTPARAMS_CHANNELGROUPS
|
DMUS_PORTPARAMS_AUDIOCHANNELS
|
DMUS_PORTPARAMS_SAMPLERATE
|
DMUS_PORTPARAMS_EFFECTS
|
DMUS_PORTPARAMS_SHARE
|
DMUS_PORTPARAMS_FEATURES
,
.
dwSize
=
sizeof
(
def
),
.
dwVoices
=
32
,
.
dwChannelGroups
=
2
,
.
dwAudioChannels
=
2
,
.
dwSampleRate
=
22050
,
.
dwEffectFlags
=
DMUS_EFFECT_REVERB
DMUS_PORTPARAMS
actual
=
{
.
dwSize
=
sizeof
(
DMUS_PORTPARAMS
),
.
dwValidParams
=
DMUS_PORTPARAMS_VOICES
|
DMUS_PORTPARAMS_CHANNELGROUPS
|
DMUS_PORTPARAMS_AUDIOCHANNELS
|
DMUS_PORTPARAMS_SAMPLERATE
|
DMUS_PORTPARAMS_EFFECTS
|
DMUS_PORTPARAMS_SHARE
|
DMUS_PORTPARAMS_FEATURES
,
.
dwVoices
=
32
,
.
dwChannelGroups
=
2
,
.
dwAudioChannels
=
2
,
.
dwSampleRate
=
22050
,
.
dwEffectFlags
=
DMUS_EFFECT_REVERB
,
};
UINT
size
=
sizeof
(
DMUS_PORTPARAMS
);
BOOL
modified
=
FALSE
;
TRACE
(
"(%p, %p)
\n
"
,
This
,
params
);
if
(
This
->
open
)
return
DMUS_E_ALREADYOPEN
;
if
(
params
&&
params
->
dwSize
<
sizeof
(
DMUS_PORTPARAMS7
))
return
E_INVALIDARG
;
if
(
This
->
open
)
return
DMUS_E_ALREADYOPEN
;
This
->
open
=
TRUE
;
if
(
params
)
{
if
(
params
->
dwSize
<
sizeof
(
DMUS_PORTPARAMS7
))
return
E_INVALIDARG
;
if
(
size
>
params
->
dwSize
)
size
=
params
->
dwSize
;
if
(
!
params
)
{
memcpy
(
&
This
->
params
,
&
def
,
sizeof
(
This
->
params
));
return
S_OK
;
}
if
((
params
->
dwValidParams
&
DMUS_PORTPARAMS_VOICES
)
&&
params
->
dwVoices
)
{
actual
.
dwVoices
=
min
(
params
->
dwVoices
,
This
->
caps
.
dwMaxVoices
);
modified
|=
actual
.
dwVoices
!=
params
->
dwVoices
;
}
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_VOICES
&&
params
->
dwVoices
)
{
if
(
params
->
dwVoices
>
This
->
caps
.
dwMaxVoices
)
{
modified
=
TRUE
;
params
->
dwVoices
=
This
->
caps
.
dwMaxVoice
s
;
if
((
params
->
dwValidParams
&
DMUS_PORTPARAMS_CHANNELGROUPS
)
&&
params
->
dwChannelGroups
)
{
actual
.
dwChannelGroups
=
min
(
params
->
dwChannelGroups
,
This
->
caps
.
dwMaxChannelGroups
)
;
modified
|=
actual
.
dwChannelGroups
!=
params
->
dwChannelGroup
s
;
}
}
else
params
->
dwVoices
=
def
.
dwVoices
;
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_CHANNELGROUPS
&&
params
->
dwChannelGroups
)
{
if
(
params
->
dwChannelGroups
>
This
->
caps
.
dwMaxChannelGroups
)
{
modified
=
TRUE
;
params
->
dwChannelGroups
=
This
->
caps
.
dwMaxChannelGroup
s
;
if
((
params
->
dwValidParams
&
DMUS_PORTPARAMS_AUDIOCHANNELS
)
&&
params
->
dwAudioChannels
)
{
actual
.
dwAudioChannels
=
min
(
params
->
dwAudioChannels
,
This
->
caps
.
dwMaxAudioChannels
)
;
modified
|=
actual
.
dwAudioChannels
!=
params
->
dwAudioChannel
s
;
}
}
else
params
->
dwChannelGroups
=
def
.
dwChannelGroups
;
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_AUDIOCHANNELS
&&
params
->
dwAudioChannels
)
{
if
(
params
->
dwAudioChannels
>
This
->
caps
.
dwMaxAudioChannels
)
{
modified
=
TRUE
;
params
->
dwAudioChannels
=
This
->
caps
.
dwMaxAudioChannels
;
if
((
params
->
dwValidParams
&
DMUS_PORTPARAMS_SAMPLERATE
)
&&
params
->
dwSampleRate
)
{
actual
.
dwSampleRate
=
min
(
max
(
params
->
dwSampleRate
,
11025
),
96000
)
;
modified
|=
actual
.
dwSampleRate
!=
params
->
dwSampleRate
;
}
}
else
params
->
dwAudioChannels
=
def
.
dwAudioChannels
;
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_SAMPLERATE
&&
params
->
dwSampleRate
)
{
if
(
params
->
dwSampleRate
>
96000
)
{
modified
=
TRUE
;
params
->
dwSampleRate
=
96000
;
}
else
if
(
params
->
dwSampleRate
<
11025
)
{
modified
=
TRUE
;
params
->
dwSampleRate
=
11025
;
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_EFFECTS
)
{
actual
.
dwEffectFlags
=
DMUS_EFFECT_REVERB
;
modified
|=
actual
.
dwEffectFlags
!=
params
->
dwEffectFlags
;
}
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_SHARE
)
{
actual
.
fShare
=
FALSE
;
modified
|=
actual
.
fShare
!=
params
->
fShare
;
}
if
(
params
->
dwSize
<
sizeof
(
*
params
))
actual
.
dwValidParams
&=
~
DMUS_PORTPARAMS_FEATURES
;
else
if
((
params
->
dwValidParams
&
DMUS_PORTPARAMS_FEATURES
)
&&
params
->
dwFeatures
)
{
actual
.
dwFeatures
=
params
->
dwFeatures
&
(
DMUS_PORT_FEATURE_AUDIOPATH
|
DMUS_PORT_FEATURE_STREAMING
);
modified
|=
actual
.
dwFeatures
!=
params
->
dwFeatures
;
}
}
else
params
->
dwSampleRate
=
def
.
dwSampleRate
;
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_EFFECTS
&&
params
->
dwEffectFlags
!=
def
.
dwEffectFlags
)
modified
=
TRUE
;
params
->
dwEffectFlags
=
def
.
dwEffectFlags
;
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_SHARE
&&
params
->
fShare
)
modified
=
TRUE
;
params
->
fShare
=
FALSE
;
if
(
params
->
dwSize
>=
sizeof
(
*
params
))
{
if
(
params
->
dwValidParams
&
DMUS_PORTPARAMS_FEATURES
&&
params
->
dwFeatures
)
{
if
(
params
->
dwFeatures
&
~
(
DMUS_PORT_FEATURE_AUDIOPATH
|
DMUS_PORT_FEATURE_STREAMING
))
{
modified
=
TRUE
;
params
->
dwFeatures
&=
DMUS_PORT_FEATURE_AUDIOPATH
|
DMUS_PORT_FEATURE_STREAMING
;
}
}
else
params
->
dwFeatures
=
def
.
dwFeatures
;
params
->
dwValidParams
=
def
.
dwValidParams
;
}
else
params
->
dwValidParams
=
def
.
dwValidParams
&
~
DMUS_PORTPARAMS_FEATURES
;
memcpy
(
&
This
->
params
,
params
,
min
(
params
->
dwSize
,
sizeof
(
This
->
params
)));
memcpy
(
params
,
&
actual
,
size
);
}
This
->
params
=
actual
;
This
->
open
=
TRUE
;
return
modified
?
S_FALSE
:
S_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