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
fa70d5c0
Commit
fa70d5c0
authored
Aug 27, 2004
by
Robert Reif
Committed by
Alexandre Julliard
Aug 27, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds tests to read and write control details.
parent
d7d1c384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
356 additions
and
1 deletion
+356
-1
mixer.c
dlls/winmm/tests/mixer.c
+356
-1
No files found.
dlls/winmm/tests/mixer.c
View file @
fa70d5c0
...
...
@@ -20,7 +20,6 @@
/*
* To Do:
* examine and update control details
* add interactive tests
*/
...
...
@@ -44,6 +43,12 @@
# define S1(x) (x)
#endif
#ifdef NONAMELESSUNION
# define U(x) (x).u
#else
# define U(x) (x)
#endif
static
const
char
*
line_flags
(
DWORD
fdwLine
)
{
static
char
flags
[
100
];
...
...
@@ -181,6 +186,176 @@ static const char * control_flags(DWORD fdwControl)
return
flags
;
}
static
void
mixer_test_controlA
(
HMIXER
mix
,
LPMIXERCONTROLA
control
)
{
MMRESULT
rc
;
if
((
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_VOLUME
)
||
(
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_UNSIGNED
))
{
MIXERCONTROLDETAILS
details
;
MIXERCONTROLDETAILS_UNSIGNED
value
;
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
/* read the current control value */
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
new_details
;
MIXERCONTROLDETAILS_UNSIGNED
new_value
;
if
(
winetest_interactive
)
trace
(
" Value=%ld
\n
"
,
value
.
dwValue
);
if
(
value
.
dwValue
+
control
->
Metrics
.
cSteps
<
S1
(
control
->
Bounds
).
dwMaximum
)
new_value
.
dwValue
=
value
.
dwValue
+
control
->
Metrics
.
cSteps
;
else
new_value
.
dwValue
=
value
.
dwValue
-
control
->
Metrics
.
cSteps
;
new_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
new_details
.
dwControlID
=
control
->
dwControlID
;
new_details
.
cChannels
=
1
;
U
(
new_details
).
cMultipleItems
=
0
;
new_details
.
paDetails
=
&
new_value
;
new_details
.
cbDetails
=
sizeof
(
new_value
);
/* change the control value by one step */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
new_details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
ret_details
;
MIXERCONTROLDETAILS_UNSIGNED
ret_value
;
ret_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
ret_details
.
dwControlID
=
control
->
dwControlID
;
ret_details
.
cChannels
=
1
;
U
(
ret_details
).
cMultipleItems
=
0
;
ret_details
.
paDetails
=
&
ret_value
;
ret_details
.
cbDetails
=
sizeof
(
ret_value
);
/* read back the new control value */
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
ret_details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
/* result may not match exactly because of rounding */
ok
(
abs
(
ret_value
.
dwValue
-
new_value
.
dwValue
)
<=
1
,
"Couldn't change value from %ld to %ld, returned %ld
\n
"
,
value
.
dwValue
,
new_value
.
dwValue
,
ret_value
.
dwValue
);
if
(
abs
(
ret_value
.
dwValue
-
new_value
.
dwValue
)
<=
1
)
{
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
/* restore original value */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
}
}
}
}
}
else
if
((
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_MUTE
)
||
(
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_BOOLEAN
)
||
(
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_BUTTON
))
{
MIXERCONTROLDETAILS
details
;
MIXERCONTROLDETAILS_BOOLEAN
value
;
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
new_details
;
MIXERCONTROLDETAILS_BOOLEAN
new_value
;
if
(
winetest_interactive
)
trace
(
" Value=%ld
\n
"
,
value
.
fValue
);
if
(
value
.
fValue
==
FALSE
)
new_value
.
fValue
=
TRUE
;
else
new_value
.
fValue
=
FALSE
;
new_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
new_details
.
dwControlID
=
control
->
dwControlID
;
new_details
.
cChannels
=
1
;
U
(
new_details
).
cMultipleItems
=
0
;
new_details
.
paDetails
=
&
new_value
;
new_details
.
cbDetails
=
sizeof
(
new_value
);
/* change the control value by one step */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
new_details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
ret_details
;
MIXERCONTROLDETAILS_BOOLEAN
ret_value
;
ret_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
ret_details
.
dwControlID
=
control
->
dwControlID
;
ret_details
.
cChannels
=
1
;
U
(
ret_details
).
cMultipleItems
=
0
;
ret_details
.
paDetails
=
&
ret_value
;
ret_details
.
cbDetails
=
sizeof
(
ret_value
);
/* read back the new control value */
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
ret_details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
/* result may not match exactly because of rounding */
ok
(
ret_value
.
fValue
==
new_value
.
fValue
,
"Couldn't change value from %ld to %ld, returned %ld
\n
"
,
value
.
fValue
,
new_value
.
fValue
,
ret_value
.
fValue
);
if
(
ret_value
.
fValue
==
new_value
.
fValue
)
{
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
/* restore original value */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
}
}
}
}
}
else
{
/* FIXME */
}
}
void
mixer_test_deviceA
(
int
device
)
{
MIXERCAPSA
capsA
;
...
...
@@ -208,6 +383,10 @@ void mixer_test_deviceA(int device)
capsA
.
szPname
,
capsA
.
vDriverVersion
>>
8
,
capsA
.
vDriverVersion
&
0xff
,
capsA
.
wMid
,
capsA
.
wPid
,
capsA
.
cDestinations
);
}
else
{
trace
(
" %d:
\"
%s
\"
%d.%d (%d:%d)
\n
"
,
device
,
capsA
.
szPname
,
capsA
.
vDriverVersion
>>
8
,
capsA
.
vDriverVersion
&
0xff
,
capsA
.
wMid
,
capsA
.
wPid
);
}
rc
=
mixerOpen
(
&
mix
,
device
,
0
,
0
,
0
);
...
...
@@ -363,6 +542,8 @@ void mixer_test_deviceA(int device)
S1
(
array
[
nc
].
Bounds
).
dwMaximum
,
array
[
nc
].
Metrics
.
cSteps
);
}
mixer_test_controlA
(
mix
,
&
array
[
nc
]);
}
}
...
...
@@ -379,6 +560,175 @@ void mixer_test_deviceA(int device)
}
}
static
void
mixer_test_controlW
(
HMIXER
mix
,
LPMIXERCONTROLW
control
)
{
MMRESULT
rc
;
if
((
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_VOLUME
)
||
(
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_UNSIGNED
))
{
MIXERCONTROLDETAILS
details
;
MIXERCONTROLDETAILS_UNSIGNED
value
;
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
/* read the current control value */
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
new_details
;
MIXERCONTROLDETAILS_UNSIGNED
new_value
;
if
(
winetest_interactive
)
trace
(
" Value=%ld
\n
"
,
value
.
dwValue
);
if
(
value
.
dwValue
+
control
->
Metrics
.
cSteps
<
S1
(
control
->
Bounds
).
dwMaximum
)
new_value
.
dwValue
=
value
.
dwValue
+
control
->
Metrics
.
cSteps
;
else
new_value
.
dwValue
=
value
.
dwValue
-
control
->
Metrics
.
cSteps
;
new_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
new_details
.
dwControlID
=
control
->
dwControlID
;
new_details
.
cChannels
=
1
;
U
(
new_details
).
cMultipleItems
=
0
;
new_details
.
paDetails
=
&
new_value
;
new_details
.
cbDetails
=
sizeof
(
new_value
);
/* change the control value by one step */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
new_details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
ret_details
;
MIXERCONTROLDETAILS_UNSIGNED
ret_value
;
ret_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
ret_details
.
dwControlID
=
control
->
dwControlID
;
ret_details
.
cChannels
=
1
;
U
(
ret_details
).
cMultipleItems
=
0
;
ret_details
.
paDetails
=
&
ret_value
;
ret_details
.
cbDetails
=
sizeof
(
ret_value
);
/* read back the new control value */
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
ret_details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
/* result may not match exactly because of rounding */
ok
(
abs
(
ret_value
.
dwValue
-
new_value
.
dwValue
)
<=
1
,
"Couldn't change value from %ld to %ld, returned %ld
\n
"
,
value
.
dwValue
,
new_value
.
dwValue
,
ret_value
.
dwValue
);
if
(
abs
(
ret_value
.
dwValue
-
new_value
.
dwValue
)
<=
1
)
{
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
/* restore original value */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
}
}
}
}
}
else
if
((
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_MUTE
)
||
(
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_BOOLEAN
)
||
(
control
->
dwControlType
==
MIXERCONTROL_CONTROLTYPE_BUTTON
))
{
MIXERCONTROLDETAILS
details
;
MIXERCONTROLDETAILS_BOOLEAN
value
;
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
new_details
;
MIXERCONTROLDETAILS_BOOLEAN
new_value
;
if
(
winetest_interactive
)
trace
(
" Value=%ld
\n
"
,
value
.
fValue
);
if
(
value
.
fValue
==
FALSE
)
new_value
.
fValue
=
TRUE
;
else
new_value
.
fValue
=
FALSE
;
new_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
new_details
.
dwControlID
=
control
->
dwControlID
;
new_details
.
cChannels
=
1
;
U
(
new_details
).
cMultipleItems
=
0
;
new_details
.
paDetails
=
&
new_value
;
new_details
.
cbDetails
=
sizeof
(
new_value
);
/* change the control value by one step */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
new_details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
MIXERCONTROLDETAILS
ret_details
;
MIXERCONTROLDETAILS_BOOLEAN
ret_value
;
ret_details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
ret_details
.
dwControlID
=
control
->
dwControlID
;
ret_details
.
cChannels
=
1
;
U
(
ret_details
).
cMultipleItems
=
0
;
ret_details
.
paDetails
=
&
ret_value
;
ret_details
.
cbDetails
=
sizeof
(
ret_value
);
/* read back the new control value */
rc
=
mixerGetControlDetails
((
HMIXEROBJ
)
mix
,
&
ret_details
,
MIXER_GETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
/* result may not match exactly because of rounding */
ok
(
ret_value
.
fValue
==
new_value
.
fValue
,
"Couldn't change value from %ld to %ld, returned %ld
\n
"
,
value
.
fValue
,
new_value
.
fValue
,
ret_value
.
fValue
);
if
(
ret_value
.
fValue
==
new_value
.
fValue
)
{
details
.
cbStruct
=
sizeof
(
MIXERCONTROLDETAILS
);
details
.
dwControlID
=
control
->
dwControlID
;
details
.
cChannels
=
1
;
U
(
details
).
cMultipleItems
=
0
;
details
.
paDetails
=
&
value
;
details
.
cbDetails
=
sizeof
(
value
);
/* restore original value */
rc
=
mixerSetControlDetails
((
HMIXEROBJ
)
mix
,
&
details
,
MIXER_SETCONTROLDETAILSF_VALUE
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
"MMSYSERR_NOERROR expected, got %s
\n
"
,
mmsys_error
(
rc
));
}
}
}
}
}
else
{
/* FIXME */
}
}
void
mixer_test_deviceW
(
int
device
)
{
MIXERCAPSW
capsW
;
...
...
@@ -411,6 +761,10 @@ void mixer_test_deviceW(int device)
szPname
,
capsW
.
vDriverVersion
>>
8
,
capsW
.
vDriverVersion
&
0xff
,
capsW
.
wMid
,
capsW
.
wPid
,
capsW
.
cDestinations
);
}
else
{
trace
(
" %d:
\"
%s
\"
%d.%d (%d:%d)
\n
"
,
device
,
szPname
,
capsW
.
vDriverVersion
>>
8
,
capsW
.
vDriverVersion
&
0xff
,
capsW
.
wMid
,
capsW
.
wPid
);
}
rc
=
mixerOpen
(
&
mix
,
device
,
0
,
0
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
...
...
@@ -586,6 +940,7 @@ void mixer_test_deviceW(int device)
S1
(
array
[
nc
].
Bounds
).
dwMaximum
,
array
[
nc
].
Metrics
.
cSteps
);
}
mixer_test_controlW
(
mix
,
&
array
[
nc
]);
}
}
...
...
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