4 * Copyright (c) 2004 Robert Reif
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * add interactive tests
31 #include "wine/test.h"
37 #include "winmm_test.h"
39 static const char * line_flags(DWORD fdwLine
)
41 static char flags
[100];
44 if (fdwLine
&MIXERLINE_LINEF_ACTIVE
) {
45 strcat(flags
,"MIXERLINE_LINEF_ACTIVE");
48 if (fdwLine
&MIXERLINE_LINEF_DISCONNECTED
) {
52 strcat(flags
,"MIXERLINE_LINEF_DISCONNECTED");
56 if (fdwLine
&MIXERLINE_LINEF_SOURCE
) {
60 strcat(flags
,"MIXERLINE_LINEF_SOURCE");
66 static const char * component_type(DWORD dwComponentType
)
68 #define TYPE_TO_STR(x) case x: return #x
69 switch (dwComponentType
) {
70 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_UNDEFINED
);
71 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_DIGITAL
);
72 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_LINE
);
73 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_MONITOR
);
74 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
);
75 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_HEADPHONES
);
76 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_TELEPHONE
);
77 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_WAVEIN
);
78 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_VOICEIN
);
79 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED
);
80 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_DIGITAL
);
81 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_LINE
);
82 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE
);
83 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER
);
84 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC
);
85 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE
);
86 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER
);
87 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT
);
88 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY
);
89 TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_ANALOG
);
95 static const char * target_type(DWORD dwType
)
97 #define TYPE_TO_STR(x) case x: return #x
99 TYPE_TO_STR(MIXERLINE_TARGETTYPE_UNDEFINED
);
100 TYPE_TO_STR(MIXERLINE_TARGETTYPE_WAVEOUT
);
101 TYPE_TO_STR(MIXERLINE_TARGETTYPE_WAVEIN
);
102 TYPE_TO_STR(MIXERLINE_TARGETTYPE_MIDIOUT
);
103 TYPE_TO_STR(MIXERLINE_TARGETTYPE_MIDIIN
);
104 TYPE_TO_STR(MIXERLINE_TARGETTYPE_AUX
);
110 static const char * control_type(DWORD dwControlType
)
112 #define TYPE_TO_STR(x) case x: return #x
113 switch (dwControlType
) {
114 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_CUSTOM
);
115 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BOOLEANMETER
);
116 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SIGNEDMETER
);
117 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_PEAKMETER
);
118 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER
);
119 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BOOLEAN
);
120 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_ONOFF
);
121 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MUTE
);
122 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MONO
);
123 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_LOUDNESS
);
124 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_STEREOENH
);
125 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BASS_BOOST
);
126 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BUTTON
);
127 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_DECIBELS
);
128 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SIGNED
);
129 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_UNSIGNED
);
130 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_PERCENT
);
131 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SLIDER
);
132 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_PAN
);
133 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_QSOUNDPAN
);
134 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_FADER
);
135 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_VOLUME
);
136 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BASS
);
137 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_TREBLE
);
138 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_EQUALIZER
);
139 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SINGLESELECT
);
140 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MUX
);
141 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT
);
142 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MIXER
);
143 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MICROTIME
);
144 TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MILLITIME
);
150 static const char * control_flags(DWORD fdwControl
)
152 static char flags
[100];
155 if (fdwControl
&MIXERCONTROL_CONTROLF_UNIFORM
) {
156 strcat(flags
,"MIXERCONTROL_CONTROLF_UNIFORM");
159 if (fdwControl
&MIXERCONTROL_CONTROLF_MULTIPLE
) {
163 strcat(flags
,"MIXERCONTROL_CONTROLF_MULTIPLE");
167 if (fdwControl
&MIXERCONTROL_CONTROLF_DISABLED
) {
171 strcat(flags
,"MIXERCONTROL_CONTROLF_DISABLED");
177 static void mixer_test_controlA(HMIXER mix
, LPMIXERCONTROLA control
)
181 if ((control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_VOLUME
) ||
182 (control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_UNSIGNED
)) {
183 MIXERCONTROLDETAILS details
;
184 MIXERCONTROLDETAILS_UNSIGNED value
;
186 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
187 details
.dwControlID
= control
->dwControlID
;
188 details
.cChannels
= 1;
189 U(details
).cMultipleItems
= 0;
190 details
.paDetails
= &value
;
191 details
.cbDetails
= sizeof(value
);
193 /* read the current control value */
194 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_GETCONTROLDETAILSF_VALUE
);
195 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
196 "MMSYSERR_NOERROR expected, got %s\n",
198 if (rc
==MMSYSERR_NOERROR
) {
199 MIXERCONTROLDETAILS new_details
;
200 MIXERCONTROLDETAILS_UNSIGNED new_value
;
202 if (winetest_interactive
)
203 trace(" Value=%d\n",value
.dwValue
);
205 if (value
.dwValue
+ control
->Metrics
.cSteps
< S1(control
->Bounds
).dwMaximum
)
206 new_value
.dwValue
= value
.dwValue
+ control
->Metrics
.cSteps
;
208 new_value
.dwValue
= value
.dwValue
- control
->Metrics
.cSteps
;
210 new_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
211 new_details
.dwControlID
= control
->dwControlID
;
212 new_details
.cChannels
= 1;
213 U(new_details
).cMultipleItems
= 0;
214 new_details
.paDetails
= &new_value
;
215 new_details
.cbDetails
= sizeof(new_value
);
217 /* change the control value by one step */
218 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&new_details
,MIXER_SETCONTROLDETAILSF_VALUE
);
219 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
220 "MMSYSERR_NOERROR expected, got %s\n",
222 if (rc
==MMSYSERR_NOERROR
) {
223 MIXERCONTROLDETAILS ret_details
;
224 MIXERCONTROLDETAILS_UNSIGNED ret_value
;
226 ret_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
227 ret_details
.dwControlID
= control
->dwControlID
;
228 ret_details
.cChannels
= 1;
229 U(ret_details
).cMultipleItems
= 0;
230 ret_details
.paDetails
= &ret_value
;
231 ret_details
.cbDetails
= sizeof(ret_value
);
233 /* read back the new control value */
234 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&ret_details
,MIXER_GETCONTROLDETAILSF_VALUE
);
235 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
236 "MMSYSERR_NOERROR expected, got %s\n",
238 if (rc
==MMSYSERR_NOERROR
) {
239 /* result may not match exactly because of rounding */
240 ok(abs(ret_value
.dwValue
-new_value
.dwValue
)<=1,
241 "Couldn't change value from %d to %d, returned %d\n",
242 value
.dwValue
,new_value
.dwValue
,ret_value
.dwValue
);
244 if (abs(ret_value
.dwValue
-new_value
.dwValue
)<=1) {
245 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
246 details
.dwControlID
= control
->dwControlID
;
247 details
.cChannels
= 1;
248 U(details
).cMultipleItems
= 0;
249 details
.paDetails
= &value
;
250 details
.cbDetails
= sizeof(value
);
252 /* restore original value */
253 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_SETCONTROLDETAILSF_VALUE
);
254 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
255 "MMSYSERR_NOERROR expected, got %s\n",
261 } else if ((control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_MUTE
) ||
262 (control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_BOOLEAN
) ||
263 (control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_BUTTON
)) {
264 MIXERCONTROLDETAILS details
;
265 MIXERCONTROLDETAILS_BOOLEAN value
;
267 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
268 details
.dwControlID
= control
->dwControlID
;
269 details
.cChannels
= 1;
270 U(details
).cMultipleItems
= 0;
271 details
.paDetails
= &value
;
272 details
.cbDetails
= sizeof(value
);
274 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_GETCONTROLDETAILSF_VALUE
);
275 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
276 "MMSYSERR_NOERROR expected, got %s\n",
278 if (rc
==MMSYSERR_NOERROR
) {
279 MIXERCONTROLDETAILS new_details
;
280 MIXERCONTROLDETAILS_BOOLEAN new_value
;
282 if (winetest_interactive
)
283 trace(" Value=%d\n",value
.fValue
);
285 if (value
.fValue
== FALSE
)
286 new_value
.fValue
= TRUE
;
288 new_value
.fValue
= FALSE
;
290 new_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
291 new_details
.dwControlID
= control
->dwControlID
;
292 new_details
.cChannels
= 1;
293 U(new_details
).cMultipleItems
= 0;
294 new_details
.paDetails
= &new_value
;
295 new_details
.cbDetails
= sizeof(new_value
);
297 /* change the control value by one step */
298 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&new_details
,MIXER_SETCONTROLDETAILSF_VALUE
);
299 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
300 "MMSYSERR_NOERROR expected, got %s\n",
302 if (rc
==MMSYSERR_NOERROR
) {
303 MIXERCONTROLDETAILS ret_details
;
304 MIXERCONTROLDETAILS_BOOLEAN ret_value
;
306 ret_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
307 ret_details
.dwControlID
= control
->dwControlID
;
308 ret_details
.cChannels
= 1;
309 U(ret_details
).cMultipleItems
= 0;
310 ret_details
.paDetails
= &ret_value
;
311 ret_details
.cbDetails
= sizeof(ret_value
);
313 /* read back the new control value */
314 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&ret_details
,MIXER_GETCONTROLDETAILSF_VALUE
);
315 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
316 "MMSYSERR_NOERROR expected, got %s\n",
318 if (rc
==MMSYSERR_NOERROR
) {
319 /* result may not match exactly because of rounding */
320 ok(ret_value
.fValue
==new_value
.fValue
,
321 "Couldn't change value from %d to %d, returned %d\n",
322 value
.fValue
,new_value
.fValue
,ret_value
.fValue
);
324 if (ret_value
.fValue
==new_value
.fValue
) {
325 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
326 details
.dwControlID
= control
->dwControlID
;
327 details
.cChannels
= 1;
328 U(details
).cMultipleItems
= 0;
329 details
.paDetails
= &value
;
330 details
.cbDetails
= sizeof(value
);
332 /* restore original value */
333 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_SETCONTROLDETAILSF_VALUE
);
334 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
335 "MMSYSERR_NOERROR expected, got %s\n",
346 static void mixer_test_deviceA(int device
)
353 rc
=mixerGetDevCapsA(device
,0,sizeof(capsA
));
354 ok(rc
==MMSYSERR_INVALPARAM
,
355 "mixerGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n",
358 rc
=mixerGetDevCapsA(device
,&capsA
,4);
359 ok(rc
==MMSYSERR_NOERROR
,
360 "mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
363 rc
=mixerGetDevCapsA(device
,&capsA
,sizeof(capsA
));
364 ok(rc
==MMSYSERR_NOERROR
,
365 "mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
368 if (winetest_interactive
) {
369 trace(" %d: \"%s\" %d.%d (%d:%d) destinations=%d\n", device
,
370 capsA
.szPname
, capsA
.vDriverVersion
>> 8,
371 capsA
.vDriverVersion
& 0xff,capsA
.wMid
,capsA
.wPid
,
372 capsA
.cDestinations
);
374 trace(" %d: \"%s\" %d.%d (%d:%d)\n", device
,
375 capsA
.szPname
, capsA
.vDriverVersion
>> 8,
376 capsA
.vDriverVersion
& 0xff,capsA
.wMid
,capsA
.wPid
);
379 rc
=mixerOpen(&mix
, device
, 0, 0, 0);
380 ok(rc
==MMSYSERR_NOERROR
,
381 "mixerOpen: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc
));
382 if (rc
==MMSYSERR_NOERROR
) {
383 rc
=mixerOpen(&mix
, device
, 0, 0, CALLBACK_FUNCTION
);
384 ok(rc
==MMSYSERR_INVALFLAG
,
385 "mixerOpen: MMSYSERR_INVALFLAG expected, got %s\n", mmsys_error(rc
));
387 /* Shouldn't open without a valid HWND */
388 rc
=mixerOpen(&mix
, device
, 0, 0, CALLBACK_WINDOW
);
389 ok(rc
==MMSYSERR_INVALPARAM
,
390 "mixerOpen: MMSYSERR_INVALPARAM expected, got %s\n", mmsys_error(rc
));
393 for (d
=0;d
<capsA
.cDestinations
;d
++) {
394 MIXERLINEA mixerlineA
;
395 mixerlineA
.cbStruct
= 0;
396 mixerlineA
.dwDestination
=d
;
397 rc
=mixerGetLineInfoA((HMIXEROBJ
)mix
,&mixerlineA
,
398 MIXER_GETLINEINFOF_DESTINATION
);
399 ok(rc
==MMSYSERR_INVALPARAM
,
400 "mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
401 "MMSYSERR_INVALPARAM expected, got %s\n",
404 mixerlineA
.cbStruct
= sizeof(mixerlineA
);
405 mixerlineA
.dwDestination
=capsA
.cDestinations
;
406 rc
=mixerGetLineInfoA((HMIXEROBJ
)mix
,&mixerlineA
,
407 MIXER_GETLINEINFOF_DESTINATION
);
408 ok(rc
==MMSYSERR_INVALPARAM
||rc
==MIXERR_INVALLINE
,
409 "mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
410 "MMSYSERR_INVALPARAM or MIXERR_INVALLINE expected, got %s\n",
413 mixerlineA
.cbStruct
= sizeof(mixerlineA
);
414 mixerlineA
.dwDestination
=d
;
415 rc
=mixerGetLineInfoA((HMIXEROBJ
)mix
,0,
416 MIXER_GETLINEINFOF_DESTINATION
);
417 ok(rc
==MMSYSERR_INVALPARAM
,
418 "mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
419 "MMSYSERR_INVALPARAM expected, got %s\n",
422 mixerlineA
.cbStruct
= sizeof(mixerlineA
);
423 mixerlineA
.dwDestination
=d
;
424 rc
=mixerGetLineInfoA((HMIXEROBJ
)mix
,&mixerlineA
,-1);
425 ok(rc
==MMSYSERR_INVALFLAG
,
426 "mixerGetLineInfoA(-1): MMSYSERR_INVALFLAG expected, got %s\n",
429 mixerlineA
.cbStruct
= sizeof(mixerlineA
);
430 mixerlineA
.dwDestination
=d
;
431 rc
=mixerGetLineInfoA((HMIXEROBJ
)mix
,&mixerlineA
,
432 MIXER_GETLINEINFOF_DESTINATION
);
433 ok(rc
==MMSYSERR_NOERROR
||rc
==MMSYSERR_NODRIVER
,
434 "mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
435 "MMSYSERR_NOERROR expected, got %s\n",
437 if (rc
==MMSYSERR_NODRIVER
)
438 trace(" No Driver\n");
439 else if (rc
==MMSYSERR_NOERROR
&& winetest_interactive
) {
440 trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
441 d
,mixerlineA
.szShortName
, mixerlineA
.szName
,
442 mixerlineA
.dwDestination
,mixerlineA
.dwSource
);
443 trace(" LineID=%08x Channels=%d "
444 "Connections=%d Controls=%d\n",
445 mixerlineA
.dwLineID
,mixerlineA
.cChannels
,
446 mixerlineA
.cConnections
,mixerlineA
.cControls
);
447 trace(" State=0x%08x(%s)\n",
448 mixerlineA
.fdwLine
,line_flags(mixerlineA
.fdwLine
));
449 trace(" ComponentType=%s\n",
450 component_type(mixerlineA
.dwComponentType
));
452 target_type(mixerlineA
.Target
.dwType
));
453 trace(" Device=%d (%s) %d.%d (%d:%d)\n",
454 mixerlineA
.Target
.dwDeviceID
,
455 mixerlineA
.Target
.szPname
,
456 mixerlineA
.Target
.vDriverVersion
>> 8,
457 mixerlineA
.Target
.vDriverVersion
& 0xff,
458 mixerlineA
.Target
.wMid
, mixerlineA
.Target
.wPid
);
460 ns
=mixerlineA
.cConnections
;
462 mixerlineA
.cbStruct
= sizeof(mixerlineA
);
463 mixerlineA
.dwDestination
=d
;
464 mixerlineA
.dwSource
=s
;
465 rc
=mixerGetLineInfoA((HMIXEROBJ
)mix
,&mixerlineA
,
466 MIXER_GETLINEINFOF_SOURCE
);
467 ok(rc
==MMSYSERR_NOERROR
||rc
==MMSYSERR_NODRIVER
,
468 "mixerGetLineInfoA(MIXER_GETLINEINFOF_SOURCE): "
469 "MMSYSERR_NOERROR expected, got %s\n",
471 if (rc
==MMSYSERR_NODRIVER
)
472 trace(" No Driver\n");
473 else if (rc
==MMSYSERR_NOERROR
) {
474 LPMIXERCONTROLA array
;
475 MIXERLINECONTROLSA controls
;
476 if (winetest_interactive
) {
477 trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
478 s
,mixerlineA
.szShortName
, mixerlineA
.szName
,
479 mixerlineA
.dwDestination
,mixerlineA
.dwSource
);
480 trace(" LineID=%08x Channels=%d "
481 "Connections=%d Controls=%d\n",
482 mixerlineA
.dwLineID
,mixerlineA
.cChannels
,
483 mixerlineA
.cConnections
,mixerlineA
.cControls
);
484 trace(" State=0x%08x(%s)\n",
485 mixerlineA
.fdwLine
,line_flags(mixerlineA
.fdwLine
));
486 trace(" ComponentType=%s\n",
487 component_type(mixerlineA
.dwComponentType
));
489 target_type(mixerlineA
.Target
.dwType
));
490 trace(" Device=%d (%s) %d.%d (%d:%d)\n",
491 mixerlineA
.Target
.dwDeviceID
,
492 mixerlineA
.Target
.szPname
,
493 mixerlineA
.Target
.vDriverVersion
>> 8,
494 mixerlineA
.Target
.vDriverVersion
& 0xff,
495 mixerlineA
.Target
.wMid
, mixerlineA
.Target
.wPid
);
497 if (mixerlineA
.cControls
) {
498 array
=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
499 mixerlineA
.cControls
*sizeof(MIXERCONTROLA
));
501 rc
=mixerGetLineControlsA((HMIXEROBJ
)mix
,0,
502 MIXER_GETLINECONTROLSF_ALL
);
503 ok(rc
==MMSYSERR_INVALPARAM
,
504 "mixerGetLineControlsA(MIXER_GETLINECONTROLSF_ALL): "
505 "MMSYSERR_INVALPARAM expected, got %s\n",
508 rc
=mixerGetLineControlsA((HMIXEROBJ
)mix
,&controls
,-1);
509 ok(rc
==MMSYSERR_INVALFLAG
||rc
==MMSYSERR_INVALPARAM
,
510 "mixerGetLineControlsA(-1): "
511 "MMSYSERR_INVALFLAG or MMSYSERR_INVALPARAM expected, got %s\n",
514 controls
.cbStruct
= sizeof(MIXERLINECONTROLSA
);
515 controls
.cControls
= mixerlineA
.cControls
;
516 controls
.dwLineID
= mixerlineA
.dwLineID
;
517 controls
.pamxctrl
= array
;
518 controls
.cbmxctrl
= sizeof(MIXERCONTROLA
);
520 /* FIXME: do MIXER_GETLINECONTROLSF_ONEBYID
521 * and MIXER_GETLINECONTROLSF_ONEBYTYPE
523 rc
=mixerGetLineControlsA((HMIXEROBJ
)mix
,&controls
,
524 MIXER_GETLINECONTROLSF_ALL
);
525 ok(rc
==MMSYSERR_NOERROR
,
526 "mixerGetLineControlsA(MIXER_GETLINECONTROLSF_ALL): "
527 "MMSYSERR_NOERROR expected, got %s\n",
529 if (rc
==MMSYSERR_NOERROR
) {
530 for(nc
=0;nc
<mixerlineA
.cControls
;nc
++) {
531 if (winetest_interactive
) {
532 trace(" %d: \"%s\" (%s) ControlID=%d\n", nc
,
533 array
[nc
].szShortName
,
534 array
[nc
].szName
, array
[nc
].dwControlID
);
535 trace(" ControlType=%s\n",
536 control_type(array
[nc
].dwControlType
));
537 trace(" Control=0x%08x(%s)\n",
538 array
[nc
].fdwControl
,
539 control_flags(array
[nc
].fdwControl
));
540 trace(" Items=%d Min=%d Max=%d Step=%d\n",
541 array
[nc
].cMultipleItems
,
542 S1(array
[nc
].Bounds
).dwMinimum
,
543 S1(array
[nc
].Bounds
).dwMaximum
,
544 array
[nc
].Metrics
.cSteps
);
547 mixer_test_controlA(mix
, &array
[nc
]);
551 HeapFree(GetProcessHeap(),0,array
);
558 ok(rc
==MMSYSERR_NOERROR
,
559 "mixerClose: MMSYSERR_BADDEVICEID expected, got %s\n",
564 static void mixer_test_controlW(HMIXER mix
, LPMIXERCONTROLW control
)
568 if ((control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_VOLUME
) ||
569 (control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_UNSIGNED
)) {
570 MIXERCONTROLDETAILS details
;
571 MIXERCONTROLDETAILS_UNSIGNED value
;
573 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
574 details
.dwControlID
= control
->dwControlID
;
575 details
.cChannels
= 1;
576 U(details
).cMultipleItems
= 0;
577 details
.paDetails
= &value
;
578 details
.cbDetails
= sizeof(value
);
580 /* read the current control value */
581 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_GETCONTROLDETAILSF_VALUE
);
582 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
583 "MMSYSERR_NOERROR expected, got %s\n",
585 if (rc
==MMSYSERR_NOERROR
) {
586 MIXERCONTROLDETAILS new_details
;
587 MIXERCONTROLDETAILS_UNSIGNED new_value
;
589 if (winetest_interactive
)
590 trace(" Value=%d\n",value
.dwValue
);
592 if (value
.dwValue
+ control
->Metrics
.cSteps
< S1(control
->Bounds
).dwMaximum
)
593 new_value
.dwValue
= value
.dwValue
+ control
->Metrics
.cSteps
;
595 new_value
.dwValue
= value
.dwValue
- control
->Metrics
.cSteps
;
597 new_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
598 new_details
.dwControlID
= control
->dwControlID
;
599 new_details
.cChannels
= 1;
600 U(new_details
).cMultipleItems
= 0;
601 new_details
.paDetails
= &new_value
;
602 new_details
.cbDetails
= sizeof(new_value
);
604 /* change the control value by one step */
605 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&new_details
,MIXER_SETCONTROLDETAILSF_VALUE
);
606 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
607 "MMSYSERR_NOERROR expected, got %s\n",
609 if (rc
==MMSYSERR_NOERROR
) {
610 MIXERCONTROLDETAILS ret_details
;
611 MIXERCONTROLDETAILS_UNSIGNED ret_value
;
613 ret_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
614 ret_details
.dwControlID
= control
->dwControlID
;
615 ret_details
.cChannels
= 1;
616 U(ret_details
).cMultipleItems
= 0;
617 ret_details
.paDetails
= &ret_value
;
618 ret_details
.cbDetails
= sizeof(ret_value
);
620 /* read back the new control value */
621 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&ret_details
,MIXER_GETCONTROLDETAILSF_VALUE
);
622 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
623 "MMSYSERR_NOERROR expected, got %s\n",
625 if (rc
==MMSYSERR_NOERROR
) {
626 /* result may not match exactly because of rounding */
627 ok(abs(ret_value
.dwValue
-new_value
.dwValue
)<=1,
628 "Couldn't change value from %d to %d, returned %d\n",
629 value
.dwValue
,new_value
.dwValue
,ret_value
.dwValue
);
631 if (abs(ret_value
.dwValue
-new_value
.dwValue
)<=1) {
632 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
633 details
.dwControlID
= control
->dwControlID
;
634 details
.cChannels
= 1;
635 U(details
).cMultipleItems
= 0;
636 details
.paDetails
= &value
;
637 details
.cbDetails
= sizeof(value
);
639 /* restore original value */
640 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_SETCONTROLDETAILSF_VALUE
);
641 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
642 "MMSYSERR_NOERROR expected, got %s\n",
648 } else if ((control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_MUTE
) ||
649 (control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_BOOLEAN
) ||
650 (control
->dwControlType
== MIXERCONTROL_CONTROLTYPE_BUTTON
)) {
651 MIXERCONTROLDETAILS details
;
652 MIXERCONTROLDETAILS_BOOLEAN value
;
654 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
655 details
.dwControlID
= control
->dwControlID
;
656 details
.cChannels
= 1;
657 U(details
).cMultipleItems
= 0;
658 details
.paDetails
= &value
;
659 details
.cbDetails
= sizeof(value
);
661 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_GETCONTROLDETAILSF_VALUE
);
662 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
663 "MMSYSERR_NOERROR expected, got %s\n",
665 if (rc
==MMSYSERR_NOERROR
) {
666 MIXERCONTROLDETAILS new_details
;
667 MIXERCONTROLDETAILS_BOOLEAN new_value
;
669 if (winetest_interactive
)
670 trace(" Value=%d\n",value
.fValue
);
672 if (value
.fValue
== FALSE
)
673 new_value
.fValue
= TRUE
;
675 new_value
.fValue
= FALSE
;
677 new_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
678 new_details
.dwControlID
= control
->dwControlID
;
679 new_details
.cChannels
= 1;
680 U(new_details
).cMultipleItems
= 0;
681 new_details
.paDetails
= &new_value
;
682 new_details
.cbDetails
= sizeof(new_value
);
684 /* change the control value by one step */
685 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&new_details
,MIXER_SETCONTROLDETAILSF_VALUE
);
686 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
687 "MMSYSERR_NOERROR expected, got %s\n",
689 if (rc
==MMSYSERR_NOERROR
) {
690 MIXERCONTROLDETAILS ret_details
;
691 MIXERCONTROLDETAILS_BOOLEAN ret_value
;
693 ret_details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
694 ret_details
.dwControlID
= control
->dwControlID
;
695 ret_details
.cChannels
= 1;
696 U(ret_details
).cMultipleItems
= 0;
697 ret_details
.paDetails
= &ret_value
;
698 ret_details
.cbDetails
= sizeof(ret_value
);
700 /* read back the new control value */
701 rc
=mixerGetControlDetails((HMIXEROBJ
)mix
,&ret_details
,MIXER_GETCONTROLDETAILSF_VALUE
);
702 ok(rc
==MMSYSERR_NOERROR
,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
703 "MMSYSERR_NOERROR expected, got %s\n",
705 if (rc
==MMSYSERR_NOERROR
) {
706 /* result may not match exactly because of rounding */
707 ok(ret_value
.fValue
==new_value
.fValue
,
708 "Couldn't change value from %d to %d, returned %d\n",
709 value
.fValue
,new_value
.fValue
,ret_value
.fValue
);
711 if (ret_value
.fValue
==new_value
.fValue
) {
712 details
.cbStruct
= sizeof(MIXERCONTROLDETAILS
);
713 details
.dwControlID
= control
->dwControlID
;
714 details
.cChannels
= 1;
715 U(details
).cMultipleItems
= 0;
716 details
.paDetails
= &value
;
717 details
.cbDetails
= sizeof(value
);
719 /* restore original value */
720 rc
=mixerSetControlDetails((HMIXEROBJ
)mix
,&details
,MIXER_SETCONTROLDETAILSF_VALUE
);
721 ok(rc
==MMSYSERR_NOERROR
,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
722 "MMSYSERR_NOERROR expected, got %s\n",
733 static void mixer_test_deviceW(int device
)
739 char szShortName
[MIXER_SHORT_NAME_CHARS
];
740 char szName
[MIXER_LONG_NAME_CHARS
];
741 char szPname
[MAXPNAMELEN
];
743 rc
=mixerGetDevCapsW(device
,0,sizeof(capsW
));
744 ok(rc
==MMSYSERR_INVALPARAM
,
745 "mixerGetDevCapsW: MMSYSERR_INVALPARAM expected, got %s\n",
748 rc
=mixerGetDevCapsW(device
,&capsW
,4);
749 ok(rc
==MMSYSERR_NOERROR
,
750 "mixerGetDevCapsW: MMSYSERR_NOERROR expected, got %s\n",
753 rc
=mixerGetDevCapsW(device
,&capsW
,sizeof(capsW
));
754 ok(rc
==MMSYSERR_NOERROR
,
755 "mixerGetDevCapsW: MMSYSERR_NOERROR expected, got %s\n",
758 WideCharToMultiByte(CP_ACP
,0,capsW
.szPname
, MAXPNAMELEN
,szPname
,
759 MAXPNAMELEN
,NULL
,NULL
);
760 if (winetest_interactive
) {
761 trace(" %d: \"%s\" %d.%d (%d:%d) destinations=%d\n", device
,
762 szPname
, capsW
.vDriverVersion
>> 8,
763 capsW
.vDriverVersion
& 0xff,capsW
.wMid
,capsW
.wPid
,
764 capsW
.cDestinations
);
766 trace(" %d: \"%s\" %d.%d (%d:%d)\n", device
,
767 szPname
, capsW
.vDriverVersion
>> 8,
768 capsW
.vDriverVersion
& 0xff,capsW
.wMid
,capsW
.wPid
);
772 rc
=mixerOpen(&mix
, device
, 0, 0, 0);
773 ok(rc
==MMSYSERR_NOERROR
,
774 "mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",mmsys_error(rc
));
775 if (rc
==MMSYSERR_NOERROR
) {
776 rc
=mixerOpen(&mix
, device
, 0, 0, CALLBACK_FUNCTION
);
777 ok(rc
==MMSYSERR_INVALFLAG
,
778 "mixerOpen: MMSYSERR_INVALFLAG expected, got %s\n", mmsys_error(rc
));
780 /* Shouldn't open without a valid HWND */
781 rc
=mixerOpen(&mix
, device
, 0, 0, CALLBACK_WINDOW
);
782 ok(rc
==MMSYSERR_INVALPARAM
,
783 "mixerOpen: MMSYSERR_INVALPARAM expected, got %s\n", mmsys_error(rc
));
785 for (d
=0;d
<capsW
.cDestinations
;d
++) {
786 MIXERLINEW mixerlineW
;
787 mixerlineW
.cbStruct
= 0;
788 mixerlineW
.dwDestination
=d
;
789 rc
=mixerGetLineInfoW((HMIXEROBJ
)mix
,&mixerlineW
,
790 MIXER_GETLINEINFOF_DESTINATION
);
791 ok(rc
==MMSYSERR_INVALPARAM
,
792 "mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
793 "MMSYSERR_INVALPARAM expected, got %s\n",
796 mixerlineW
.cbStruct
= sizeof(mixerlineW
);
797 mixerlineW
.dwDestination
=capsW
.cDestinations
;
798 rc
=mixerGetLineInfoW((HMIXEROBJ
)mix
,&mixerlineW
,
799 MIXER_GETLINEINFOF_DESTINATION
);
800 ok(rc
==MMSYSERR_INVALPARAM
||rc
==MIXERR_INVALLINE
,
801 "mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
802 "MMSYSERR_INVALPARAM or MIXERR_INVALLINE expected, got %s\n",
805 mixerlineW
.cbStruct
= sizeof(mixerlineW
);
806 mixerlineW
.dwDestination
=d
;
807 rc
=mixerGetLineInfoW((HMIXEROBJ
)mix
,0,
808 MIXER_GETLINEINFOF_DESTINATION
);
809 ok(rc
==MMSYSERR_INVALPARAM
,
810 "mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
811 "MMSYSERR_INVALPARAM expected, got %s\n",
814 mixerlineW
.cbStruct
= sizeof(mixerlineW
);
815 mixerlineW
.dwDestination
=d
;
816 rc
=mixerGetLineInfoW((HMIXEROBJ
)mix
,&mixerlineW
,-1);
817 ok(rc
==MMSYSERR_INVALFLAG
,
818 "mixerGetLineInfoW(-1): MMSYSERR_INVALFLAG expected, got %s\n",
821 mixerlineW
.cbStruct
= sizeof(mixerlineW
);
822 mixerlineW
.dwDestination
=d
;
823 rc
=mixerGetLineInfoW((HMIXEROBJ
)mix
,&mixerlineW
,
824 MIXER_GETLINEINFOF_DESTINATION
);
825 ok(rc
==MMSYSERR_NOERROR
||rc
==MMSYSERR_NODRIVER
,
826 "mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
827 "MMSYSERR_NOERROR expected, got %s\n",
829 if (rc
==MMSYSERR_NODRIVER
)
830 trace(" No Driver\n");
831 else if (rc
==MMSYSERR_NOERROR
&& winetest_interactive
) {
832 WideCharToMultiByte(CP_ACP
,0,mixerlineW
.szShortName
,
833 MIXER_SHORT_NAME_CHARS
,szShortName
,
834 MIXER_SHORT_NAME_CHARS
,NULL
,NULL
);
835 WideCharToMultiByte(CP_ACP
,0,mixerlineW
.szName
,
836 MIXER_LONG_NAME_CHARS
,szName
,
837 MIXER_LONG_NAME_CHARS
,NULL
,NULL
);
838 WideCharToMultiByte(CP_ACP
,0,mixerlineW
.Target
.szPname
,
840 MAXPNAMELEN
,NULL
, NULL
);
841 trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
842 d
,szShortName
,szName
,
843 mixerlineW
.dwDestination
,mixerlineW
.dwSource
);
844 trace(" LineID=%08x Channels=%d "
845 "Connections=%d Controls=%d\n",
846 mixerlineW
.dwLineID
,mixerlineW
.cChannels
,
847 mixerlineW
.cConnections
,mixerlineW
.cControls
);
848 trace(" State=0x%08x(%s)\n",
849 mixerlineW
.fdwLine
,line_flags(mixerlineW
.fdwLine
));
850 trace(" ComponentType=%s\n",
851 component_type(mixerlineW
.dwComponentType
));
853 target_type(mixerlineW
.Target
.dwType
));
854 trace(" Device=%d (%s) %d.%d (%d:%d)\n",
855 mixerlineW
.Target
.dwDeviceID
,szPname
,
856 mixerlineW
.Target
.vDriverVersion
>> 8,
857 mixerlineW
.Target
.vDriverVersion
& 0xff,
858 mixerlineW
.Target
.wMid
, mixerlineW
.Target
.wPid
);
860 ns
=mixerlineW
.cConnections
;
862 mixerlineW
.cbStruct
= sizeof(mixerlineW
);
863 mixerlineW
.dwDestination
=d
;
864 mixerlineW
.dwSource
=s
;
865 rc
=mixerGetLineInfoW((HMIXEROBJ
)mix
,&mixerlineW
,
866 MIXER_GETLINEINFOF_SOURCE
);
867 ok(rc
==MMSYSERR_NOERROR
||rc
==MMSYSERR_NODRIVER
,
868 "mixerGetLineInfoW(MIXER_GETLINEINFOF_SOURCE): "
869 "MMSYSERR_NOERROR expected, got %s\n",
871 if (rc
==MMSYSERR_NODRIVER
)
872 trace(" No Driver\n");
873 else if (rc
==MMSYSERR_NOERROR
) {
874 LPMIXERCONTROLW array
;
875 MIXERLINECONTROLSW controls
;
876 if (winetest_interactive
) {
877 WideCharToMultiByte(CP_ACP
,0,mixerlineW
.szShortName
,
878 MIXER_SHORT_NAME_CHARS
,szShortName
,
879 MIXER_SHORT_NAME_CHARS
,NULL
,NULL
);
880 WideCharToMultiByte(CP_ACP
,0,mixerlineW
.szName
,
881 MIXER_LONG_NAME_CHARS
,szName
,
882 MIXER_LONG_NAME_CHARS
,NULL
,NULL
);
883 WideCharToMultiByte(CP_ACP
,0,mixerlineW
.Target
.szPname
,
885 MAXPNAMELEN
,NULL
, NULL
);
886 trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
887 s
,szShortName
,szName
,
888 mixerlineW
.dwDestination
,mixerlineW
.dwSource
);
889 trace(" LineID=%08x Channels=%d "
890 "Connections=%d Controls=%d\n",
891 mixerlineW
.dwLineID
,mixerlineW
.cChannels
,
892 mixerlineW
.cConnections
,mixerlineW
.cControls
);
893 trace(" State=0x%08x(%s)\n",
894 mixerlineW
.fdwLine
,line_flags(mixerlineW
.fdwLine
));
895 trace(" ComponentType=%s\n",
896 component_type(mixerlineW
.dwComponentType
));
898 target_type(mixerlineW
.Target
.dwType
));
899 trace(" Device=%d (%s) %d.%d (%d:%d)\n",
900 mixerlineW
.Target
.dwDeviceID
,szPname
,
901 mixerlineW
.Target
.vDriverVersion
>> 8,
902 mixerlineW
.Target
.vDriverVersion
& 0xff,
903 mixerlineW
.Target
.wMid
, mixerlineW
.Target
.wPid
);
905 if (mixerlineW
.cControls
) {
906 array
=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
907 mixerlineW
.cControls
*sizeof(MIXERCONTROLW
));
909 rc
=mixerGetLineControlsW((HMIXEROBJ
)mix
,0,
910 MIXER_GETLINECONTROLSF_ALL
);
911 ok(rc
==MMSYSERR_INVALPARAM
,
912 "mixerGetLineControlsW(MIXER_GETLINECONTROLSF_ALL): "
913 "MMSYSERR_INVALPARAM expected, got %s\n",
915 rc
=mixerGetLineControlsW((HMIXEROBJ
)mix
,&controls
,
917 ok(rc
==MMSYSERR_INVALFLAG
||rc
==MMSYSERR_INVALPARAM
,
918 "mixerGetLineControlsA(-1): "
919 "MMSYSERR_INVALFLAG or MMSYSERR_INVALPARAM expected, got %s\n",
922 controls
.cbStruct
= sizeof(MIXERLINECONTROLSW
);
923 controls
.cControls
= mixerlineW
.cControls
;
924 controls
.dwLineID
= mixerlineW
.dwLineID
;
925 controls
.pamxctrl
= array
;
926 controls
.cbmxctrl
= sizeof(MIXERCONTROLW
);
928 /* FIXME: do MIXER_GETLINECONTROLSF_ONEBYID
929 * and MIXER_GETLINECONTROLSF_ONEBYTYPE
931 rc
=mixerGetLineControlsW((HMIXEROBJ
)mix
,&controls
,
932 MIXER_GETLINECONTROLSF_ALL
);
933 ok(rc
==MMSYSERR_NOERROR
,
934 "mixerGetLineControlsW(MIXER_GETLINECONTROLSF_ALL): "
935 "MMSYSERR_NOERROR expected, got %s\n",
937 if (rc
==MMSYSERR_NOERROR
) {
938 for(nc
=0;nc
<mixerlineW
.cControls
;nc
++) {
939 if (winetest_interactive
) {
940 WideCharToMultiByte(CP_ACP
,0,array
[nc
].szShortName
,
941 MIXER_SHORT_NAME_CHARS
,szShortName
,
942 MIXER_SHORT_NAME_CHARS
,NULL
,NULL
);
943 WideCharToMultiByte(CP_ACP
,0,array
[nc
].szName
,
944 MIXER_LONG_NAME_CHARS
,szName
,
945 MIXER_LONG_NAME_CHARS
,NULL
,NULL
);
946 trace(" %d: \"%s\" (%s) ControlID=%d\n", nc
,
947 szShortName
, szName
, array
[nc
].dwControlID
);
948 trace(" ControlType=%s\n",
949 control_type(array
[nc
].dwControlType
));
950 trace(" Control=0x%08x(%s)\n",
951 array
[nc
].fdwControl
,
952 control_flags(array
[nc
].fdwControl
));
953 trace(" Items=%d Min=%d Max=%d Step=%d\n",
954 array
[nc
].cMultipleItems
,
955 S1(array
[nc
].Bounds
).dwMinimum
,
956 S1(array
[nc
].Bounds
).dwMaximum
,
957 array
[nc
].Metrics
.cSteps
);
959 mixer_test_controlW(mix
, &array
[nc
]);
963 HeapFree(GetProcessHeap(),0,array
);
970 ok(rc
==MMSYSERR_NOERROR
,
971 "mixerClose: MMSYSERR_BADDEVICEID expected, got %s\n",
976 static void mixer_testsA(void)
983 trace("--- Testing ASCII functions ---\n");
985 ndev
=mixerGetNumDevs();
986 trace("found %d Mixer devices\n",ndev
);
988 rc
=mixerGetDevCapsA(ndev
+1,&capsA
,sizeof(capsA
));
989 ok(rc
==MMSYSERR_BADDEVICEID
,
990 "mixerGetDevCapsA: MMSYSERR_BADDEVICEID expected, got %s\n",
993 rc
=mixerOpen(&mix
, ndev
+1, 0, 0, 0);
994 ok(rc
==MMSYSERR_BADDEVICEID
,
995 "mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",
999 mixer_test_deviceA(d
);
1002 static void mixer_testsW(void)
1009 trace("--- Testing WCHAR functions ---\n");
1011 ndev
=mixerGetNumDevs();
1012 trace("found %d Mixer devices\n",ndev
);
1014 rc
=mixerGetDevCapsW(ndev
+1,&capsW
,sizeof(capsW
));
1015 ok(rc
==MMSYSERR_BADDEVICEID
||rc
==MMSYSERR_NOTSUPPORTED
,
1016 "mixerGetDevCapsW: MMSYSERR_BADDEVICEID or MMSYSERR_NOTSUPPORTED "
1017 "expected, got %s\n", mmsys_error(rc
));
1018 if (rc
==MMSYSERR_NOTSUPPORTED
)
1021 rc
=mixerOpen(&mix
, ndev
+1, 0, 0, 0);
1022 ok(rc
==MMSYSERR_BADDEVICEID
,
1023 "mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",
1026 for (d
=0;d
<ndev
;d
++)
1027 mixer_test_deviceW(d
);