#pragma warning disable IDE1006 // Naming Styles namespace Vanara.PInvoke; /// Items from the WinMm.dll public static partial class WinMm { /// public const MIXERCONTROL_CT MIXERCONTROL_CT_CLASS_MASK = (MIXERCONTROL_CT)0xF0000000; /// public const MIXERCONTROL_CT MIXERCONTROL_CT_SUBCLASS_MASK = (MIXERCONTROL_CT)0x0F000000; /// public const MIXERCONTROL_CT MIXERCONTROL_CT_UNITS_MASK = (MIXERCONTROL_CT)0x00FF0000; private const int MIXER_LONG_NAME_CHARS = 64; private const int MIXER_SHORT_NAME_CHARS = 16; private const int MIXERLINE_COMPONENTTYPE_DST_FIRST = 0x00000000; private const int MIXERLINE_COMPONENTTYPE_SRC_FIRST = 0x00001000; /// Flags for retrieving control details. [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetControlDetails")] [Flags] public enum MIXER_OBJECTF : uint { /// /// Current values for a control are retrieved. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more /// details structures appropriate for the control class. /// MIXER_GETCONTROLDETAILSF_VALUE = 0x00000000, /// /// The paDetails member of the MIXERCONTROLDETAILS structure points to one or more MIXERCONTROLDETAILS_LISTTEXT structures to /// receive text labels for multiple-item controls. An application must get all list text items for a multiple-item control at /// once. This flag cannot be used with MIXERCONTROL_CONTROLTYPE_CUSTOM controls. /// MIXER_GETCONTROLDETAILSF_LISTTEXT = 0x00000001, /// MIXER_OBJECTF_HANDLE = 0x80000000, /// /// The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices /// returned by the mixerGetNumDevs function. This flag is optional. /// MIXER_OBJECTF_MIXER = 0x00000000, /// The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. MIXER_OBJECTF_HMIXER = MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIXER, /// /// The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// MIXER_OBJECTF_WAVEOUT = 0x10000000, /// The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. MIXER_OBJECTF_HWAVEOUT = MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_WAVEOUT, /// /// The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// MIXER_OBJECTF_WAVEIN = 0x20000000, /// The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. MIXER_OBJECTF_HWAVEIN = MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_WAVEIN, /// /// The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less /// than the number of devices returned by the midiOutGetNumDevs function. /// MIXER_OBJECTF_MIDIOUT = 0x30000000, /// /// The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// MIXER_OBJECTF_HMIDIOUT = MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIDIOUT, /// /// The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than /// the number of devices returned by the midiInGetNumDevs function. /// MIXER_OBJECTF_MIDIIN = 0x40000000, /// /// The hmxobj parameter is the handle of a MIDI (Musical Instrument Digital Interface) input device. This handle must have been /// returned by the midiInOpen function. /// MIXER_OBJECTF_HMIDIIN = MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIDIIN, /// /// The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned /// by the auxGetNumDevs function. /// MIXER_OBJECTF_AUX = 0x50000000, } /// Status and support flags for the audio line control. [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROL")] [Flags] public enum MIXERCONTROL_CONTROLF : uint { /// /// The control acts on all channels of a multichannel line in a uniform fashion. For example, a control that mutes both /// channels of a stereo line would set this flag. Most MIXERCONTROL_CONTROLTYPE_MUX and MIXERCONTROL_CONTROLTYPE_MIXER controls /// also specify the MIXERCONTROL_CONTROLF_UNIFORM flag. /// MIXERCONTROL_CONTROLF_UNIFORM = 0x00000001, /// /// The control has two or more settings per channel. An equalizer, for example, requires this flag because each frequency band /// can be set to a different value. An equalizer that affects both channels of a stereo line in a uniform fashion will also /// specify the MIXERCONTROL_CONTROLF_UNIFORM flag. /// MIXERCONTROL_CONTROLF_MULTIPLE = 0x00000002, /// /// The control is disabled, perhaps due to other settings for the mixer hardware, and cannot be used. An application can read /// current settings from a disabled control, but it cannot apply settings. /// MIXERCONTROL_CONTROLF_DISABLED = 0x80000000, } /// /// Class of the control for which the identifier is specified in dwControlID. An application must use this information to /// display the appropriate control for input from the user. An application can also display tailored graphics based on the control /// class or search for a particular control class on a specific line. If an application does not know about a control class, this /// control must be ignored. /// [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROL")] [Flags] public enum MIXERCONTROL_CT : uint { /// MIXERCONTROL_CT_CLASS_CUSTOM = 0x00000000, /// MIXERCONTROL_CT_CLASS_METER = 0x10000000, /// MIXERCONTROL_CT_CLASS_SWITCH = 0x20000000, /// MIXERCONTROL_CT_CLASS_NUMBER = 0x30000000, /// MIXERCONTROL_CT_CLASS_SLIDER = 0x40000000, /// MIXERCONTROL_CT_CLASS_FADER = 0x50000000, /// MIXERCONTROL_CT_CLASS_TIME = 0x60000000, /// MIXERCONTROL_CT_CLASS_LIST = 0x70000000, /// MIXERCONTROL_CT_SC_SWITCH_BOOLEAN = 0x00000000, /// MIXERCONTROL_CT_SC_SWITCH_BUTTON = 0x01000000, /// MIXERCONTROL_CT_SC_METER_POLLED = 0x00000000, /// MIXERCONTROL_CT_SC_TIME_MICROSECS = 0x00000000, /// MIXERCONTROL_CT_SC_TIME_MILLISECS = 0x01000000, /// MIXERCONTROL_CT_SC_LIST_SINGLE = 0x00000000, /// MIXERCONTROL_CT_SC_LIST_MULTIPLE = 0x01000000, /// MIXERCONTROL_CT_UNITS_CUSTOM = 0x00000000, /// MIXERCONTROL_CT_UNITS_BOOLEAN = 0x00010000, /// MIXERCONTROL_CT_UNITS_SIGNED = 0x00020000, /// MIXERCONTROL_CT_UNITS_UNSIGNED = 0x00030000, /// in 10ths MIXERCONTROL_CT_UNITS_DECIBELS = 0x00040000, /// in 10ths MIXERCONTROL_CT_UNITS_PERCENT = 0x00050000, /// MIXERCONTROL_CONTROLTYPE_CUSTOM = MIXERCONTROL_CT_CLASS_CUSTOM | MIXERCONTROL_CT_UNITS_CUSTOM, /// MIXERCONTROL_CONTROLTYPE_BOOLEANMETER = MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_BOOLEAN, /// MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_SIGNED, /// MIXERCONTROL_CONTROLTYPE_PEAKMETER = MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1, /// MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = MIXERCONTROL_CT_CLASS_METER | MIXERCONTROL_CT_SC_METER_POLLED | MIXERCONTROL_CT_UNITS_UNSIGNED, /// MIXERCONTROL_CONTROLTYPE_BOOLEAN = MIXERCONTROL_CT_CLASS_SWITCH | MIXERCONTROL_CT_SC_SWITCH_BOOLEAN | MIXERCONTROL_CT_UNITS_BOOLEAN, /// MIXERCONTROL_CONTROLTYPE_ONOFF = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 1, /// MIXERCONTROL_CONTROLTYPE_MUTE = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 2, /// MIXERCONTROL_CONTROLTYPE_MONO = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 3, /// MIXERCONTROL_CONTROLTYPE_LOUDNESS = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 4, /// MIXERCONTROL_CONTROLTYPE_STEREOENH = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 5, /// MIXERCONTROL_CONTROLTYPE_BASS_BOOST = MIXERCONTROL_CONTROLTYPE_BOOLEAN + 0x00002277, /// MIXERCONTROL_CONTROLTYPE_BUTTON = MIXERCONTROL_CT_CLASS_SWITCH | MIXERCONTROL_CT_SC_SWITCH_BUTTON | MIXERCONTROL_CT_UNITS_BOOLEAN, /// MIXERCONTROL_CONTROLTYPE_DECIBELS = MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_DECIBELS, /// MIXERCONTROL_CONTROLTYPE_SIGNED = MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_SIGNED, /// MIXERCONTROL_CONTROLTYPE_UNSIGNED = MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_UNSIGNED, /// MIXERCONTROL_CONTROLTYPE_PERCENT = MIXERCONTROL_CT_CLASS_NUMBER | MIXERCONTROL_CT_UNITS_PERCENT, /// MIXERCONTROL_CONTROLTYPE_SLIDER = MIXERCONTROL_CT_CLASS_SLIDER | MIXERCONTROL_CT_UNITS_SIGNED, /// MIXERCONTROL_CONTROLTYPE_PAN = MIXERCONTROL_CONTROLTYPE_SLIDER + 1, /// MIXERCONTROL_CONTROLTYPE_QSOUNDPAN = MIXERCONTROL_CONTROLTYPE_SLIDER + 2, /// MIXERCONTROL_CONTROLTYPE_FADER = MIXERCONTROL_CT_CLASS_FADER | MIXERCONTROL_CT_UNITS_UNSIGNED, /// MIXERCONTROL_CONTROLTYPE_VOLUME = MIXERCONTROL_CONTROLTYPE_FADER + 1, /// MIXERCONTROL_CONTROLTYPE_BASS = MIXERCONTROL_CONTROLTYPE_FADER + 2, /// MIXERCONTROL_CONTROLTYPE_TREBLE = MIXERCONTROL_CONTROLTYPE_FADER + 3, /// MIXERCONTROL_CONTROLTYPE_EQUALIZER = MIXERCONTROL_CONTROLTYPE_FADER + 4, /// MIXERCONTROL_CONTROLTYPE_SINGLESELECT = MIXERCONTROL_CT_CLASS_LIST | MIXERCONTROL_CT_SC_LIST_SINGLE | MIXERCONTROL_CT_UNITS_BOOLEAN, /// MIXERCONTROL_CONTROLTYPE_MUX = MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1, /// MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = MIXERCONTROL_CT_CLASS_LIST | MIXERCONTROL_CT_SC_LIST_MULTIPLE | MIXERCONTROL_CT_UNITS_BOOLEAN, /// MIXERCONTROL_CONTROLTYPE_MIXER = MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1, /// MIXERCONTROL_CONTROLTYPE_MICROTIME = MIXERCONTROL_CT_CLASS_TIME | MIXERCONTROL_CT_SC_TIME_MICROSECS | MIXERCONTROL_CT_UNITS_UNSIGNED, /// MIXERCONTROL_CONTROLTYPE_MILLITIME = MIXERCONTROL_CT_CLASS_TIME | MIXERCONTROL_CT_SC_TIME_MILLISECS | MIXERCONTROL_CT_UNITS_UNSIGNED, } /// /// Component type for this audio line. An application can use this information to display tailored graphics or to search for a /// particular component. /// [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERLINE")] public enum MIXERLINE_COMPONENTTYPE { /// /// Audio line is a destination that cannot be defined by one of the standard component types. A mixer device is required to use /// this component type for line component types that have not been defined by Microsoft Corporation. /// MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = MIXERLINE_COMPONENTTYPE_DST_FIRST + 0, /// Audio line is a digital destination (for example, digital input to a DAT or CD audio device). MIXERLINE_COMPONENTTYPE_DST_DIGITAL = MIXERLINE_COMPONENTTYPE_DST_FIRST + 1, /// /// Audio line is a line level destination (for example, line level input from a CD audio device) that will be the final /// recording source for the analog-to-digital converter (ADC). Because most audio cards for personal computers provide some /// sort of gain for the recording audio source line, the mixer device will use the MIXERLINE_COMPONENTTYPE_DST_WAVEIN type. /// MIXERLINE_COMPONENTTYPE_DST_LINE = MIXERLINE_COMPONENTTYPE_DST_FIRST + 2, /// Audio line is a destination used for a monitor. MIXERLINE_COMPONENTTYPE_DST_MONITOR = MIXERLINE_COMPONENTTYPE_DST_FIRST + 3, /// /// Audio line is an adjustable (gain and/or attenuation) destination intended to drive speakers. This is the typical component /// type for the audio output of audio cards for personal computers. /// MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = MIXERLINE_COMPONENTTYPE_DST_FIRST + 4, /// /// Audio line is an adjustable (gain and/or attenuation) destination intended to drive headphones. Most audio cards use the /// same audio destination line for speakers and headphones, in which case the mixer device simply uses the /// MIXERLINE_COMPONENTTYPE_DST_SPEAKERS type. /// MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = MIXERLINE_COMPONENTTYPE_DST_FIRST + 5, /// Audio line is a destination that will be routed to a telephone line. MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = MIXERLINE_COMPONENTTYPE_DST_FIRST + 6, /// /// Audio line is a destination that will be the final recording source for the waveform-audio input (ADC). This line typically /// provides some sort of gain or attenuation. This is the typical component type for the recording line of most audio cards for /// personal computers. /// MIXERLINE_COMPONENTTYPE_DST_WAVEIN = MIXERLINE_COMPONENTTYPE_DST_FIRST + 7, /// /// Audio line is a destination that will be the final recording source for voice input. This component type is exactly like /// MIXERLINE_COMPONENTTYPE_DST_WAVEIN but is intended specifically for settings used during voice recording/recognition. /// Support for this line is optional for a mixer device. Many mixer devices provide only MIXERLINE_COMPONENTTYPE_DST_WAVEIN. /// MIXERLINE_COMPONENTTYPE_DST_VOICEIN = MIXERLINE_COMPONENTTYPE_DST_FIRST + 8, /// /// Audio line is a source that cannot be defined by one of the standard component types. A mixer device is required to use this /// component type for line component types that have not been defined by Microsoft Corporation. /// MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0, /// Audio line is a digital source (for example, digital output from a DAT or audio CD). MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1, /// /// Audio line is a line-level source (for example, line-level input from an external stereo) that can be used as an optional /// recording source. Because most audio cards for personal computers provide some sort of gain for the recording source line, /// the mixer device will use the MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY type. /// MIXERLINE_COMPONENTTYPE_SRC_LINE = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2, /// /// Audio line is a microphone recording source. Most audio cards for personal computers provide at least two types of recording /// sources: an auxiliary audio line and microphone input. A microphone audio line typically provides some sort of gain. Audio /// cards that use a single input for use with a microphone or auxiliary audio line should use the /// MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE component type. /// MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3, /// /// Audio line is a source originating from the output of an internal synthesizer. Most audio cards for personal computers /// provide some sort of MIDI synthesizer. /// MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4, /// /// Audio line is a source originating from the output of an internal audio CD. This component type is provided for audio cards /// that provide an audio source line intended to be connected to an audio CD (or CD-ROM playing an audio CD). /// MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5, /// Audio line is a source originating from an incoming telephone line. MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6, /// /// Audio line is a source originating from personal computer speaker. Several audio cards for personal computers provide the /// ability to mix what would typically be played on the internal speaker with the output of an audio card. Some audio cards /// support the ability to use this output as a recording source. /// MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7, /// /// Audio line is a source originating from the waveform-audio output digital-to-analog converter (DAC). Most audio cards for /// personal computers provide this component type as a source to the MIXERLINE_COMPONENTTYPE_DST_SPEAKERS destination. Some /// cards also allow this source to be routed to the MIXERLINE_COMPONENTTYPE_DST_WAVEIN destination. /// MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8, /// /// Audio line is a source originating from the auxiliary audio line. This line type is intended as a source with gain or /// attenuation that can be routed to the MIXERLINE_COMPONENTTYPE_DST_SPEAKERS destination and/or recorded from the /// MIXERLINE_COMPONENTTYPE_DST_WAVEIN destination. /// MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9, /// Audio line is an analog source (for example, analog output from a video-cassette tape). MIXERLINE_COMPONENTTYPE_SRC_ANALOG = MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10, } /// Status and support flags for the audio line. [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERLINE")] [Flags] public enum MIXERLINE_LINEF : uint { /// Audio line is active. An active line indicates that a signal is probably passing through the line. MIXERLINE_LINEF_ACTIVE = 0x00000001, /// /// Audio line is disconnected. A disconnected line's associated controls can still be modified, but the changes have no effect /// until the line is connected. /// MIXERLINE_LINEF_DISCONNECTED = 0x00008000, /// /// Audio line is an audio source line associated with a single audio destination line. If this flag is not set, this line is an /// audio destination line associated with zero or more audio source lines. /// MIXERLINE_LINEF_SOURCE = 0x80000000, } /// The mixerClose function closes the specified mixer device. /// /// Handle to the mixer device. This handle must have been returned successfully by the mixerOpen function. If mixerClose is /// successful, hmx is no longer valid. /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MMSYSERR_INVALHANDLE /// Specified device handle is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixerclose MMRESULT mixerClose( HMIXER hmx ); [DllImport(Lib_Winmm, SetLastError = false, ExactSpelling = true)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerClose")] public static extern MMRESULT mixerClose(HMIXER hmx); /// The mixerGetControlDetails function retrieves details about a single control associated with an audio line. /// Handle to the mixer device object being queried. /// Pointer to a MIXERCONTROLDETAILS structure, which is filled with state information about the control. /// /// Flags for retrieving control details. The following values are defined. /// /// /// Value /// Meaning /// /// /// MIXER_GETCONTROLDETAILSF_LISTTEXT /// /// The paDetails member of the MIXERCONTROLDETAILS structure points to one or more MIXERCONTROLDETAILS_LISTTEXT structures to /// receive text labels for multiple-item controls. An application must get all list text items for a multiple-item control at once. /// This flag cannot be used with MIXERCONTROL_CONTROLTYPE_CUSTOM controls. /// /// /// /// MIXER_GETCONTROLDETAILSF_VALUE /// /// Current values for a control are retrieved. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more /// details structures appropriate for the control class. /// /// /// /// MIXER_OBJECTF_AUX /// /// The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by /// the auxGetNumDevs function. /// /// /// /// MIXER_OBJECTF_HMIDIIN /// /// The hmxobj parameter is the handle of a MIDI (Musical Instrument Digital Interface) input device. This handle must have been /// returned by the midiInOpen function. /// /// /// /// MIXER_OBJECTF_HMIDIOUT /// The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// /// /// MIXER_OBJECTF_HMIXER /// The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. /// /// /// MIXER_OBJECTF_HWAVEIN /// The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. /// /// /// MIXER_OBJECTF_HWAVEOUT /// The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. /// /// /// MIXER_OBJECTF_MIDIIN /// /// The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIDIOUT /// /// The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than /// the number of devices returned by the midiOutGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIXER /// /// The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by /// the mixerGetNumDevs function. This flag is optional. /// /// /// /// MIXER_OBJECTF_WAVEIN /// /// The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_WAVEOUT /// /// The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// /// /// /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MIXERR_INVALCONTROL /// The control reference is invalid. /// /// /// MMSYSERR_BADDEVICEID /// The hmxobj parameter specifies an invalid device identifier. /// /// /// MMSYSERR_INVALFLAG /// One or more flags are invalid. /// /// /// MMSYSERR_INVALHANDLE /// The hmxobj parameter specifies an invalid handle. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// MMSYSERR_NODRIVER /// No mixer device is available for the object specified by hmxobj. /// /// /// /// All members of the MIXERCONTROLDETAILS structure must be initialized before calling this function. // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixergetcontroldetails MMRESULT mixerGetControlDetails( // HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails ); [DllImport(Lib_Winmm, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetControlDetails")] public static extern MMRESULT mixerGetControlDetails([In, Optional] HMIXEROBJ hmxobj, ref MIXERCONTROLDETAILS pmxcd, MIXER_OBJECTF fdwDetails); /// The mixerGetDevCaps function queries a specified mixer device to determine its capabilities. /// Identifier or handle of an open mixer device. /// Pointer to a MIXERCAPS structure that receives information about the capabilities of the device. /// Size, in bytes, of the MIXERCAPS structure. /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MMSYSERR_BADDEVICEID /// The specified device identifier is out of range. /// /// /// MMSYSERR_INVALHANDLE /// The mixer device handle is invalid. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// /// /// /// Use the mixerGetNumDevs function to determine the number of mixer devices present in the system. The device identifier specified /// by uMxId varies from zero to one less than the number of mixer devices present. /// /// /// Only the number of bytes (or less) of information specified in cbmxcaps is copied to the location pointed to by pmxcaps. If /// cbmxcaps is zero, nothing is copied, and the function returns successfully. /// /// /// This function also accepts a mixer device handle returned by the mixerOpen function as the uMxId parameter. The application /// should cast the HMIXER handle to a UINT. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixergetdevcaps MMRESULT mixerGetDevCaps( UINT uMxId, // LPMIXERCAPS pmxcaps, UINT cbmxcaps ); [DllImport(Lib_Winmm, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetDevCaps")] public static extern MMRESULT mixerGetDevCaps(uint uMxId, out MIXERCAPS pmxcaps, uint cbmxcaps); /// /// The mixerGetID function retrieves the device identifier for a mixer device associated with a specified device handle. /// /// Handle to the audio mixer object to map to a mixer device identifier. /// /// Pointer to a variable that receives the mixer device identifier. If no mixer device is available for the hmxobj object, the /// value -1 is placed in this location and the MMSYSERR_NODRIVER error value is returned. /// /// /// Flags for mapping the mixer object hmxobj. The following values are defined. /// /// /// Value /// Meaning /// /// /// MIXER_OBJECTF_AUX /// /// The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by /// the auxGetNumDevs function. /// /// /// /// MIXER_OBJECTF_HMIDIIN /// The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function. /// /// /// MIXER_OBJECTF_HMIDIOUT /// The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// /// /// MIXER_OBJECTF_HMIXER /// The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. /// /// /// MIXER_OBJECTF_HWAVEIN /// The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. /// /// /// MIXER_OBJECTF_HWAVEOUT /// The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. /// /// /// MIXER_OBJECTF_MIDIIN /// /// The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIDIOUT /// /// The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than /// the number of devices returned by the midiOutGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIXER /// /// The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by /// the mixerGetNumDevs function. This flag is optional. /// /// /// /// MIXER_OBJECTF_WAVEIN /// /// The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_WAVEOUT /// /// The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// /// /// /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MMSYSERR_BADDEVICEID /// The hmxobj parameter specifies an invalid device identifier. /// /// /// MMSYSERR_INVALFLAG /// One or more flags are invalid. /// /// /// MMSYSERR_INVALHANDLE /// The hmxobj parameter specifies an invalid handle. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// MMSYSERR_NODRIVER /// /// No audio mixer device is available for the object specified by hmxobj. The location referenced by puMxId also contains the value -1. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixergetid MMRESULT mixerGetID( HMIXEROBJ hmxobj, UINT // *puMxId, DWORD fdwId ); [DllImport(Lib_Winmm, SetLastError = false, ExactSpelling = true)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetID")] public static extern MMRESULT mixerGetID([In, Optional] HMIXEROBJ hmxobj, out uint puMxId, MIXER_OBJECTF fdwId); /// The mixerGetLineControls function retrieves one or more controls associated with an audio line. /// Handle to the mixer device object that is being queried. /// /// Pointer to a MIXERLINECONTROLS structure. This structure is used to reference one or more MIXERCONTROL structures to be filled /// with information about the controls associated with an audio line. The cbStruct member of the MIXERLINECONTROLS /// structure must always be initialized to be the size, in bytes, of the MIXERLINECONTROLS structure. /// /// /// Flags for retrieving information about one or more controls associated with an audio line. The following values are defined. /// /// /// Value /// Meaning /// /// /// MIXER_GETLINECONTROLSF_ALL /// /// The pmxlc parameter references a list of MIXERCONTROL structures that will receive information on all controls associated with /// the audio line identified by the dwLineID member of the MIXERLINECONTROLS structure. The cControls member must be initialized to /// the number of controls associated with the line. This number is retrieved from the cControls member of the MIXERLINE structure /// returned by the mixerGetLineInfo function. The cbmxctrl member must be initialized to the size, in bytes, of a single /// MIXERCONTROL structure. The pamxctrl member must point to the first MIXERCONTROL structure to be filled. The dwControlID and /// dwControlType members are ignored for this query. /// /// /// /// MIXER_GETLINECONTROLSF_ONEBYID /// /// The pmxlc parameter references a single MIXERCONTROL structure that will receive information on the control identified by the /// dwControlID member of the MIXERLINECONTROLS structure. The cControls member must be initialized to 1. The cbmxctrl member must /// be initialized to the size, in bytes, of a single MIXERCONTROL structure. The pamxctrl member must point to a MIXERCONTROL /// structure to be filled. The dwLineID and dwControlType members are ignored for this query. This query is usually used to refresh /// a control after receiving a MM_MIXM_CONTROL_CHANGE control change notification message by the user-defined callback (see mixerOpen). /// /// /// /// MIXER_GETLINECONTROLSF_ONEBYTYPE /// /// The mixerGetLineControls function retrieves information about the first control of a specific class for the audio line that is /// being queried. The pmxlc parameter references a single MIXERCONTROL structure that will receive information about the specific /// control. The audio line is identified by the dwLineID member. The control class is specified in the dwControlType member of the /// MIXERLINECONTROLS structure.The dwControlID member is ignored for this query. This query can be used by an application to get /// information on a single control associated with a line. For example, you might want your application to use a peak meter only /// from a waveform-audio output line. /// /// /// /// MIXER_OBJECTF_AUX /// /// The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by /// the auxGetNumDevs function. /// /// /// /// MIXER_OBJECTF_HMIDIIN /// The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function. /// /// /// MIXER_OBJECTF_HMIDIOUT /// The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// /// /// MIXER_OBJECTF_HMIXER /// The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. /// /// /// MIXER_OBJECTF_HWAVEIN /// The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. /// /// /// MIXER_OBJECTF_HWAVEOUT /// The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. /// /// /// MIXER_OBJECTF_MIDIIN /// /// The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIDIOUT /// /// The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than /// the number of devices returned by the midiOutGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIXER /// /// The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by /// the mixerGetNumDevs function. This flag is optional. /// /// /// /// MIXER_OBJECTF_WAVEIN /// /// The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_WAVEOUT /// /// The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// /// /// /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MIXERR_INVALCONTROL /// The control reference is invalid. /// /// /// MIXERR_INVALLINE /// The audio line reference is invalid. /// /// /// MMSYSERR_BADDEVICEID /// The hmxobj parameter specifies an invalid device identifier. /// /// /// MMSYSERR_INVALFLAG /// One or more flags are invalid. /// /// /// MMSYSERR_INVALHANDLE /// The hmxobj parameter specifies an invalid handle. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// MMSYSERR_NODRIVER /// No mixer device is available for the object specified by hmxobj. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixergetlinecontrols MMRESULT mixerGetLineControls( HMIXEROBJ // hmxobj, LPMIXERLINECONTROLS pmxlc, DWORD fdwControls ); [DllImport(Lib_Winmm, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetLineControls")] public static extern MMRESULT mixerGetLineControls([In, Optional] HMIXEROBJ hmxobj, ref MIXERLINECONTROLS pmxlc, MIXER_OBJECTF fdwControls); /// The mixerGetLineInfo function retrieves information about a specific line of a mixer device. /// Handle to the mixer device object that controls the specific audio line. /// /// Pointer to a MIXERLINE structure. This structure is filled with information about the audio line for the mixer device. The /// cbStruct member must always be initialized to be the size, in bytes, of the MIXERLINE structure. /// /// /// Flags for retrieving information about an audio line. The following values are defined. /// /// /// Value /// Meaning /// /// /// MIXER_GETLINEINFOF_COMPONENTTYPE /// /// The pmxl parameter will receive information about the first audio line of the type specified in the dwComponentType member of /// the MIXERLINE structure. This flag is used to retrieve information about an audio line of a specific component type. Remaining /// structure members except cbStruct require no further initialization. /// /// /// /// MIXER_GETLINEINFOF_DESTINATION /// /// The pmxl parameter will receive information about the destination audio line specified by the dwDestination member of the /// MIXERLINE structure. This index ranges from zero to one less than the value in the cDestinations member of the MIXERCAPS /// structure. All remaining structure members except cbStruct require no further initialization. /// /// /// /// MIXER_GETLINEINFOF_LINEID /// /// The pmxl parameter will receive information about the audio line specified by the dwLineID member of the MIXERLINE structure. /// This is usually used to retrieve updated information about the state of an audio line. All remaining structure members except /// cbStruct require no further initialization. /// /// /// /// MIXER_GETLINEINFOF_SOURCE /// /// The pmxl parameter will receive information about the source audio line specified by the dwDestination and dwSource members of /// the MIXERLINE structure. The index specified by dwDestination ranges from zero to one less than the value in the cDestinations /// member of the MIXERCAPS structure. The index specified by dwSource ranges from zero to one less than the value in the /// cConnections member of the MIXERLINE structure returned for the audio line stored in the dwDestination member. All remaining /// structure members except cbStruct require no further initialization. /// /// /// /// MIXER_GETLINEINFOF_TARGETTYPE /// /// The pmxl parameter will receive information about the audio line that is for the dwType member of the Target structure, which is /// a member of the MIXERLINE structure. This flag is used to retrieve information about an audio line that handles the target type /// (for example, MIXERLINE_TARGETTYPE_WAVEOUT). The application must initialize the dwType, wMid, wPid, vDriverVersion and szPname /// members of the MIXERLINE structure before calling mixerGetLineInfo. All of these values can be retrieved from the device /// capabilities structures for all media devices. Remaining structure members except cbStruct require no further initialization. /// /// /// /// MIXER_OBJECTF_AUX /// /// The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by /// the auxGetNumDevs function. /// /// /// /// MIXER_OBJECTF_HMIDIIN /// The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function. /// /// /// MIXER_OBJECTF_HMIDIOUT /// The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// /// /// MIXER_OBJECTF_HMIXER /// The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. /// /// /// MIXER_OBJECTF_HWAVEIN /// The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. /// /// /// MIXER_OBJECTF_HWAVEOUT /// The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. /// /// /// MIXER_OBJECTF_MIDIIN /// /// The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIDIOUT /// /// The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than /// the number of devices returned by the midiOutGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIXER /// /// The hmxobj parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the /// mixerGetNumDevs function. This flag is optional. /// /// /// /// MIXER_OBJECTF_WAVEIN /// /// The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_WAVEOUT /// /// The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// /// /// /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MIXERR_INVALLINE /// The audio line reference is invalid. /// /// /// MMSYSERR_BADDEVICEID /// The hmxobj parameter specifies an invalid device identifier. /// /// /// MMSYSERR_INVALFLAG /// One or more flags are invalid. /// /// /// MMSYSERR_INVALHANDLE /// The hmxobj parameter specifies an invalid handle. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// MMSYSERR_NODRIVER /// No mixer device is available for the object specified by hmxobj. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixergetlineinfo MMRESULT mixerGetLineInfo( HMIXEROBJ hmxobj, // LPMIXERLINE pmxl, DWORD fdwInfo ); [DllImport(Lib_Winmm, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetLineInfo")] public static extern MMRESULT mixerGetLineInfo([In, Optional] HMIXEROBJ hmxobj, ref MIXERLINE pmxl, MIXER_OBJECTF fdwInfo); /// The mixerGetNumDevs function retrieves the number of mixer devices present in the system. /// Returns the number of mixer devices or zero if no mixer devices are available. // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixergetnumdevs UINT mixerGetNumDevs(); [DllImport(Lib_Winmm, SetLastError = false, ExactSpelling = true)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerGetNumDevs")] public static extern uint mixerGetNumDevs(); /// The mixerMessage function sends a custom mixer driver message directly to a mixer driver. /// /// Identifier of the mixer that receives the message. You must cast the device ID to the HMIXER handle type. If you supply a /// handle instead of a device ID, the function fails and returns the MMSYSERR_NOSUPPORT error code. /// /// /// Custom mixer driver message to send to the mixer driver. This message must be above or equal to the MXDM_USER constant. /// /// Parameter associated with the message being sent. /// Parameter associated with the message being sent. /// /// Returns a value that is specific to the custom mixer driver message. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MMSYSERR_INVALHANDLE /// The specified device handle is invalid. /// /// /// MMSYSERR_INVALPARAM /// The uMsg parameter specified in the MXDM_USER message is invalid. /// /// /// MMSYSERR_NOSUPPORT /// The deviceID parameter must be a valid device ID. /// /// /// MMSYSERR_NOTSUPPORTED /// The mixer device did not process the message. /// /// /// /// /// /// User-defined messages must be sent only to a mixer driver that supports the messages. The application should verify that the /// mixer driver is the driver that supports the message by retrieving the mixer capabilities and checking the wMid, /// wPid, vDriverVersion, and szPname members of the MIXERCAPS structure. /// /// The /// DRV_QUERYDEVICEINTERFACE /// message queries for the device-interface name of a waveIn, waveOut, midiIn, midiOut, or mixer device. /// /// For /// DRV_QUERYDEVICEINTERFACE /// , dwParam1 is a pointer to a caller-allocated buffer into which the function writes a null-terminated Unicode string containing /// the device-interface name. If the device has no device interface, the string length is zero. /// /// For /// DRV_QUERYDEVICEINTERFACE /// , dwParam2 specifies the buffer size in bytes. This is an input parameter to the function. The caller should specify a size that /// is greater than or equal to the buffer size retrieved by the DRV_QUERYDEVICEINTERFACESIZE message. /// /// /// The DRV_QUERYDEVICEINTERFACE message is supported in Windows Me, and Windows 2000 and later. This message is valid only for the /// waveInMessage, waveOutMessage, midiInMessage, midiOutMessage, and mixerMessage functions. The system intercepts this /// message and returns the appropriate value without sending the message to the device driver. For general information about /// system-intercepted xxxMessage functions, see System-Intercepted Device Messages. /// /// The following two message constants are used together for the purpose of obtaining device interface names: /// /// /// DRV_QUERYDEVICEINTERFACESIZE /// /// /// DRV_QUERYDEVICEINTERFACE /// /// /// /// The first message obtains the size in bytes of the buffer needed to hold the string containing the device interface name. The /// second message retrieves the name string in a buffer of the required size. /// /// For more information, see Obtaining a Device Interface Name. /// The /// DRV_QUERYDEVICEINTERFACESIZE /// message queries for the size of the buffer required to hold the device-interface name. /// /// For /// DRV_QUERYDEVICEINTERFACESIZE /// , dwParam1 is a pointer to buffer size. This parameter points to a ULONG variable into which the function writes the required /// buffer size in bytes. The size includes storage space for the name string's terminating null. The size is zero if the device ID /// identifies a device that has no device interface. /// /// For /// DRV_QUERYDEVICEINTERFACESIZE /// , dwParam2 is unused. Set this parameter to zero. /// /// /// This message is valid only for the waveInMessage, waveOutMessage, midiInMessage, midiOutMessage, and mixerMessage /// functions. The system intercepts this message and returns the appropriate value without sending the message to the device /// driver. For general information about system-intercepted xxxMessage functions, see System-Intercepted Device Messages. /// /// /// The buffer size retrieved by this message is expressed as a byte count. It specifies the size of the buffer needed to hold the /// null-terminated Unicode string that contains the device-interface name. The caller allocates a buffer of the specified size and /// uses the DRV_QUERYDEVICEINTERFACE message to retrieve the device-interface name string. /// /// For more information, see Obtaining a Device Interface Name. /// The /// DRV_QUERYDEVNODE /// message queries for the devnode number assigned to the device by the Plug and Play manager. /// /// For /// DRV_QUERYDEVNODE /// , dwParam1 is a pointer to a caller-allocated DWORD variable into which the function writes the devnode number. If no devnode is /// assigned to the device, the function sets this variable to zero. /// /// For /// DRV_QUERYDEVNODE /// , dwParam2 is unused. Set this parameter to zero. /// /// /// In Windows 2000 and later, the message always returns MMSYSERR_NOTSUPPORTED. This message is valid only for the waveInMessage, /// waveOutMessage, midiInMessage, midiOutMessage, and mixerMessage functions. The system intercepts this message and returns /// the appropriate value without sending the message to the device driver. For general information about system-intercepted /// xxxMessage functions, see System-Intercepted Device Messages. /// /// The /// DRV_QUERYMAPPABLE /// message queries for whether the specified device can be used by a mapper. /// /// For /// DRV_QUERYMAPPABLE /// , dwParam1 is unused. Set this parameter to zero. /// /// For /// DRV_QUERYMAPPABLE /// , dwParam2 is unused. Set this parameter to zero. /// /// /// This message is valid only for the waveInMessage, waveOutMessage, midiInMessage, midiOutMessage, mixerMessage and /// auxOutMessage functions. The system intercepts this message and returns the appropriate value without sending the message to the /// device driver. For general information about system-intercepted xxxMessage functions, see System-Intercepted Device Messages. /// /// /// When an application program opens a mapper instead of a specific audio device, the system inserts a mapper between the /// application and the available devices. The mapper selects an appropriate device by mapping the application's requirements to one /// of the available devices. For more information about mappers, see the Microsoft Windows SDK documentation. /// /// The /// DRVM_MAPPER_CONSOLEVOICECOM_GET /// message retrieves the device ID of the preferred voice-communications device. /// /// For /// DRVM_MAPPER_CONSOLEVOICECOM_GET /// , dwParam1 is a pointer to device ID. This parameter points to a DWORD variable into which the function writes the device ID of /// the current preferred voice-communications device. The function writes the value (-1) if no device is available that qualifies /// as a preferred voice-communications device. /// /// For /// DRVM_MAPPER_CONSOLEVOICECOM_GET /// , dwParam2 is a pointer to status flags. This parameter points to a DWORD variable into which the function writes the /// device-status flags. Only one flag bit is currently defined: DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY. /// /// /// This message is valid only for the waveInMessage and waveOutMessage functions. When a caller calls these two functions with the /// DRVM_MAPPER_CONSOLEVOICECOM_GET message, the caller must specify the device ID as WAVE_MAPPER, and then cast this value to the /// appropriate handle type. For the waveInMessage, waveOutMessage, midiInMessage, midiOutMessage, or /// mixerMessage functions, the caller must cast the device ID to a handle of type HWAVEIN, HWAVEOUT, HMIDIIN, HMIDIOUT, or /// HMIXER, respectively. Note that if the caller supplies a valid handle instead of a device ID for this parameter, the function /// fails and returns error code MMSYSERR_NOSUPPORT. /// /// /// The system intercepts this message and returns the appropriate value without sending the message to the device driver. For /// general information about system-intercepted xxxMessage functions, see System-Intercepted Device Messages. /// /// /// This message provides a way to determine which device is preferred specifically for voice communications, in contrast to the /// DRVM_MAPPER_PREFERRED_GET message, which determines which device is preferred for all other audio functions. /// /// /// For example, the preferred waveOut device for voice communications might be the earpiece in a headset, but the preferred /// waveOut device for all other audio functions might be a set of stereo speakers. /// /// /// When the DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY flag bit is set in the DWORD location pointed to by dwParam2, the /// waveIn and waveOut APIs use only the current preferred voice-communications device and do not search for other /// available devices if the preferred device is unavailable. The flag that is output by either the waveInMessage or /// waveOutMessage call applies to the preferred voice-communications device for both the waveIn and waveOut /// APIs, regardless of whether the call is made to waveInMessage or waveOutMessage. For more information, see /// Preferred Voice-Communications Device ID. /// /// The /// DRVM_MAPPER_PREFERRED_GET /// message retrieves the device ID of the preferred audio device. /// /// For /// DRVM_MAPPER_PREFERRED_GET /// , dwParam1 is a pointer to device ID. This parameter points to a DWORD variable into which the function writes the device ID of /// the current preferred device. The function writes the value (-1) if no device is available that qualifies as a preferred device. /// /// For /// DRVM_MAPPER_PREFERRED_GET /// , dwParam2 is a pointer to status flags. This parameter points to a DWORD variable into which the function writes the /// device-status flags. Only one flag bit is currently defined (for waveInMessage and waveOutMessage calls only): DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY. /// /// /// This message is valid only for the waveInMessage, waveOutMessage and midiOutMessage functions. When the caller calls these /// functions with the DRVM_MAPPER_PREFERRED_GET message, the caller must first specify the device ID as WAVE_MAPPER (for /// waveInMessage or waveOutMessage) or MIDI_MAPPER (for midiOutMessage), and then cast this value to the /// appropriate handle type. For the waveInMessage, waveOutMessage, or midiOutMessage functions, the caller /// must cast the device ID to a handle type HWAVEIN, HWAVEOUT or HMIDIOUT, respectively. Note that if the caller supplies a valid /// handle instead of a device ID for this parameter, the function fails and returns error code MMSYSERR_NOSUPPORT. /// /// /// The system intercepts this message and returns the appropriate value without sending the message to the device driver. For /// general information about system-intercepted xxxMessage functions, see System-Intercepted Device Messages. /// /// /// This message provides a way to determine which device is preferred for audio functions in general, in contrast to the /// DRVM_MAPPER_CONSOLEVOICECOM_GET message, which determines which device is preferred specifically for voice communications. /// /// /// When the DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY flag bit is set in the DWORD location pointed to by dwParam2, the /// waveIn and waveOut APIs use only the current preferred device and do not search for other available devices if the /// preferred device is unavailable. Note that the midiOutMessage function does not output this flag--the midiOut API /// always uses only the preferred device. The flag that is output by either the waveInMessage or waveOutMessage call /// applies to the preferred device for both the waveIn and waveOut APIs, regardless of whether the call is made to /// waveInMessage or waveOutMessage. /// /// /// The xxxMessage functions accept this value in place of a valid device handle in order to allow an application to determine the /// default device ID without first having to open a device. For more information, see Accessing the Preferred Device ID. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixermessage DWORD mixerMessage( HMIXER hmx, UINT uMsg, // DWORD_PTR dwParam1, DWORD_PTR dwParam2 ); [DllImport(Lib_Winmm, SetLastError = false, ExactSpelling = true)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerMessage")] public static extern uint mixerMessage([In, Optional] HMIXER hmx, uint uMsg, [In, Optional] IntPtr dwParam1, [In, Optional] IntPtr dwParam2); /// /// The mixerOpen function opens a specified mixer device and ensures that the device will not be removed until the /// application closes the handle. /// /// /// Pointer to a variable that will receive a handle identifying the opened mixer device. Use this handle to identify the device /// when calling other audio mixer functions. This parameter cannot be NULL. /// /// /// Identifier of the mixer device to open. Use a valid device identifier or any HMIXEROBJ (see the mixerGetID function for a /// description of mixer object handles). A "mapper" for audio mixer devices does not currently exist, so a mixer device identifier /// of -1 is not valid. /// /// /// Handle to a window called when the state of an audio line and/or control associated with the device being opened is changed. /// Specify NULL for this parameter if no callback mechanism is to be used. /// /// Reserved. Must be zero. /// /// Flags for opening the device. The following values are defined. /// /// /// Value /// Meaning /// /// /// CALLBACK_WINDOW /// The dwCallback parameter is assumed to be a window handle (HWND). /// /// /// MIXER_OBJECTF_AUX /// /// The uMxId parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by /// the auxGetNumDevs function. /// /// /// /// MIXER_OBJECTF_HMIDIIN /// The uMxId parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function. /// /// /// MIXER_OBJECTF_HMIDIOUT /// The uMxId parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// /// /// MIXER_OBJECTF_HMIXER /// The uMxId parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. /// /// /// MIXER_OBJECTF_HWAVEIN /// The uMxId parameter is a waveform-audio input handle returned by the waveInOpen function. /// /// /// MIXER_OBJECTF_HWAVEOUT /// The uMxId parameter is a waveform-audio output handle returned by the waveOutOpen function. /// /// /// MIXER_OBJECTF_MIDIIN /// /// The uMxId parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIDIOUT /// /// The uMxId parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiOutGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIXER /// /// The uMxId parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the /// mixerGetNumDevs function. This flag is optional. /// /// /// /// MIXER_OBJECTF_WAVEIN /// /// The uMxId parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_WAVEOUT /// /// The uMxId parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// /// /// /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MMSYSERR_ALLOCATED /// The specified resource is already allocated by the maximum number of clients possible. /// /// /// MMSYSERR_BADDEVICEID /// The uMxId parameter specifies an invalid device identifier. /// /// /// MMSYSERR_INVALFLAG /// One or more flags are invalid. /// /// /// MMSYSERR_INVALHANDLE /// The uMxId parameter specifies an invalid handle. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// MMSYSERR_NODRIVER /// /// No mixer device is available for the object specified by uMxId. Note that the location referenced by uMxId will also contain the /// value –1. /// /// /// /// MMSYSERR_NOMEM /// Unable to allocate resources. /// /// /// /// /// /// Use the mixerGetNumDevs function to determine the number of audio mixer devices present in the system. The device identifier /// specified by uMxId varies from zero to one less than the number of devices present. /// /// /// If a window is chosen to receive callback information, the MM_MIXM_LINE_CHANGE and MM_MIXM_CONTROL_CHANGE messages are sent to /// the window procedure function to indicate when an audio line or control state changes. For both messages, the wParam parameter /// is the handle of the mixer device. The lParam parameter is the line identifier for MM_MIXM_LINE_CHANGE or the control /// identifier for MM_MIXM_CONTROL_CHANGE that changed state. /// /// To query for audio mixer support or a media device, use the mixerGetID function. /// /// On 64-bit systems, this function may not work as expected in situations where you pass a 64-bit LPHWAVEOUT pointer in the /// uMxId parameter, because the uMxId parameter is truncated to 32 bits. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixeropen MMRESULT mixerOpen( LPHMIXER phmx, UINT uMxId, // DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen ); [DllImport(Lib_Winmm, SetLastError = false, ExactSpelling = true)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerOpen")] public static extern MMRESULT mixerOpen([In, Optional] HMIXER phmx, uint uMxId, [In, Optional] IntPtr dwCallback, [In, Optional] IntPtr dwInstance, MIXER_OBJECTF fdwOpen); /// The mixerSetControlDetails function sets properties of a single control associated with an audio line. /// Handle to the mixer device object for which properties are being set. /// /// Pointer to a MIXERCONTROLDETAILS structure. This structure is used to reference control detail structures that contain the /// desired state for the control. /// /// /// Flags for setting properties for a control. The following values are defined. /// /// /// Value /// Meaning /// /// /// MIXER_OBJECTF_AUX /// /// The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by /// the auxGetNumDevs function. /// /// /// /// MIXER_OBJECTF_HMIDIIN /// The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function. /// /// /// MIXER_OBJECTF_HMIDIOUT /// The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function. /// /// /// MIXER_OBJECTF_HMIXER /// The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional. /// /// /// MIXER_OBJECTF_HWAVEIN /// The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function. /// /// /// MIXER_OBJECTF_HWAVEOUT /// The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function. /// /// /// MIXER_OBJECTF_MIDIIN /// /// The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the /// number of devices returned by the midiInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIDIOUT /// /// The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than /// the number of devices returned by the midiOutGetNumDevs function. /// /// /// /// MIXER_OBJECTF_MIXER /// /// The hmxobj parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the /// mixerGetNumDevs function. This flag is optional. /// /// /// /// MIXER_OBJECTF_WAVEIN /// /// The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of /// devices returned by the waveInGetNumDevs function. /// /// /// /// MIXER_OBJECTF_WAVEOUT /// /// The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of /// devices returned by the waveOutGetNumDevs function. /// /// /// /// MIXER_SETCONTROLDETAILSF_CUSTOM /// /// A custom dialog box for the specified custom mixer control is displayed. The mixer device gathers the required information from /// the user and returns the data in the specified buffer. The handle for the owning window is specified in the hwndOwner member of /// the MIXERCONTROLDETAILS structure. (This handle can be set to NULL.) The application can then save the data from the dialog box /// and use it later to reset the control to the same state by using the MIXER_SETCONTROLDETAILSF_VALUE flag. /// /// /// /// MIXER_SETCONTROLDETAILSF_VALUE /// /// The current value(s) for a control are set. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more /// mixer-control details structures of the appropriate class for the control. /// /// /// /// /// /// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following. /// /// /// Return code /// Description /// /// /// MIXERR_INVALCONTROL /// The control reference is invalid. /// /// /// MMSYSERR_BADDEVICEID /// The hmxobj parameter specifies an invalid device identifier. /// /// /// MMSYSERR_INVALFLAG /// One or more flags are invalid. /// /// /// MMSYSERR_INVALHANDLE /// The hmxobj parameter specifies an invalid handle. /// /// /// MMSYSERR_INVALPARAM /// One or more parameters are invalid. /// /// /// MMSYSERR_NODRIVER /// No mixer device is available for the object specified by hmxobj. /// /// /// /// /// All members of the MIXERCONTROLDETAILS structure must be initialized before calling mixerSetControlDetails. /// /// If an application needs to retrieve only the current state of a custom mixer control and not display a dialog box, then /// mixerGetControlDetails can be used with the MIXER_GETCONTROLDETAILSF_VALUE flag. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-mixersetcontroldetails MMRESULT mixerSetControlDetails( // HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails ); [DllImport(Lib_Winmm, SetLastError = false, ExactSpelling = true)] [PInvokeData("mmeapi.h", MSDNShortId = "NF:mmeapi.mixerSetControlDetails")] public static extern MMRESULT mixerSetControlDetails([In, Optional] HMIXEROBJ hmxobj, in MIXERCONTROLDETAILS pmxcd, MIXER_OBJECTF fdwDetails); /// Provides a handle to a mixer device. [StructLayout(LayoutKind.Sequential)] public struct HMIXER : IHandle { private readonly IntPtr handle; /// Initializes a new instance of the struct. /// An object that represents the pre-existing handle to use. public HMIXER(IntPtr preexistingHandle) => handle = preexistingHandle; /// Returns an invalid handle by instantiating a object with . public static HMIXER NULL => new(IntPtr.Zero); /// Gets a value indicating whether this instance is a null handle. public bool IsNull => handle == IntPtr.Zero; /// Performs an explicit conversion from to . /// The handle. /// The result of the conversion. public static explicit operator IntPtr(HMIXER h) => h.handle; /// Performs an implicit conversion from to . /// The pointer to a handle. /// The result of the conversion. public static implicit operator HMIXER(IntPtr h) => new(h); /// Implements the operator !=. /// The first handle. /// The second handle. /// The result of the operator. public static bool operator !=(HMIXER h1, HMIXER h2) => !(h1 == h2); /// Implements the operator ==. /// The first handle. /// The second handle. /// The result of the operator. public static bool operator ==(HMIXER h1, HMIXER h2) => h1.Equals(h2); /// public override bool Equals(object? obj) => obj is HMIXER h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); /// public IntPtr DangerousGetHandle() => handle; } /// Provides a handle to a mixer device object. [StructLayout(LayoutKind.Sequential)] public struct HMIXEROBJ : IHandle { private readonly IntPtr handle; /// Initializes a new instance of the struct. /// An object that represents the pre-existing handle to use. public HMIXEROBJ(IntPtr preexistingHandle) => handle = preexistingHandle; /// Returns an invalid handle by instantiating a object with . public static HMIXEROBJ NULL => new(IntPtr.Zero); /// Gets a value indicating whether this instance is a null handle. public bool IsNull => handle == IntPtr.Zero; /// Performs an explicit conversion from to . /// The handle. /// The result of the conversion. public static explicit operator IntPtr(HMIXEROBJ h) => h.handle; /// Performs an implicit conversion from to . /// The pointer to a handle. /// The result of the conversion. public static implicit operator HMIXEROBJ(IntPtr h) => new(h); /// Implements the operator !=. /// The first handle. /// The second handle. /// The result of the operator. public static bool operator !=(HMIXEROBJ h1, HMIXEROBJ h2) => !(h1 == h2); /// Implements the operator ==. /// The first handle. /// The second handle. /// The result of the operator. public static bool operator ==(HMIXEROBJ h1, HMIXEROBJ h2) => h1.Equals(h2); /// public override bool Equals(object? obj) => obj is HMIXEROBJ h && handle == h.handle; /// public override int GetHashCode() => handle.GetHashCode(); /// public IntPtr DangerousGetHandle() => handle; } /// The MIXERCAPS structure describes the capabilities of a mixer device. // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercaps typedef struct tMIXERCAPS { WORD wMid; WORD wPid; // VERSION vDriverVersion; char szPname[MAXPNAMELEN]; DWORD fdwSupport; DWORD cDestinations; } MIXERCAPS, *PMIXERCAPS, *LPMIXERCAPS; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCAPS")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct MIXERCAPS { /// /// A manufacturer identifier for the mixer device driver. Manufacturer identifiers are defined in Manufacturer and Product Identifiers. /// public ushort wMid; /// /// A product identifier for the mixer device driver. Product identifiers are defined in Manufacturer and Product Identifiers. /// public ushort wPid; /// /// Version number of the mixer device driver. The high-order byte is the major version number, and the low-order byte is the /// minor version number. /// public uint vDriverVersion; /// /// Name of the product. If the mixer device driver supports multiple cards, this string must uniquely and easily identify /// (potentially to a user) the specific card. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXPNAMELEN)] public string szPname; /// Various support information for the mixer device driver. No extended support bits are currently defined. public uint fdwSupport; /// /// The number of audio line destinations available through the mixer device. All mixer devices must support at least one /// destination line, so this member cannot be zero. Destination indexes used in the dwDestination member of the /// MIXERLINE structure range from zero to the value specified in the cDestinations member minus one. /// public uint cDestinations; /// Gets the native size of this structure. public static uint NativeSize = unchecked((uint)Marshal.SizeOf(typeof(MIXERCAPS))); } /// The MIXERCONTROL structure describes the state and metrics of a single control for an audio line. // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercontrol typedef struct tMIXERCONTROL { DWORD cbStruct; // DWORD dwControlID; DWORD dwControlType; DWORD fdwControl; DWORD cMultipleItems; char szShortName[MIXER_SHORT_NAME_CHARS]; char // szName[MIXER_LONG_NAME_CHARS]; union { struct { LONG lMinimum; LONG lMaximum; } DUMMYSTRUCTNAME; struct { DWORD dwMinimum; DWORD // dwMaximum; } DUMMYSTRUCTNAME2; DWORD dwReserved[6]; } Bounds; union { DWORD cSteps; DWORD cbCustomData; DWORD dwReserved[6]; } // Metrics; } MIXERCONTROL, *PMIXERCONTROL, *LPMIXERCONTROL; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROL")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct MIXERCONTROL { /// Size, in bytes, of the MIXERCONTROL structure. public uint cbStruct; /// /// Audio mixer-defined identifier that uniquely refers to the control described by the MIXERCONTROL structure. This /// identifier can be in any format supported by the mixer device. An application should use this identifier only as an abstract /// handle. No two controls for a single mixer device can ever have the same control identifier. /// public uint dwControlID; /// /// /// Class of the control for which the identifier is specified in dwControlID. An application must use this information /// to display the appropriate control for input from the user. An application can also display tailored graphics based on the /// control class or search for a particular control class on a specific line. If an application does not know about a control /// class, this control must be ignored. There are eight control class classifications, each with one or more standard control types: /// /// /// /// Name /// Descriptions /// /// /// MIXERCONTROL_CT_CLASS_CUSTOM /// MIXERCONTROL_CONTROLTYPE_CUSTOM /// /// /// MIXERCONTROL_CT_CLASS_FADER /// /// MIXERCONTROL_CONTROLTYPE_BASS MIXERCONTROL_CONTROLTYPE_EQUALIZER MIXERCONTROL_CONTROLTYPE_FADER /// MIXERCONTROL_CONTROLTYPE_TREBLE MIXERCONTROL_CONTROLTYPE_VOLUME /// /// /// /// MIXERCONTROL_CT_CLASS_LIST /// MIXERCONTROL_CONTROLTYPE_MIXER MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT MIXERCONTROL_CONTROLTYPE_MUX MIXERCONTROL_CONTROLTYPE_SINGLESELECT /// /// /// MIXERCONTROL_CT_CLASS_METER /// MIXERCONTROL_CONTROLTYPE_BOOLEANMETER MIXERCONTROL_CONTROLTYPE_PEAKMETER MIXERCONTROL_CONTROLTYPE_SIGNEDMETER MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER /// /// /// MIXERCONTROL_CT_CLASS_NUMBER /// MIXERCONTROL_CONTROLTYPE_DECIBELS MIXERCONTROL_CONTROLTYPE_PERCENT MIXERCONTROL_CONTROLTYPE_SIGNED MIXERCONTROL_CONTROLTYPE_UNSIGNED /// /// /// MIXERCONTROL_CT_CLASS_SLIDER /// MIXERCONTROL_CONTROLTYPE_PAN MIXERCONTROL_CONTROLTYPE_QSOUNDPAN MIXERCONTROL_CONTROLTYPE_SLIDER /// /// /// MIXERCONTROL_CT_CLASS_SWITCH /// /// MIXERCONTROL_CONTROLTYPE_BOOLEAN MIXERCONTROL_CONTROLTYPE_BUTTON MIXERCONTROL_CONTROLTYPE_LOUDNESS /// MIXERCONTROL_CONTROLTYPE_MONO MIXERCONTROL_CONTROLTYPE_MUTE MIXERCONTROL_CONTROLTYPE_ONOFF MIXERCONTROL_CONTROLTYPE_STEREOENH /// /// /// /// MIXERCONTROL_CT_CLASS_TIME /// MIXERCONTROL_CONTROLTYPE_MICROTIME MIXERCONTROL_CONTROLTYPE_MILLITIME /// /// /// public MIXERCONTROL_CT dwControlType; /// /// Status and support flags for the audio line control. The following values are defined: /// /// /// Name /// Description /// /// /// MIXERCONTROL_CONTROLF_DISABLED /// /// The control is disabled, perhaps due to other settings for the mixer hardware, and cannot be used. An application can read /// current settings from a disabled control, but it cannot apply settings. /// /// /// /// MIXERCONTROL_CONTROLF_MULTIPLE /// /// The control has two or more settings per channel. An equalizer, for example, requires this flag because each frequency band /// can be set to a different value. An equalizer that affects both channels of a stereo line in a uniform fashion will also /// specify the MIXERCONTROL_CONTROLF_UNIFORM flag. /// /// /// /// MIXERCONTROL_CONTROLF_UNIFORM /// /// The control acts on all channels of a multichannel line in a uniform fashion. For example, a control that mutes both /// channels of a stereo line would set this flag. Most MIXERCONTROL_CONTROLTYPE_MUX and MIXERCONTROL_CONTROLTYPE_MIXER controls /// also specify the MIXERCONTROL_CONTROLF_UNIFORM flag. /// /// /// /// public MIXERCONTROL_CONTROLF fdwControl; /// /// Number of items per channel that make up a MIXERCONTROL_CONTROLF_MULTIPLE control. This number is always two or greater for /// multiple-item controls. If the control is not a multiple-item control, do not use this member; it will be zero. /// public uint cMultipleItems; /// /// Short string that describes the audio line control specified by dwControlID. This description should be appropriate /// to use as a concise label for the control. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MIXER_SHORT_NAME_CHARS)] public string szShortName; /// /// String that describes the audio line control specified by dwControlID. This description should be appropriate to use /// as a complete description for the control. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MIXER_LONG_NAME_CHARS)] public string szName; /// Union of boundary types. public BOUNDS Bounds; /// Union of boundary types. [StructLayout(LayoutKind.Sequential, Size = 24)] public struct BOUNDS { /// /// Minimum signed value for a control that has a signed boundary nature. This member cannot be used in conjunction with dwMinimum. /// public int lMinimum; /// /// Maximum signed value for a control that has a signed boundary nature. This member cannot be used in conjunction with dwMaximum. /// public int lMaximum; /// /// Minimum unsigned value for a control that has an unsigned boundary nature. This member cannot be used in conjunction /// with lMinimum. /// public uint dwMinimum { get => unchecked((uint)lMinimum); set => lMinimum = unchecked((int)value); } /// /// Maximum unsigned value for a control that has an unsigned boundary nature. This member cannot be used in conjunction /// with lMaximum. /// public uint dwMaximum { get => unchecked((uint)lMaximum); set => lMaximum = unchecked((int)value); } } /// Union of boundary metrics. public METRICS Metrics; /// Union of boundary metrics. [StructLayout(LayoutKind.Sequential, Size = 24)] public struct METRICS { /// /// Number of discrete ranges within the union specified for a control specified by the Bounds member. This member /// overlaps with the other members of the Metrics structure member and cannot be used in conjunction with those members. /// public uint cSteps; /// /// Size, in bytes, required to contain the state of a custom control class. This member is appropriate only for the /// MIXERCONTROL_CONTROLTYPE_CUSTOM control class. /// public uint cbCustomData { get => cSteps; set => cSteps = cbCustomData; } } } /// /// The MIXERCONTROLDETAILS structure refers to control-detail structures, retrieving or setting state information of an /// audio mixer control. All members of this structure must be initialized before calling the mixerGetControlDetails and /// mixerSetControlDetails functions. /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercontroldetails typedef struct tMIXERCONTROLDETAILS { // DWORD cbStruct; DWORD dwControlID; DWORD cChannels; union { HWND hwndOwner; DWORD cMultipleItems; } DUMMYUNIONNAME; DWORD // cbDetails; LPVOID paDetails; } MIXERCONTROLDETAILS, *PMIXERCONTROLDETAILS, *LPMIXERCONTROLDETAILS; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROLDETAILS")] [StructLayout(LayoutKind.Sequential)] public struct MIXERCONTROLDETAILS { /// /// Size, in bytes, of the MIXERCONTROLDETAILS structure. The size must be large enough to contain the base /// MIXERCONTROLDETAILS structure. When mixerGetControlDetails returns, this member contains the actual size of the /// information returned. The returned information will not exceed the requested size, nor will it be smaller than the base /// MIXERCONTROLDETAILS structure. /// public uint cbStruct; /// Control identifier on which to get or set properties. public uint dwControlID; /// /// Number of channels on which to get or set control properties. The following values are defined: /// /// /// Name /// Description /// /// /// 0 /// Use this value when the control is a MIXERCONTROL_CONTROLTYPE_CUSTOM control. /// /// /// 1 /// /// Use this value when the control is a MIXERCONTROL_CONTROLF_UNIFORM control or when an application needs to get and set all /// channels as if they were uniform. /// /// /// /// MIXERLINE cChannels /// Use this value when the properties for the control are expected on all channels for a line. /// /// /// /// An application cannot specify a value that falls between 1 and the number of channels for the audio line. For example, /// specifying 2 or 3 for a four-channel line is not valid. This member cannot be 0 for noncustom control types. /// /// This member cannot be 0 for noncustom control types. /// public uint cChannels; /// /// Handle to the window that owns a custom dialog box for a mixer control. This member is used when the /// MIXER_SETCONTROLDETAILSF_CUSTOM flag is specified in the mixerSetControlDetails function. /// public HWND hwndOwner; /// /// Number of multiple items per channel on which to get or set properties. The following values are defined: /// /// /// Name /// Description /// /// /// 0 /// Use this value for all controls except for a MIXERCONTROL_CONTROLF_MULTIPLE or a MIXERCONTROL_CONTROLTYPE_CUSTOM control. /// /// /// MIXERCONTROL cMultipleItems member /// Use this value when the control class is MIXERCONTROL_CONTROLF_MULTIPLE. /// /// /// MIXERCONTROLDETAILS hwndOwner member /// /// Use this value when the control is a MIXERCONTROL_CONTROLTYPE_CUSTOM control and the MIXER_SETCONTROLDETAILSF_CUSTOM flag is /// specified for the mixerSetControlDetails function. In this case, the hwndOwner member overlaps with cMultipleItems, /// providing the value of the window handle. /// /// /// /// /// When using a MIXERCONTROL_CONTROLTYPE_CUSTOM control without the MIXERCONTROL_CONTROLTYPE_CUSTOM flag, specify zero for this member. /// /// /// An application cannot specify any value other than the value specified in the cMultipleItems member of the MIXERCONTROL /// structure for a MIXERCONTROL_CONTROLF_MULTIPLE control. /// /// public uint cMultipleItems { get => unchecked((uint)hwndOwner.DangerousGetHandle().ToInt32()); set => hwndOwner = new HWND(new IntPtr(unchecked((int)value))); } /// /// Size, in bytes, of one of the following details structures being used: /// /// /// Name /// Description /// /// /// MIXERCONTROLDETAILS_BOOLEAN /// Boolean value for an audio line control. /// /// /// MIXERCONTROLDETAILS_LISTTEXT /// /// List text buffer for an audio line control. For information about the appropriate details structure for a specific control, /// see Control Types. /// /// /// /// MIXERCONTROLDETAILS_SIGNED /// Signed value for an audio line control. /// /// /// MIXERCONTROLDETAILS_UNSIGNED /// Unsigned value for an audio line control. /// /// /// public uint cbDetails; /// /// Pointer to an array of one or more structures in which properties for the specified control are retrieved or set. /// /// For MIXERCONTROL_CONTROLF_MULTIPLE controls, the size of this buffer should be the product of the cChannels, /// cMultipleItems and cbDetails members of the MIXERCONTROLDETAILS structure. For controls other than /// MIXERCONTROL_CONTROLF_MULTIPLE types, the size of this buffer is the product of the cChannels and cbDetails /// members of the MIXERCONTROLDETAILS structure. /// /// /// For controls other than MIXERCONTROL_CONTROLF_MULTIPLE types, the size of this buffer is the product of the cChannels /// and cbDetails members of the MIXERCONTROLDETAILS structure. For controls other than /// MIXERCONTROL_CONTROLF_MULTIPLE types, the size of this buffer is the product of the cChannels and cbDetails /// members of the MIXERCONTROLDETAILS structure. /// /// /// For controls that are MIXERCONTROL_CONTROLF_MULTIPLE types, the array can be treated as a two-dimensional array that is /// channel major. That is, all multiple items for the left channel are given, then all multiple items for the right channel, /// and so on. /// /// /// For controls other than MIXERCONTROL_CONTROLF_MULTIPLE types, each element index is equivalent to the zero-based channel /// that it affects. That is, paDetails[0] is for the left channel and paDetails[1] is for the right channel. /// /// /// If the control is a MIXERCONTROL_CONTROLTYPE_CUSTOM control, this member must point to a buffer that is at least large /// enough to contain the size, in bytes, specified by the cbCustomData member of the MIXERCONTROL structure. /// /// public IntPtr paDetails; } /// /// The MIXERCONTROLDETAILS_BOOLEAN structure retrieves and sets Boolean control properties for an audio mixer control /// /// /// The following standard control types use this structure for retrieving and setting properties. /// Meter controls: /// MIXERCONTROL_CONTROLTYPE_BOOLEANMETER /// Switch controls: /// MIXERCONTROL_CONTROLTYPE_BOOLEAN /// MIXERCONTROL_CONTROLTYPE_BUTTON /// MIXERCONTROL_CONTROLTYPE_LOUDNESS /// MIXERCONTROL_CONTROLTYPE_MONO /// MIXERCONTROL_CONTROLTYPE_MUTE /// MIXERCONTROL_CONTROLTYPE_ONOFF /// MIXERCONTROL_CONTROLTYPE_STEREOENH /// List controls: /// MIXERCONTROL_CONTROLTYPE_MIXER /// MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT /// MIXERCONTROL_CONTROLTYPE_MUX /// MIXERCONTROL_CONTROLTYPE_SINGLESELECT /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercontroldetails_boolean typedef struct // tMIXERCONTROLDETAILS_BOOLEAN { LONG fValue; } MIXERCONTROLDETAILS_BOOLEAN, *PMIXERCONTROLDETAILS_BOOLEAN, *LPMIXERCONTROLDETAILS_BOOLEAN; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROLDETAILS_BOOLEAN")] [StructLayout(LayoutKind.Sequential)] public struct MIXERCONTROLDETAILS_BOOLEAN { /// /// Boolean value for a single item or channel. This value is assumed to be zero for a FALSE state (such as off or disabled), /// and nonzero for a TRUE state (such as on or enabled). /// [MarshalAs(UnmanagedType.Bool)] public bool fValue; } /// /// The MIXERCONTROLDETAILS_LISTTEXT structure retrieves list text, label text, and/or band-range information for multiple-item /// controls. This structure is used when the MIXER_GETCONTROLDETAILSF_LISTTEXT flag is specified in the mixerGetControlDetails function. /// /// /// The following standard control types use this structure for retrieving the item text descriptions on multiple-item controls: /// Fader control: /// MIXERCONTROL_CONTROLTYPE_EQUALIZER /// List controls: /// MIXERCONTROL_CONTROLTYPE_MIXER /// MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT /// MIXERCONTROL_CONTROLTYPE_MUX /// MIXERCONTROL_CONTROLTYPE_SINGLESELECT /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercontroldetails_listtext typedef struct // tMIXERCONTROLDETAILS_LISTTEXT { DWORD dwParam1; DWORD dwParam2; char szName[MIXER_LONG_NAME_CHARS]; } // MIXERCONTROLDETAILS_LISTTEXT, *PMIXERCONTROLDETAILS_LISTTEXT, *LPMIXERCONTROLDETAILS_LISTTEXT; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROLDETAILS_LISTTEXT")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct MIXERCONTROLDETAILS_LISTTEXT { /// /// Control class-specific values. The following control types are listed with their corresponding values: /// /// /// Name /// Description /// /// /// EQUALIZER /// MIXERCONTROL. Bounds dwMinimum member. /// /// /// MIXER and MUX /// MIXERLINEdwLineID member. /// /// /// MULTIPLESELECT and SINGLESELECT /// Undefined; must be zero /// /// /// public uint dwParam1; /// See dwParam1. public uint dwParam2; /// /// Name describing a single item in a multiple-item control. This text can be used as a label or item text, depending on the /// control class. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MIXER_LONG_NAME_CHARS)] public string szName; } /// The MIXERCONTROLDETAILS_SIGNED structure retrieves and sets signed type control properties for an audio mixer control. /// /// The following standard control types use this structure for retrieving and setting properties: /// Meter controls: /// MIXERCONTROL_CONTROLTYPE_PEAKMETER /// MIXERCONTROL_CONTROLTYPE_SIGNEDMETER /// Member controls: /// MIXERCONTROL_CONTROLTYPE_SIGNED /// Number controls: /// MIXERCONTROL_CONTROLTYPE_DECIBELS /// Slider controls: /// MIXERCONTROL_CONTROLTYPE_PAN /// MIXERCONTROL_CONTROLTYPE_QSOUNDPAN /// MIXERCONTROL_CONTROLTYPE_SLIDER /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercontroldetails_signed typedef struct // tMIXERCONTROLDETAILS_SIGNED { LONG lValue; } MIXERCONTROLDETAILS_SIGNED, *PMIXERCONTROLDETAILS_SIGNED, *LPMIXERCONTROLDETAILS_SIGNED; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROLDETAILS_SIGNED")] [StructLayout(LayoutKind.Sequential)] public struct MIXERCONTROLDETAILS_SIGNED { /// /// Signed integer value for a single item or channel. This value must be inclusively within the bounds given in the Bounds /// member of this structure for signed integer controls. /// public int lValue; } /// /// The MIXERCONTROLDETAILS_UNSIGNED structure retrieves and sets unsigned type control properties for an audio mixer control. /// /// /// The following standard control types use this structure for retrieving and setting properties: /// Meter control: /// MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER /// Number control: /// MIXERCONTROL_CONTROLTYPE_UNSIGNED /// Fader controls: /// MIXERCONTROL_CONTROLTYPE_BASS /// MIXERCONTROL_CONTROLTYPE_EQUALIZER /// MIXERCONTROL_CONTROLTYPE_FADER /// MIXERCONTROL_CONTROLTYPE_TREBLE /// MIXERCONTROL_CONTROLTYPE_VOLUME /// Time controls: /// MIXERCONTROL_CONTROLTYPE_MICROTIME /// MIXERCONTROL_CONTROLTYPE_MILLITIME /// MIXERCONTROL_CONTROLTYPE_PERCENT /// // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixercontroldetails_unsigned typedef struct // tMIXERCONTROLDETAILS_UNSIGNED { DWORD dwValue; } MIXERCONTROLDETAILS_UNSIGNED, *PMIXERCONTROLDETAILS_UNSIGNED, *LPMIXERCONTROLDETAILS_UNSIGNED; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERCONTROLDETAILS_UNSIGNED")] [StructLayout(LayoutKind.Sequential)] public struct MIXERCONTROLDETAILS_UNSIGNED { /// /// Unsigned integer value for a single item or channel. This value must be inclusively within the bounds given in the Bounds /// structure member of the MIXERCONTROL structure for unsigned integer controls. /// public uint dwValue; } /// The MIXERLINE structure describes the state and metrics of an audio line. // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixerline typedef struct tMIXERLINE { DWORD cbStruct; DWORD // dwDestination; DWORD dwSource; DWORD dwLineID; DWORD fdwLine; DWORD dwUser; DWORD dwComponentType; DWORD cChannels; DWORD // cConnections; DWORD cControls; char szShortName[MIXER_SHORT_NAME_CHARS]; char szName[MIXER_LONG_NAME_CHARS]; struct { DWORD // dwType; DWORD dwDeviceID; WORD wMid; WORD wPid; VERSION vDriverVersion; char szPname[MAXPNAMELEN]; } Target; } MIXERLINE, // *PMIXERLINE, *LPMIXERLINE; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERLINE")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct MIXERLINE { /// /// Size, in bytes, of the MIXERLINE structure. This member must be initialized before calling the mixerGetLineInfo /// function. The size specified in this member must be large enough to contain the MIXERLINE structure. When /// mixerGetLineInfo returns, this member contains the actual size of the information returned. The returned information /// will not exceed the requested size. /// public uint cbStruct; /// /// Destination line index. This member ranges from zero to one less than the value specified in the cDestinations member /// of the MIXERCAPS structure retrieved by the mixerGetDevCaps function. When the mixerGetLineInfo function is called with the /// MIXER_GETLINEINFOF_DESTINATION flag, properties for the destination line are returned. (The dwSource member must be /// set to zero in this case.) When called with the MIXER_GETLINEINFOF_SOURCE flag, the properties for the source given by the /// dwSource member that is associated with the dwDestination member are returned. /// public uint dwDestination; /// /// Index for the audio source line associated with the dwDestination member. That is, this member specifies the nth /// audio source line associated with the specified audio destination line. This member is not used for destination lines and /// must be set to zero when MIXER_GETLINEINFOF_DESTINATION is specified in the mixerGetLineInfo function. When the /// MIXER_GETLINEINFOF_SOURCE flag is specified, this member ranges from zero to one less than the value specified in the /// cConnections member for the audio destination line given in the dwDestination member. /// public uint dwSource; /// /// An identifier defined by the mixer device that uniquely refers to the audio line described by the MIXERLINE /// structure. This identifier is unique for each mixer device and can be in any format. An application should use this /// identifier only as an abstract handle. /// public uint dwLineID; /// /// Status and support flags for the audio line. This member is always returned to the application and requires no initialization. /// /// /// Name /// Description /// /// /// MIXERLINE_LINEF_ACTIVE /// Audio line is active. An active line indicates that a signal is probably passing through the line. /// /// /// MIXERLINE_LINEF_DISCONNECTED /// /// Audio line is disconnected. A disconnected line's associated controls can still be modified, but the changes have no effect /// until the line is connected. /// /// /// /// MIXERLINE_LINEF_SOURCE /// /// Audio line is an audio source line associated with a single audio destination line. If this flag is not set, this line is an /// audio destination line associated with zero or more audio source lines. /// /// /// /// /// If an application is not using a waveform-audio output device, the audio line associated with that device would not be /// active (that is, the MIXERLINE_LINEF_ACTIVE flag would not be set). /// /// /// If the waveform-audio output device is opened, then the audio line is considered active and the MIXERLINE_LINEF_ACTIVE flag /// will be set. /// /// /// A paused or starved waveform-audio output device is still considered active. In other words, if the waveform-audio output /// device is opened by an application regardless of whether data is being played, the associated audio line is considered active. /// /// If a line cannot be strictly defined as active, the mixer device will always set the MIXERLINE_LINEF_ACTIVE flag. /// public MIXERLINE_LINEF fdwLine; /// /// Instance data defined by the audio device for the line. This member is intended for custom mixer applications designed /// specifically for the mixer device returning this information. Other applications should ignore this data. /// public IntPtr dwUser; /// /// /// Component type for this audio line. An application can use this information to display tailored graphics or to search for a /// particular component. If an application does not use component types, this member should be ignored. This member can be one /// of the following values: /// /// /// /// Name /// Description /// /// /// MIXERLINE_COMPONENTTYPE_DST_DIGITAL /// Audio line is a digital destination (for example, digital input to a DAT or CD audio device). /// /// /// MIXERLINE_COMPONENTTYPE_DST_HEADPHONES /// /// Audio line is an adjustable (gain and/or attenuation) destination intended to drive headphones. Most audio cards use the /// same audio destination line for speakers and headphones, in which case the mixer device simply uses the /// MIXERLINE_COMPONENTTYPE_DST_SPEAKERS type. /// /// /// /// MIXERLINE_COMPONENTTYPE_DST_LINE /// /// Audio line is a line level destination (for example, line level input from a CD audio device) that will be the final /// recording source for the analog-to-digital converter (ADC). Because most audio cards for personal computers provide some /// sort of gain for the recording audio source line, the mixer device will use the MIXERLINE_COMPONENTTYPE_DST_WAVEIN type. /// /// /// /// MIXERLINE_COMPONENTTYPE_DST_MONITOR /// Audio line is a destination used for a monitor. /// /// /// MIXERLINE_COMPONENTTYPE_DST_SPEAKERS /// /// Audio line is an adjustable (gain and/or attenuation) destination intended to drive speakers. This is the typical component /// type for the audio output of audio cards for personal computers. /// /// /// /// MIXERLINE_COMPONENTTYPE_DST_TELEPHONE /// Audio line is a destination that will be routed to a telephone line. /// /// /// MIXERLINE_COMPONENTTYPE_DST_UNDEFINED /// /// Audio line is a destination that cannot be defined by one of the standard component types. A mixer device is required to use /// this component type for line component types that have not been defined by Microsoft Corporation. /// /// /// /// MIXERLINE_COMPONENTTYPE_DST_VOICEIN /// /// Audio line is a destination that will be the final recording source for voice input. This component type is exactly like /// MIXERLINE_COMPONENTTYPE_DST_WAVEIN but is intended specifically for settings used during voice recording/recognition. /// Support for this line is optional for a mixer device. Many mixer devices provide only MIXERLINE_COMPONENTTYPE_DST_WAVEIN. /// /// /// /// MIXERLINE_COMPONENTTYPE_DST_WAVEIN /// /// Audio line is a destination that will be the final recording source for the waveform-audio input (ADC). This line typically /// provides some sort of gain or attenuation. This is the typical component type for the recording line of most audio cards for /// personal computers. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_ANALOG /// Audio line is an analog source (for example, analog output from a video-cassette tape). /// /// /// MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY /// /// Audio line is a source originating from the auxiliary audio line. This line type is intended as a source with gain or /// attenuation that can be routed to the MIXERLINE_COMPONENTTYPE_DST_SPEAKERS destination and/or recorded from the /// MIXERLINE_COMPONENTTYPE_DST_WAVEIN destination. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC /// /// Audio line is a source originating from the output of an internal audio CD. This component type is provided for audio cards /// that provide an audio source line intended to be connected to an audio CD (or CD-ROM playing an audio CD). /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_DIGITAL /// Audio line is a digital source (for example, digital output from a DAT or audio CD). /// /// /// MIXERLINE_COMPONENTTYPE_SRC_LINE /// /// Audio line is a line-level source (for example, line-level input from an external stereo) that can be used as an optional /// recording source. Because most audio cards for personal computers provide some sort of gain for the recording source line, /// the mixer device will use the MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY type. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE /// /// Audio line is a microphone recording source. Most audio cards for personal computers provide at least two types of recording /// sources: an auxiliary audio line and microphone input. A microphone audio line typically provides some sort of gain. Audio /// cards that use a single input for use with a microphone or auxiliary audio line should use the /// MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE component type. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER /// /// Audio line is a source originating from personal computer speaker. Several audio cards for personal computers provide the /// ability to mix what would typically be played on the internal speaker with the output of an audio card. Some audio cards /// support the ability to use this output as a recording source. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER /// /// Audio line is a source originating from the output of an internal synthesizer. Most audio cards for personal computers /// provide some sort of MIDI synthesizer. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE /// Audio line is a source originating from an incoming telephone line. /// /// /// MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED /// /// Audio line is a source that cannot be defined by one of the standard component types. A mixer device is required to use this /// component type for line component types that have not been defined by Microsoft Corporation. /// /// /// /// MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT /// /// Audio line is a source originating from the waveform-audio output digital-to-analog converter (DAC). Most audio cards for /// personal computers provide this component type as a source to the MIXERLINE_COMPONENTTYPE_DST_SPEAKERS destination. Some /// cards also allow this source to be routed to the MIXERLINE_COMPONENTTYPE_DST_WAVEIN destination. /// /// /// /// public MIXERLINE_COMPONENTTYPE dwComponentType; /// /// /// Maximum number of separate channels that can be manipulated independently for the audio line. The minimum value for this /// field is 1 because a line must have at least one channel. /// /// Most modern audio cards for personal computers are stereo devices; for them, the value of this member is 2. /// Channel 1 is assumed to be the left channel; channel 2 is assumed to be the right channel. /// /// A multichannel line might have one or more uniform controls (controls that affect all channels of a line uniformly) /// associated with it. /// /// public uint cChannels; /// /// Number of connections that are associated with the audio line. This member is used only for audio destination lines and /// specifies the number of audio source lines that are associated with it. This member is always zero for source lines and for /// destination lines that do not have any audio source lines associated with them. /// public uint cConnections; /// /// Number of controls associated with the audio line. This value can be zero. If no controls are associated with the line, the /// line is likely to be a source that might be selected in a MIXERCONTROL_CONTROLTYPE_MUX or MIXERCONTROL_CONTROLTYPE_MIXER but /// allows no manipulation of the signal. /// public uint cControls; /// /// Short string that describes the audio mixer line specified in the dwLineID member. This description should be /// appropriate as a concise label for the line. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MIXER_SHORT_NAME_CHARS)] public string szShortName; /// /// String that describes the audio mixer line specified in the dwLineID member. This description should be appropriate /// as a complete description for the line. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MIXER_LONG_NAME_CHARS)] public string szName; /// Target media information. public TARGET Target; /// Target media information. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct TARGET { /// /// /// Target media device type associated with the audio line described in the MIXERLINE structure. An application must /// ignore target information for media device types it does not use. The following values are defined: /// /// /// /// Name /// Description /// /// /// MIXERLINE_TARGETTYPE_AUX /// /// The audio line described by the MIXERLINE structure is strictly bound to the auxiliary device detailed in the remaining /// members of the Target structure member of the MIXERLINE structure. /// /// /// /// MIXERLINE_TARGETTYPE_MIDIIN /// /// The audio line described by the MIXERLINE structure is strictly bound to the MIDI input device detailed in the remaining /// members of the Target structure member of the MIXERLINE structure. /// /// /// /// MIXERLINE_TARGETTYPE_MIDIOUT /// /// The audio line described by the MIXERLINE structure is strictly bound to the MIDI output device detailed in the /// remaining members of the Target structure member of the MIXERLINE structure. /// /// /// /// MIXERLINE_TARGETTYPE_UNDEFINED /// /// The audio line described by the MIXERLINE structure is not strictly bound to a defined media type. All remaining Target /// structure members of the MIXERLINE structure should be ignored. An application cannot use the /// MIXERLINE_TARGETTYPE_UNDEFINED target type when calling the mixerGetLineInfo function with the /// MIXER_GETLINEINFOF_TARGETTYPE flag. /// /// /// /// MIXERLINE_TARGETTYPE_WAVEIN /// /// The audio line described by the MIXERLINE structure is strictly bound to the waveform-audio input device detailed in the /// remaining members of the Target structure member of the MIXERLINE structure. /// /// /// /// MIXERLINE_TARGETTYPE_WAVEOUT /// /// The audio line described by the MIXERLINE structure is strictly bound to the waveform-audio output device detailed in /// the remaining members of the Target structure member of the MIXERLINE structure. /// /// /// /// public uint dwType; /// /// Current device identifier of the target media device when the dwType member is a target type other than /// MIXERLINE_TARGETTYPE_UNDEFINED. This identifier is identical to the current media device index of the associated media /// device. When calling the mixerGetLineInfo function with the MIXER_GETLINEINFOF_TARGETTYPE flag, this member is ignored /// on input and will be returned to the caller by the audio mixer manager. /// public uint dwDeviceID; /// /// Manufacturer identifier of the target media device when the dwType member is a target type other than /// MIXERLINE_TARGETTYPE_UNDEFINED. This identifier is identical to the wMid member of the device-capabilities /// structure for the associated media. Manufacturer identifiers are defined in Manufacturer and Product Identifiers. /// public ushort wMid; /// /// Product identifier of the target media device when the dwType member is a target type other than /// MIXERLINE_TARGETTYPE_UNDEFINED. This identifier is identical to the wPid member of the device-capabilities /// structure for the associated media. Product identifiers are defined in Manufacturer and Product Identifiers. /// public ushort wPid; /// /// Driver version of the target media device when the dwType member is a target type other than /// MIXERLINE_TARGETTYPE_UNDEFINED. This version is identical to the vDriverVersion member of the device-capabilities /// structure for the associated media. /// public uint vDriverVersion; /// /// Product name of the target media device when the dwType member is a target type other than /// MIXERLINE_TARGETTYPE_UNDEFINED. This name is identical to the szPname member of the device-capabilities structure /// for the associated media. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MIXER_LONG_NAME_CHARS)] public string szPname; } } /// The MIXERLINECONTROLS structure contains information about the controls of an audio line. // https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/ns-mmeapi-mixerlinecontrols typedef struct tMIXERLINECONTROLS { DWORD // cbStruct; DWORD dwLineID; union { DWORD dwControlID; DWORD dwControlType; }; DWORD cControls; DWORD cbmxctrl; LPMIXERCONTROL // pamxctrl; } MIXERLINECONTROLS, *PMIXERLINECONTROLS, *LPMIXERLINECONTROLS; [PInvokeData("mmeapi.h", MSDNShortId = "NS:mmeapi.tMIXERLINECONTROLS")] [StructLayout(LayoutKind.Sequential)] public struct MIXERLINECONTROLS { /// /// Size, in bytes, of the MIXERLINECONTROLS structure. This member must be initialized before calling the /// mixerGetLineControls function. The size specified in this member must be large enough to contain the /// MIXERLINECONTROLS structure. When mixerGetLineControls returns, this member contains the actual size of the /// information returned. The returned information will not exceed the requested size, nor will it be smaller than the /// MIXERLINECONTROLS structure. /// public uint cbStruct; /// /// Line identifier for which controls are being queried. This member is not used if the MIXER_GETLINECONTROLSF_ONEBYID flag is /// specified for the mixerGetLineControls function, but the mixer device still returns this member in this case. The /// dwControlID and dwControlType members are not used when MIXER_GETLINECONTROLSF_ALL is specified. /// public uint dwLineID; /// /// Control identifier of the desired control. This member is used with the MIXER_GETLINECONTROLSF_ONEBYID flag for the /// mixerGetLineControls function to retrieve the control information of the specified control. Note that the dwLineID /// member of the MIXERLINECONTROLS structure will be returned by the mixer device and is not required as an input /// parameter. This member overlaps with the dwControlType member and cannot be used in conjunction with the /// MIXER_GETLINECONTROLSF_ONEBYTYPE query type. /// public uint dwControlID; /// /// Class of the desired Control Types. This member is used with the MIXER_GETLINECONTROLSF_ONEBYTYPE flag for the /// mixerGetLineControls function to retrieve the first control of the specified class on the line specified by the /// dwLineID member of the MIXERLINECONTROLS structure. This member overlaps with the dwControlID member /// and cannot be used in conjunction with the MIXER_GETLINECONTROLSF_ONEBYID query type. See dwControlType member description /// in MIXERCONTROL. /// public uint dwControlType; /// /// Number of MIXERCONTROL structure elements to retrieve. This member must be initialized by the application before calling the /// mixerGetLineControls function. This member can be 1 only if MIXER_GETLINECONTROLSF_ONEBYID or /// MIXER_GETLINECONTROLSF_ONEBYTYPE is specified or the value returned in the cControls member of the MIXERLINE /// structure returned for an audio line. This member cannot be zero. If an audio line specifies that it has no controls, /// mixerGetLineControls should not be called. /// public uint cControls; /// /// Size, in bytes, of a single MIXERCONTROL structure. The size specified in this member must be at least large enough to /// contain the base MIXERCONTROL structure. The total size, in bytes, required for the buffer pointed to by the /// pamxctrl member is the product of the cbmxctrl and cControls members of the MIXERLINECONTROLS structure. /// public uint cbmxctrl; /// /// Pointer to one or more MIXERCONTROL structures to receive the properties of the requested audio line controls. This member /// cannot be NULL and must be initialized before calling the mixerGetLineControls function. Each element of the array of /// controls must be at least large enough to contain a base MIXERCONTROL structure. The cbmxctrl member must /// specify the size, in bytes, of each element in this array. No initialization of the buffer pointed to by this member is /// required by the application. All members are filled in by the mixer device (including the cbStruct member of each /// MIXERCONTROL structure) upon returning successfully. /// public IntPtr pamxctrl; } }