2004-08-09 20:46:26 +02:00
|
|
|
/*
|
|
|
|
* Test mixer
|
|
|
|
*
|
|
|
|
* Copyright (c) 2004 Robert Reif
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-08-09 20:46:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* To Do:
|
|
|
|
* add interactive tests
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winnls.h"
|
|
|
|
#include "mmsystem.h"
|
|
|
|
|
|
|
|
#include "winmm_test.h"
|
|
|
|
|
2020-05-27 23:55:44 +02:00
|
|
|
static BOOL compare_uint(unsigned int x, unsigned int y, unsigned int max_diff)
|
|
|
|
{
|
|
|
|
unsigned int diff = x > y ? x - y : y - x;
|
|
|
|
return diff <= max_diff;
|
|
|
|
}
|
|
|
|
|
2004-08-09 20:46:26 +02:00
|
|
|
static const char * line_flags(DWORD fdwLine)
|
|
|
|
{
|
|
|
|
static char flags[100];
|
|
|
|
BOOL first=TRUE;
|
|
|
|
flags[0]=0;
|
|
|
|
if (fdwLine&MIXERLINE_LINEF_ACTIVE) {
|
|
|
|
strcat(flags,"MIXERLINE_LINEF_ACTIVE");
|
|
|
|
first=FALSE;
|
|
|
|
}
|
|
|
|
if (fdwLine&MIXERLINE_LINEF_DISCONNECTED) {
|
|
|
|
if (!first)
|
|
|
|
strcat(flags, "|");
|
|
|
|
|
|
|
|
strcat(flags,"MIXERLINE_LINEF_DISCONNECTED");
|
|
|
|
first=FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fdwLine&MIXERLINE_LINEF_SOURCE) {
|
|
|
|
if (!first)
|
|
|
|
strcat(flags, "|");
|
|
|
|
|
|
|
|
strcat(flags,"MIXERLINE_LINEF_SOURCE");
|
|
|
|
}
|
|
|
|
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * component_type(DWORD dwComponentType)
|
|
|
|
{
|
|
|
|
#define TYPE_TO_STR(x) case x: return #x
|
|
|
|
switch (dwComponentType) {
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_UNDEFINED);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_DIGITAL);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_LINE);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_MONITOR);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_SPEAKERS);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_HEADPHONES);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_TELEPHONE);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_WAVEIN);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_DST_VOICEIN);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_DIGITAL);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_LINE);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY);
|
|
|
|
TYPE_TO_STR(MIXERLINE_COMPONENTTYPE_SRC_ANALOG);
|
|
|
|
}
|
|
|
|
#undef TYPE_TO_STR
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * target_type(DWORD dwType)
|
|
|
|
{
|
|
|
|
#define TYPE_TO_STR(x) case x: return #x
|
|
|
|
switch (dwType) {
|
|
|
|
TYPE_TO_STR(MIXERLINE_TARGETTYPE_UNDEFINED);
|
|
|
|
TYPE_TO_STR(MIXERLINE_TARGETTYPE_WAVEOUT);
|
|
|
|
TYPE_TO_STR(MIXERLINE_TARGETTYPE_WAVEIN);
|
|
|
|
TYPE_TO_STR(MIXERLINE_TARGETTYPE_MIDIOUT);
|
|
|
|
TYPE_TO_STR(MIXERLINE_TARGETTYPE_MIDIIN);
|
|
|
|
TYPE_TO_STR(MIXERLINE_TARGETTYPE_AUX);
|
|
|
|
}
|
|
|
|
#undef TYPE_TO_STR
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * control_type(DWORD dwControlType)
|
|
|
|
{
|
|
|
|
#define TYPE_TO_STR(x) case x: return #x
|
|
|
|
switch (dwControlType) {
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_CUSTOM);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BOOLEANMETER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SIGNEDMETER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_PEAKMETER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BOOLEAN);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_ONOFF);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MUTE);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MONO);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_LOUDNESS);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_STEREOENH);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BASS_BOOST);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BUTTON);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_DECIBELS);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SIGNED);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_UNSIGNED);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_PERCENT);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SLIDER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_PAN);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_QSOUNDPAN);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_FADER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_VOLUME);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_BASS);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_TREBLE);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_EQUALIZER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_SINGLESELECT);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MUX);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MIXER);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MICROTIME);
|
|
|
|
TYPE_TO_STR(MIXERCONTROL_CONTROLTYPE_MILLITIME);
|
|
|
|
}
|
|
|
|
#undef TYPE_TO_STR
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char * control_flags(DWORD fdwControl)
|
|
|
|
{
|
|
|
|
static char flags[100];
|
|
|
|
BOOL first=TRUE;
|
|
|
|
flags[0]=0;
|
|
|
|
if (fdwControl&MIXERCONTROL_CONTROLF_UNIFORM) {
|
|
|
|
strcat(flags,"MIXERCONTROL_CONTROLF_UNIFORM");
|
|
|
|
first=FALSE;
|
|
|
|
}
|
|
|
|
if (fdwControl&MIXERCONTROL_CONTROLF_MULTIPLE) {
|
|
|
|
if (!first)
|
|
|
|
strcat(flags, "|");
|
|
|
|
|
|
|
|
strcat(flags,"MIXERCONTROL_CONTROLF_MULTIPLE");
|
|
|
|
first=FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fdwControl&MIXERCONTROL_CONTROLF_DISABLED) {
|
|
|
|
if (!first)
|
|
|
|
strcat(flags, "|");
|
|
|
|
|
|
|
|
strcat(flags,"MIXERCONTROL_CONTROLF_DISABLED");
|
|
|
|
}
|
|
|
|
|
|
|
|
return flags;
|
|
|
|
}
|
2004-08-27 21:39:10 +02:00
|
|
|
|
2008-12-21 08:48:34 +01:00
|
|
|
static void test_mixerClose(HMIXER mix)
|
|
|
|
{
|
|
|
|
MMRESULT rc;
|
|
|
|
|
|
|
|
rc = mixerClose(mix);
|
|
|
|
ok(rc == MMSYSERR_NOERROR || rc == MMSYSERR_INVALHANDLE,
|
|
|
|
"mixerClose: MMSYSERR_NOERROR or MMSYSERR_INVALHANDLE expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
}
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
static void mixer_test_controlA(HMIXEROBJ mix, MIXERCONTROLA *control)
|
2004-08-27 21:39:10 +02:00
|
|
|
{
|
|
|
|
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.cbDetails = sizeof(value);
|
|
|
|
|
2013-10-24 23:41:53 +02:00
|
|
|
/* test NULL paDetails */
|
|
|
|
details.paDetails = NULL;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsA(mix, &details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2013-10-24 23:41:53 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
2004-08-27 21:39:10 +02:00
|
|
|
/* read the current control value */
|
2013-10-24 23:41:53 +02:00
|
|
|
details.paDetails = &value;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsA(mix, &details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2007-12-05 13:47:30 +01:00
|
|
|
if (rc==MMSYSERR_NOERROR && winetest_interactive) {
|
2004-08-27 21:39:10 +02:00
|
|
|
MIXERCONTROLDETAILS new_details;
|
|
|
|
MIXERCONTROLDETAILS_UNSIGNED new_value;
|
|
|
|
|
2007-12-05 13:47:30 +01:00
|
|
|
trace(" Value=%d\n",value.dwValue);
|
2004-08-27 21:39:10 +02:00
|
|
|
|
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &new_details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsA(mix, &ret_details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2020-05-27 23:55:44 +02:00
|
|
|
ok(compare_uint(ret_value.dwValue, new_value.dwValue, 1),
|
2006-11-12 21:06:57 +01:00
|
|
|
"Couldn't change value from %d to %d, returned %d\n",
|
2004-08-27 21:39:10 +02:00
|
|
|
value.dwValue,new_value.dwValue,ret_value.dwValue);
|
|
|
|
|
2020-05-27 23:55:44 +02:00
|
|
|
if (compare_uint(ret_value.dwValue, new_value.dwValue, 1)) {
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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);
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsA(mix, &details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2007-12-05 13:47:30 +01:00
|
|
|
if (rc==MMSYSERR_NOERROR && winetest_interactive) {
|
2004-08-27 21:39:10 +02:00
|
|
|
MIXERCONTROLDETAILS new_details;
|
|
|
|
MIXERCONTROLDETAILS_BOOLEAN new_value;
|
|
|
|
|
2007-12-05 13:47:30 +01:00
|
|
|
trace(" Value=%d\n",value.fValue);
|
2004-08-27 21:39:10 +02:00
|
|
|
|
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &new_details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsA(mix, &ret_details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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,
|
2006-11-12 21:06:57 +01:00
|
|
|
"Couldn't change value from %d to %d, returned %d\n",
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* FIXME */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-16 12:45:25 +02:00
|
|
|
static void mixer_test_deviceA(int device)
|
2004-08-09 20:46:26 +02:00
|
|
|
{
|
|
|
|
MIXERCAPSA capsA;
|
2013-11-03 23:34:00 +01:00
|
|
|
HMIXEROBJ mix;
|
2004-08-09 20:46:26 +02:00
|
|
|
MMRESULT rc;
|
|
|
|
DWORD d,s,ns,nc;
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsA(device,0,sizeof(capsA));
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetDevCapsA: MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsA(device,&capsA,4);
|
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsA(device,&capsA,sizeof(capsA));
|
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
2004-08-11 20:50:09 +02:00
|
|
|
if (winetest_interactive) {
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" %d.%d (%d:%d) destinations=%d\n", device,
|
2004-08-11 20:50:09 +02:00
|
|
|
capsA.szPname, capsA.vDriverVersion >> 8,
|
|
|
|
capsA.vDriverVersion & 0xff,capsA.wMid,capsA.wPid,
|
|
|
|
capsA.cDestinations);
|
2004-08-27 21:39:10 +02:00
|
|
|
} else {
|
|
|
|
trace(" %d: \"%s\" %d.%d (%d:%d)\n", device,
|
|
|
|
capsA.szPname, capsA.vDriverVersion >> 8,
|
|
|
|
capsA.vDriverVersion & 0xff,capsA.wMid,capsA.wPid);
|
2004-08-11 20:50:09 +02:00
|
|
|
}
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerOpen((HMIXER*)&mix, device, 0, 0, 0);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
2007-04-13 18:34:35 +02:00
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc));
|
2004-08-09 20:46:26 +02:00
|
|
|
if (rc==MMSYSERR_NOERROR) {
|
2015-01-27 16:02:50 +01:00
|
|
|
MIXERCAPSA capsA2;
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsA((UINT_PTR)mix,&capsA2,sizeof(capsA2));
|
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetDevCapsA: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
ok(!strcmp(capsA2.szPname, capsA.szPname), "Got wrong device caps\n");
|
|
|
|
|
2004-08-09 20:46:26 +02:00
|
|
|
for (d=0;d<capsA.cDestinations;d++) {
|
|
|
|
MIXERLINEA mixerlineA;
|
|
|
|
mixerlineA.cbStruct = 0;
|
|
|
|
mixerlineA.dwDestination=d;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoA(mix, &mixerlineA, MIXER_GETLINEINFOF_DESTINATION);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
|
|
|
|
"MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineA.cbStruct = sizeof(mixerlineA);
|
|
|
|
mixerlineA.dwDestination=capsA.cDestinations;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoA(mix, &mixerlineA, MIXER_GETLINEINFOF_DESTINATION);
|
2004-08-16 23:10:04 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM||rc==MIXERR_INVALLINE,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
|
2004-08-16 23:10:04 +02:00
|
|
|
"MMSYSERR_INVALPARAM or MIXERR_INVALLINE expected, got %s\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineA.cbStruct = sizeof(mixerlineA);
|
|
|
|
mixerlineA.dwDestination=d;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoA(mix, 0, MIXER_GETLINEINFOF_DESTINATION);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
|
|
|
|
"MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineA.cbStruct = sizeof(mixerlineA);
|
|
|
|
mixerlineA.dwDestination=d;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoA(mix, &mixerlineA, -1);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALFLAG,
|
|
|
|
"mixerGetLineInfoA(-1): MMSYSERR_INVALFLAG expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineA.cbStruct = sizeof(mixerlineA);
|
|
|
|
mixerlineA.dwDestination=d;
|
2016-02-10 19:33:23 +01:00
|
|
|
mixerlineA.dwUser = (ULONG_PTR)0xdeadbeef;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoA(mix, &mixerlineA, MIXER_GETLINEINFOF_DESTINATION);
|
2004-10-25 23:46:12 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR||rc==MMSYSERR_NODRIVER,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerGetLineInfoA(MIXER_GETLINEINFOF_DESTINATION): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2016-02-10 19:33:23 +01:00
|
|
|
ok(mixerlineA.dwUser == 0, "dwUser was not reset\n");
|
2004-10-25 23:46:12 +02:00
|
|
|
if (rc==MMSYSERR_NODRIVER)
|
|
|
|
trace(" No Driver\n");
|
2007-10-25 20:46:32 +02:00
|
|
|
else if (rc==MMSYSERR_NOERROR) {
|
|
|
|
if (winetest_interactive) {
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
d,mixerlineA.szShortName, mixerlineA.szName,
|
|
|
|
mixerlineA.dwDestination,mixerlineA.dwSource);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" LineID=%08x Channels=%d "
|
|
|
|
"Connections=%d Controls=%d\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineA.dwLineID,mixerlineA.cChannels,
|
|
|
|
mixerlineA.cConnections,mixerlineA.cControls);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" State=0x%08x(%s)\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineA.fdwLine,line_flags(mixerlineA.fdwLine));
|
|
|
|
trace(" ComponentType=%s\n",
|
|
|
|
component_type(mixerlineA.dwComponentType));
|
|
|
|
trace(" Type=%s\n",
|
|
|
|
target_type(mixerlineA.Target.dwType));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Device=%d (%s) %d.%d (%d:%d)\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineA.Target.dwDeviceID,
|
|
|
|
mixerlineA.Target.szPname,
|
|
|
|
mixerlineA.Target.vDriverVersion >> 8,
|
|
|
|
mixerlineA.Target.vDriverVersion & 0xff,
|
|
|
|
mixerlineA.Target.wMid, mixerlineA.Target.wPid);
|
2007-10-25 20:46:32 +02:00
|
|
|
}
|
|
|
|
ns=mixerlineA.cConnections;
|
|
|
|
for(s=0;s<ns;s++) {
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineA.cbStruct = sizeof(mixerlineA);
|
|
|
|
mixerlineA.dwDestination=d;
|
|
|
|
mixerlineA.dwSource=s;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoA(mix, &mixerlineA, MIXER_GETLINEINFOF_SOURCE);
|
2004-10-25 23:46:12 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR||rc==MMSYSERR_NODRIVER,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerGetLineInfoA(MIXER_GETLINEINFOF_SOURCE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2004-10-25 23:46:12 +02:00
|
|
|
if (rc==MMSYSERR_NODRIVER)
|
|
|
|
trace(" No Driver\n");
|
|
|
|
else if (rc==MMSYSERR_NOERROR) {
|
2004-08-09 20:46:26 +02:00
|
|
|
LPMIXERCONTROLA array;
|
|
|
|
MIXERLINECONTROLSA controls;
|
2004-08-11 20:50:09 +02:00
|
|
|
if (winetest_interactive) {
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
s,mixerlineA.szShortName, mixerlineA.szName,
|
|
|
|
mixerlineA.dwDestination,mixerlineA.dwSource);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" LineID=%08x Channels=%d "
|
|
|
|
"Connections=%d Controls=%d\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
mixerlineA.dwLineID,mixerlineA.cChannels,
|
|
|
|
mixerlineA.cConnections,mixerlineA.cControls);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" State=0x%08x(%s)\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
mixerlineA.fdwLine,line_flags(mixerlineA.fdwLine));
|
|
|
|
trace(" ComponentType=%s\n",
|
|
|
|
component_type(mixerlineA.dwComponentType));
|
|
|
|
trace(" Type=%s\n",
|
|
|
|
target_type(mixerlineA.Target.dwType));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Device=%d (%s) %d.%d (%d:%d)\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
mixerlineA.Target.dwDeviceID,
|
|
|
|
mixerlineA.Target.szPname,
|
|
|
|
mixerlineA.Target.vDriverVersion >> 8,
|
|
|
|
mixerlineA.Target.vDriverVersion & 0xff,
|
|
|
|
mixerlineA.Target.wMid, mixerlineA.Target.wPid);
|
|
|
|
}
|
2004-08-09 20:46:26 +02:00
|
|
|
if (mixerlineA.cControls) {
|
|
|
|
array=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
|
|
|
mixerlineA.cControls*sizeof(MIXERCONTROLA));
|
|
|
|
if (array) {
|
2008-06-21 05:20:42 +02:00
|
|
|
memset(&controls, 0, sizeof(controls));
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineControlsA(mix, 0, MIXER_GETLINECONTROLSF_ALL);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineControlsA(MIXER_GETLINECONTROLSF_ALL): "
|
|
|
|
"MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineControlsA(mix, &controls, -1);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALFLAG||rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineControlsA(-1): "
|
|
|
|
"MMSYSERR_INVALFLAG or MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
controls.cbStruct = sizeof(MIXERLINECONTROLSA);
|
|
|
|
controls.cControls = mixerlineA.cControls;
|
|
|
|
controls.dwLineID = mixerlineA.dwLineID;
|
|
|
|
controls.pamxctrl = array;
|
|
|
|
controls.cbmxctrl = sizeof(MIXERCONTROLA);
|
|
|
|
|
|
|
|
/* FIXME: do MIXER_GETLINECONTROLSF_ONEBYID
|
|
|
|
* and MIXER_GETLINECONTROLSF_ONEBYTYPE
|
|
|
|
*/
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineControlsA(mix, &controls, MIXER_GETLINECONTROLSF_ALL);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetLineControlsA(MIXER_GETLINECONTROLSF_ALL): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
if (rc==MMSYSERR_NOERROR) {
|
|
|
|
for(nc=0;nc<mixerlineA.cControls;nc++) {
|
2004-08-11 20:50:09 +02:00
|
|
|
if (winetest_interactive) {
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" (%s) ControlID=%d\n", nc,
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].szShortName,
|
|
|
|
array[nc].szName, array[nc].dwControlID);
|
|
|
|
trace(" ControlType=%s\n",
|
|
|
|
control_type(array[nc].dwControlType));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Control=0x%08x(%s)\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].fdwControl,
|
|
|
|
control_flags(array[nc].fdwControl));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Items=%d Min=%d Max=%d Step=%d\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].cMultipleItems,
|
2004-08-13 21:49:53 +02:00
|
|
|
S1(array[nc].Bounds).dwMinimum,
|
|
|
|
S1(array[nc].Bounds).dwMaximum,
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].Metrics.cSteps);
|
|
|
|
}
|
2004-08-27 21:39:10 +02:00
|
|
|
|
|
|
|
mixer_test_controlA(mix, &array[nc]);
|
2004-08-09 20:46:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(),0,array);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-10-25 20:46:32 +02:00
|
|
|
}
|
2004-08-09 20:46:26 +02:00
|
|
|
}
|
|
|
|
}
|
2013-11-03 23:34:00 +01:00
|
|
|
test_mixerClose((HMIXER)mix);
|
2004-08-09 20:46:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
static void mixer_test_controlW(HMIXEROBJ mix, MIXERCONTROLW *control)
|
2004-08-27 21:39:10 +02:00
|
|
|
{
|
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsW(mix, &details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2007-12-05 13:47:30 +01:00
|
|
|
if (rc==MMSYSERR_NOERROR && winetest_interactive) {
|
2004-08-27 21:39:10 +02:00
|
|
|
MIXERCONTROLDETAILS new_details;
|
|
|
|
MIXERCONTROLDETAILS_UNSIGNED new_value;
|
|
|
|
|
2007-12-05 13:47:30 +01:00
|
|
|
trace(" Value=%d\n",value.dwValue);
|
2004-08-27 21:39:10 +02:00
|
|
|
|
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &new_details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsW(mix, &ret_details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2020-05-27 23:55:44 +02:00
|
|
|
ok(compare_uint(ret_value.dwValue, new_value.dwValue, 1),
|
2006-11-12 21:06:57 +01:00
|
|
|
"Couldn't change value from %d to %d, returned %d\n",
|
2004-08-27 21:39:10 +02:00
|
|
|
value.dwValue,new_value.dwValue,ret_value.dwValue);
|
|
|
|
|
2020-05-27 23:55:44 +02:00
|
|
|
if (compare_uint(ret_value.dwValue, new_value.dwValue, 1)) {
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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);
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsW(mix, &details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,"mixerGetControlDetails(MIXER_GETCONTROLDETAILSF_VALUE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2007-12-05 13:47:30 +01:00
|
|
|
if (rc==MMSYSERR_NOERROR && winetest_interactive) {
|
2004-08-27 21:39:10 +02:00
|
|
|
MIXERCONTROLDETAILS new_details;
|
|
|
|
MIXERCONTROLDETAILS_BOOLEAN new_value;
|
|
|
|
|
2007-12-05 13:47:30 +01:00
|
|
|
trace(" Value=%d\n",value.fValue);
|
2004-08-27 21:39:10 +02:00
|
|
|
|
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &new_details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetControlDetailsW(mix, &ret_details, MIXER_GETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
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,
|
2006-11-12 21:06:57 +01:00
|
|
|
"Couldn't change value from %d to %d, returned %d\n",
|
2004-08-27 21:39:10 +02:00
|
|
|
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 */
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerSetControlDetails(mix, &details, MIXER_SETCONTROLDETAILSF_VALUE);
|
2004-08-27 21:39:10 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,"mixerSetControlDetails(MIXER_SETCONTROLDETAILSF_VALUE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* FIXME */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-16 12:45:25 +02:00
|
|
|
static void mixer_test_deviceW(int device)
|
2004-08-09 20:46:26 +02:00
|
|
|
{
|
|
|
|
MIXERCAPSW capsW;
|
2013-11-03 23:34:00 +01:00
|
|
|
HMIXEROBJ mix;
|
2004-08-09 20:46:26 +02:00
|
|
|
MMRESULT rc;
|
|
|
|
DWORD d,s,ns,nc;
|
|
|
|
char szShortName[MIXER_SHORT_NAME_CHARS];
|
|
|
|
char szName[MIXER_LONG_NAME_CHARS];
|
|
|
|
char szPname[MAXPNAMELEN];
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsW(device,0,sizeof(capsW));
|
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetDevCapsW: MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsW(device,&capsW,4);
|
2008-10-09 18:14:57 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR ||
|
|
|
|
rc==MMSYSERR_INVALPARAM, /* Vista and W2K8 */
|
|
|
|
"mixerGetDevCapsW: MMSYSERR_NOERROR or MMSYSERR_INVALPARAM expected, got %s\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsW(device,&capsW,sizeof(capsW));
|
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetDevCapsW: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
WideCharToMultiByte(CP_ACP,0,capsW.szPname, MAXPNAMELEN,szPname,
|
|
|
|
MAXPNAMELEN,NULL,NULL);
|
2004-08-11 20:50:09 +02:00
|
|
|
if (winetest_interactive) {
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" %d.%d (%d:%d) destinations=%d\n", device,
|
2004-08-11 20:50:09 +02:00
|
|
|
szPname, capsW.vDriverVersion >> 8,
|
|
|
|
capsW.vDriverVersion & 0xff,capsW.wMid,capsW.wPid,
|
|
|
|
capsW.cDestinations);
|
2004-08-27 21:39:10 +02:00
|
|
|
} else {
|
|
|
|
trace(" %d: \"%s\" %d.%d (%d:%d)\n", device,
|
|
|
|
szPname, capsW.vDriverVersion >> 8,
|
|
|
|
capsW.vDriverVersion & 0xff,capsW.wMid,capsW.wPid);
|
2004-08-11 20:50:09 +02:00
|
|
|
}
|
2007-04-13 18:34:35 +02:00
|
|
|
|
|
|
|
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerOpen((HMIXER*)&mix, device, 0, 0, 0);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
2008-12-21 08:48:27 +01:00
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",mmsys_error(rc));
|
2004-08-09 20:46:26 +02:00
|
|
|
if (rc==MMSYSERR_NOERROR) {
|
2015-01-27 16:02:50 +01:00
|
|
|
MIXERCAPSW capsW2;
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsW((UINT_PTR)mix,&capsW2,sizeof(capsW2));
|
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetDevCapsW: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
ok(!lstrcmpW(capsW2.szPname, capsW.szPname), "Got wrong device caps\n");
|
|
|
|
|
2004-08-09 20:46:26 +02:00
|
|
|
for (d=0;d<capsW.cDestinations;d++) {
|
|
|
|
MIXERLINEW mixerlineW;
|
|
|
|
mixerlineW.cbStruct = 0;
|
|
|
|
mixerlineW.dwDestination=d;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoW(mix, &mixerlineW, MIXER_GETLINEINFOF_DESTINATION);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
|
|
|
|
"MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineW.cbStruct = sizeof(mixerlineW);
|
|
|
|
mixerlineW.dwDestination=capsW.cDestinations;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoW(mix, &mixerlineW, MIXER_GETLINEINFOF_DESTINATION);
|
2004-08-16 23:10:04 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM||rc==MIXERR_INVALLINE,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
|
2004-08-16 23:10:04 +02:00
|
|
|
"MMSYSERR_INVALPARAM or MIXERR_INVALLINE expected, got %s\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineW.cbStruct = sizeof(mixerlineW);
|
|
|
|
mixerlineW.dwDestination=d;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoW(mix, 0, MIXER_GETLINEINFOF_DESTINATION);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
|
|
|
|
"MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineW.cbStruct = sizeof(mixerlineW);
|
|
|
|
mixerlineW.dwDestination=d;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoW(mix, &mixerlineW, -1);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALFLAG,
|
|
|
|
"mixerGetLineInfoW(-1): MMSYSERR_INVALFLAG expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
mixerlineW.cbStruct = sizeof(mixerlineW);
|
|
|
|
mixerlineW.dwDestination=d;
|
2016-02-10 19:33:23 +01:00
|
|
|
mixerlineW.dwUser = (ULONG_PTR)0xdeadbeef;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoW(mix, &mixerlineW, MIXER_GETLINEINFOF_DESTINATION);
|
2004-10-25 23:46:12 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR||rc==MMSYSERR_NODRIVER,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerGetLineInfoW(MIXER_GETLINEINFOF_DESTINATION): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2016-02-10 19:33:23 +01:00
|
|
|
ok(mixerlineW.dwUser == 0, "dwUser was not reset\n");
|
2004-10-25 23:46:12 +02:00
|
|
|
if (rc==MMSYSERR_NODRIVER)
|
|
|
|
trace(" No Driver\n");
|
|
|
|
else if (rc==MMSYSERR_NOERROR && winetest_interactive) {
|
2004-08-09 20:46:26 +02:00
|
|
|
WideCharToMultiByte(CP_ACP,0,mixerlineW.szShortName,
|
|
|
|
MIXER_SHORT_NAME_CHARS,szShortName,
|
|
|
|
MIXER_SHORT_NAME_CHARS,NULL,NULL);
|
|
|
|
WideCharToMultiByte(CP_ACP,0,mixerlineW.szName,
|
|
|
|
MIXER_LONG_NAME_CHARS,szName,
|
|
|
|
MIXER_LONG_NAME_CHARS,NULL,NULL);
|
|
|
|
WideCharToMultiByte(CP_ACP,0,mixerlineW.Target.szPname,
|
|
|
|
MAXPNAMELEN,szPname,
|
|
|
|
MAXPNAMELEN,NULL, NULL);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
d,szShortName,szName,
|
|
|
|
mixerlineW.dwDestination,mixerlineW.dwSource);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" LineID=%08x Channels=%d "
|
|
|
|
"Connections=%d Controls=%d\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineW.dwLineID,mixerlineW.cChannels,
|
|
|
|
mixerlineW.cConnections,mixerlineW.cControls);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" State=0x%08x(%s)\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineW.fdwLine,line_flags(mixerlineW.fdwLine));
|
|
|
|
trace(" ComponentType=%s\n",
|
|
|
|
component_type(mixerlineW.dwComponentType));
|
|
|
|
trace(" Type=%s\n",
|
|
|
|
target_type(mixerlineW.Target.dwType));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Device=%d (%s) %d.%d (%d:%d)\n",
|
2004-08-09 20:46:26 +02:00
|
|
|
mixerlineW.Target.dwDeviceID,szPname,
|
|
|
|
mixerlineW.Target.vDriverVersion >> 8,
|
|
|
|
mixerlineW.Target.vDriverVersion & 0xff,
|
|
|
|
mixerlineW.Target.wMid, mixerlineW.Target.wPid);
|
|
|
|
}
|
|
|
|
ns=mixerlineW.cConnections;
|
|
|
|
for(s=0;s<ns;s++) {
|
|
|
|
mixerlineW.cbStruct = sizeof(mixerlineW);
|
|
|
|
mixerlineW.dwDestination=d;
|
|
|
|
mixerlineW.dwSource=s;
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineInfoW(mix, &mixerlineW, MIXER_GETLINEINFOF_SOURCE);
|
2004-10-25 23:46:12 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR||rc==MMSYSERR_NODRIVER,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerGetLineInfoW(MIXER_GETLINEINFOF_SOURCE): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2004-10-25 23:46:12 +02:00
|
|
|
if (rc==MMSYSERR_NODRIVER)
|
|
|
|
trace(" No Driver\n");
|
|
|
|
else if (rc==MMSYSERR_NOERROR) {
|
2004-08-09 20:46:26 +02:00
|
|
|
LPMIXERCONTROLW array;
|
|
|
|
MIXERLINECONTROLSW controls;
|
2004-08-11 20:50:09 +02:00
|
|
|
if (winetest_interactive) {
|
|
|
|
WideCharToMultiByte(CP_ACP,0,mixerlineW.szShortName,
|
|
|
|
MIXER_SHORT_NAME_CHARS,szShortName,
|
|
|
|
MIXER_SHORT_NAME_CHARS,NULL,NULL);
|
|
|
|
WideCharToMultiByte(CP_ACP,0,mixerlineW.szName,
|
|
|
|
MIXER_LONG_NAME_CHARS,szName,
|
|
|
|
MIXER_LONG_NAME_CHARS,NULL,NULL);
|
|
|
|
WideCharToMultiByte(CP_ACP,0,mixerlineW.Target.szPname,
|
|
|
|
MAXPNAMELEN,szPname,
|
|
|
|
MAXPNAMELEN,NULL, NULL);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" (%s) Destination=%d Source=%d\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
s,szShortName,szName,
|
|
|
|
mixerlineW.dwDestination,mixerlineW.dwSource);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" LineID=%08x Channels=%d "
|
|
|
|
"Connections=%d Controls=%d\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
mixerlineW.dwLineID,mixerlineW.cChannels,
|
|
|
|
mixerlineW.cConnections,mixerlineW.cControls);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" State=0x%08x(%s)\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
mixerlineW.fdwLine,line_flags(mixerlineW.fdwLine));
|
|
|
|
trace(" ComponentType=%s\n",
|
|
|
|
component_type(mixerlineW.dwComponentType));
|
|
|
|
trace(" Type=%s\n",
|
|
|
|
target_type(mixerlineW.Target.dwType));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Device=%d (%s) %d.%d (%d:%d)\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
mixerlineW.Target.dwDeviceID,szPname,
|
|
|
|
mixerlineW.Target.vDriverVersion >> 8,
|
|
|
|
mixerlineW.Target.vDriverVersion & 0xff,
|
|
|
|
mixerlineW.Target.wMid, mixerlineW.Target.wPid);
|
|
|
|
}
|
2004-08-09 20:46:26 +02:00
|
|
|
if (mixerlineW.cControls) {
|
|
|
|
array=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
|
|
|
mixerlineW.cControls*sizeof(MIXERCONTROLW));
|
|
|
|
if (array) {
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineControlsW(mix, 0, MIXER_GETLINECONTROLSF_ALL);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALPARAM,
|
|
|
|
"mixerGetLineControlsW(MIXER_GETLINECONTROLSF_ALL): "
|
|
|
|
"MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineControlsW(mix, &controls, -1);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_INVALFLAG||rc==MMSYSERR_INVALPARAM,
|
2013-11-03 23:34:00 +01:00
|
|
|
"mixerGetLineControlsW(-1): "
|
2004-08-09 20:46:26 +02:00
|
|
|
"MMSYSERR_INVALFLAG or MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
controls.cbStruct = sizeof(MIXERLINECONTROLSW);
|
|
|
|
controls.cControls = mixerlineW.cControls;
|
|
|
|
controls.dwLineID = mixerlineW.dwLineID;
|
|
|
|
controls.pamxctrl = array;
|
|
|
|
controls.cbmxctrl = sizeof(MIXERCONTROLW);
|
|
|
|
|
|
|
|
/* FIXME: do MIXER_GETLINECONTROLSF_ONEBYID
|
|
|
|
* and MIXER_GETLINECONTROLSF_ONEBYTYPE
|
|
|
|
*/
|
2013-11-03 23:34:00 +01:00
|
|
|
rc = mixerGetLineControlsW(mix, &controls, MIXER_GETLINECONTROLSF_ALL);
|
2004-08-09 20:46:26 +02:00
|
|
|
ok(rc==MMSYSERR_NOERROR,
|
|
|
|
"mixerGetLineControlsW(MIXER_GETLINECONTROLSF_ALL): "
|
|
|
|
"MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
if (rc==MMSYSERR_NOERROR) {
|
|
|
|
for(nc=0;nc<mixerlineW.cControls;nc++) {
|
2004-08-11 20:50:09 +02:00
|
|
|
if (winetest_interactive) {
|
|
|
|
WideCharToMultiByte(CP_ACP,0,array[nc].szShortName,
|
|
|
|
MIXER_SHORT_NAME_CHARS,szShortName,
|
|
|
|
MIXER_SHORT_NAME_CHARS,NULL,NULL);
|
|
|
|
WideCharToMultiByte(CP_ACP,0,array[nc].szName,
|
|
|
|
MIXER_LONG_NAME_CHARS,szName,
|
|
|
|
MIXER_LONG_NAME_CHARS,NULL,NULL);
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" %d: \"%s\" (%s) ControlID=%d\n", nc,
|
2004-08-11 20:50:09 +02:00
|
|
|
szShortName, szName, array[nc].dwControlID);
|
|
|
|
trace(" ControlType=%s\n",
|
|
|
|
control_type(array[nc].dwControlType));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Control=0x%08x(%s)\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].fdwControl,
|
|
|
|
control_flags(array[nc].fdwControl));
|
2006-11-12 21:06:57 +01:00
|
|
|
trace(" Items=%d Min=%d Max=%d Step=%d\n",
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].cMultipleItems,
|
2004-08-13 21:49:53 +02:00
|
|
|
S1(array[nc].Bounds).dwMinimum,
|
|
|
|
S1(array[nc].Bounds).dwMaximum,
|
2004-08-11 20:50:09 +02:00
|
|
|
array[nc].Metrics.cSteps);
|
|
|
|
}
|
2004-08-27 21:39:10 +02:00
|
|
|
mixer_test_controlW(mix, &array[nc]);
|
2004-08-09 20:46:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(),0,array);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-11-03 23:34:00 +01:00
|
|
|
test_mixerClose((HMIXER)mix);
|
2004-08-09 20:46:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-16 12:45:25 +02:00
|
|
|
static void mixer_testsA(void)
|
2004-08-09 20:46:26 +02:00
|
|
|
{
|
|
|
|
MIXERCAPSA capsA;
|
|
|
|
MMRESULT rc;
|
|
|
|
UINT ndev, d;
|
|
|
|
|
2021-08-25 15:39:14 +02:00
|
|
|
trace("--- Testing ANSI functions ---\n");
|
2004-08-09 20:46:26 +02:00
|
|
|
|
|
|
|
ndev=mixerGetNumDevs();
|
|
|
|
trace("found %d Mixer devices\n",ndev);
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
|
|
|
|
ok(rc==MMSYSERR_BADDEVICEID,
|
|
|
|
"mixerGetDevCapsA: MMSYSERR_BADDEVICEID expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
for (d=0;d<ndev;d++)
|
|
|
|
mixer_test_deviceA(d);
|
|
|
|
}
|
|
|
|
|
2005-06-16 12:45:25 +02:00
|
|
|
static void mixer_testsW(void)
|
2004-08-09 20:46:26 +02:00
|
|
|
{
|
|
|
|
MIXERCAPSW capsW;
|
|
|
|
MMRESULT rc;
|
|
|
|
UINT ndev, d;
|
|
|
|
|
|
|
|
trace("--- Testing WCHAR functions ---\n");
|
|
|
|
|
|
|
|
ndev=mixerGetNumDevs();
|
|
|
|
trace("found %d Mixer devices\n",ndev);
|
|
|
|
|
|
|
|
rc=mixerGetDevCapsW(ndev+1,&capsW,sizeof(capsW));
|
2004-10-19 01:14:54 +02:00
|
|
|
ok(rc==MMSYSERR_BADDEVICEID||rc==MMSYSERR_NOTSUPPORTED,
|
|
|
|
"mixerGetDevCapsW: MMSYSERR_BADDEVICEID or MMSYSERR_NOTSUPPORTED "
|
|
|
|
"expected, got %s\n", mmsys_error(rc));
|
|
|
|
if (rc==MMSYSERR_NOTSUPPORTED)
|
|
|
|
return;
|
2004-08-09 20:46:26 +02:00
|
|
|
|
2008-12-21 08:48:34 +01:00
|
|
|
for (d=0;d<ndev;d++)
|
|
|
|
mixer_test_deviceW(d);
|
|
|
|
}
|
|
|
|
|
2009-01-28 22:34:59 +01:00
|
|
|
static void test_mixerOpen(void)
|
2008-12-21 08:48:34 +01:00
|
|
|
{
|
|
|
|
HMIXER mix;
|
2011-03-15 23:00:04 +01:00
|
|
|
HANDLE event;
|
2008-12-21 08:48:34 +01:00
|
|
|
MMRESULT rc;
|
|
|
|
UINT ndev, d;
|
|
|
|
|
|
|
|
ndev = mixerGetNumDevs();
|
|
|
|
|
|
|
|
/* Test mixerOpen with invalid device ID values. */
|
|
|
|
rc = mixerOpen(&mix, ndev + 1, 0, 0, 0);
|
|
|
|
ok(rc == MMSYSERR_BADDEVICEID,
|
2004-08-09 20:46:26 +02:00
|
|
|
"mixerOpen: MMSYSERR_BADDEVICEID expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
2008-12-21 08:48:34 +01:00
|
|
|
rc = mixerOpen(&mix, -1, 0, 0, 0);
|
2008-12-22 19:42:46 +01:00
|
|
|
ok(rc == MMSYSERR_BADDEVICEID ||
|
|
|
|
rc == MMSYSERR_INVALHANDLE, /* NT4/W2K */
|
|
|
|
"mixerOpen: MMSYSERR_BADDEVICEID or MMSYSERR_INVALHANDLE expected, got %s\n",
|
2008-12-21 08:48:34 +01:00
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
for (d = 0; d < ndev; d++) {
|
|
|
|
/* Test mixerOpen with valid device ID values and invalid parameters. */
|
|
|
|
rc = mixerOpen(&mix, d, 0, 0, CALLBACK_FUNCTION);
|
|
|
|
ok(rc == MMSYSERR_INVALFLAG
|
|
|
|
|| rc == MMSYSERR_NOTSUPPORTED, /* 98/ME */
|
|
|
|
"mixerOpen: MMSYSERR_INVALFLAG expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
rc = mixerOpen(&mix, d, 0xdeadbeef, 0, CALLBACK_WINDOW);
|
2009-04-08 22:15:17 +02:00
|
|
|
ok(rc == MMSYSERR_INVALPARAM ||
|
2011-03-15 23:00:04 +01:00
|
|
|
broken(rc == MMSYSERR_NOERROR /* 98 */),
|
2008-12-21 08:48:34 +01:00
|
|
|
"mixerOpen: MMSYSERR_INVALPARAM expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2009-04-08 22:15:17 +02:00
|
|
|
if (rc == MMSYSERR_NOERROR)
|
|
|
|
test_mixerClose(mix);
|
2008-12-21 08:48:34 +01:00
|
|
|
|
|
|
|
/* Test mixerOpen with a NULL dwCallback and CALLBACK_WINDOW flag. */
|
|
|
|
rc = mixerOpen(&mix, d, 0, 0, CALLBACK_WINDOW);
|
|
|
|
ok(rc == MMSYSERR_NOERROR,
|
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2011-03-15 23:00:04 +01:00
|
|
|
if (rc == MMSYSERR_NOERROR)
|
|
|
|
test_mixerClose(mix);
|
|
|
|
|
|
|
|
rc = mixerOpen(&mix, d, 0, 0, CALLBACK_THREAD);
|
|
|
|
ok(rc == MMSYSERR_NOERROR /* since w2k */ ||
|
|
|
|
rc == MMSYSERR_NOTSUPPORTED, /* 98 */
|
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
if (rc == MMSYSERR_NOERROR)
|
|
|
|
test_mixerClose(mix);
|
|
|
|
|
|
|
|
rc = mixerOpen(&mix, d, 0, 0, CALLBACK_EVENT);
|
|
|
|
ok(rc == MMSYSERR_NOERROR /* since w2k */ ||
|
|
|
|
rc == MMSYSERR_NOTSUPPORTED, /* 98 */
|
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
if (rc == MMSYSERR_NOERROR)
|
|
|
|
test_mixerClose(mix);
|
2008-12-21 08:48:34 +01:00
|
|
|
|
2013-11-03 23:30:00 +01:00
|
|
|
event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
2011-03-15 23:00:04 +01:00
|
|
|
|
|
|
|
/* NOTSUPPORTED is not broken, but it enables the todo_wine marker. */
|
|
|
|
rc = mixerOpen(&mix, d, (DWORD_PTR)event, 0, CALLBACK_EVENT);
|
|
|
|
todo_wine
|
|
|
|
ok(rc == MMSYSERR_NOERROR /* since w2k */ ||
|
|
|
|
broken(rc == MMSYSERR_NOTSUPPORTED), /* 98 */
|
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
2008-12-21 08:48:34 +01:00
|
|
|
if (rc == MMSYSERR_NOERROR)
|
|
|
|
test_mixerClose(mix);
|
|
|
|
|
|
|
|
/* Test mixerOpen with normal parameters. */
|
|
|
|
rc = mixerOpen(&mix, d, 0, 0, 0);
|
|
|
|
ok(rc == MMSYSERR_NOERROR,
|
|
|
|
"mixerOpen: MMSYSERR_NOERROR expected, got %s\n",
|
|
|
|
mmsys_error(rc));
|
|
|
|
|
|
|
|
if (rc == MMSYSERR_NOERROR)
|
|
|
|
test_mixerClose(mix);
|
2011-03-15 23:00:04 +01:00
|
|
|
|
|
|
|
rc = WaitForSingleObject(event, 0);
|
|
|
|
ok(rc == WAIT_TIMEOUT, "WaitEvent %d\n", rc);
|
|
|
|
CloseHandle(event);
|
2008-12-21 08:48:34 +01:00
|
|
|
}
|
2004-08-09 20:46:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(mixer)
|
|
|
|
{
|
2008-12-21 08:48:34 +01:00
|
|
|
test_mixerOpen();
|
2004-08-09 20:46:26 +02:00
|
|
|
mixer_testsA();
|
|
|
|
mixer_testsW();
|
|
|
|
}
|