#pragma warning disable IDE1006 // Naming Styles
using System;
using System.Runtime.InteropServices;
using Vanara.InteropServices;
using static Vanara.PInvoke.WinMm;
namespace Vanara.PInvoke
{
/// Items from the MsAcm32.dll
public static partial class MsAcm32
{
/// The FOURCC used in the fccComp field of the ACMDRIVERDETAILS structure. This is currently an unused field.
public static readonly uint ACMDRIVERDETAILS_FCCCOMP = 0;
///
/// The FOURCC used in the fccType field of the ACMDRIVERDETAILS structure to specify that this is an ACM codec designed for audio.
///
public static readonly uint ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC = MAKEFOURCC('a', 'u', 'd', 'c');
private const int ACMFILTERDETAILS_FILTER_CHARS = 128;
private const int ACMFILTERTAGDETAILS_FILTERTAG_CHARS = 48;
private const int ACMFORMATDETAILS_FORMAT_CHARS = 128;
private const int ACMFORMATTAGDETAILS_FORMATTAG_CHARS = 48;
private const string Lib_Msacm32 = "msacm32.dll";
///
/// The acmDriverEnumCallback function specifies a callback function used with the acmDriverEnum function. The
/// acmDriverEnumCallback name is a placeholder for an application-defined function name.
///
/// Handle to an ACM driver identifier.
/// Application-defined value specified in acmDriverEnum.
///
///
/// Driver-support flags specific to the driver specified by ACMDRIVERDETAILS structure. This parameter can be a combination of the
/// following values.
///
///
///
/// Value
/// Meaning
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags. For example, if a driver supports compression from WAVE_FORMAT_PCM
/// to WAVE_FORMAT_ADPCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag. For example, if a driver supports resampling of
/// WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_DISABLED
///
/// Driver has been disabled. An application must specify the ACM_DRIVERENUMF_DISABLED flag with acmDriverEnum to include disabled
/// drivers in the enumeration.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
///
///
/// The callback function must return TRUE to continue enumeration or FALSE to stop enumeration.
///
///
/// The acmDriverEnum function will return MMSYSERR_NOERROR (zero) if no ACM drivers are installed. Moreover, the callback function
/// will not be called.
///
/// The following functions should not be called from within the callback function: acmDriverAdd, acmDriverRemove, and acmDriverPriority.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmdriverenumcb ACMDRIVERENUMCB Acmdriverenumcb; BOOL
// Acmdriverenumcb( HACMDRIVERID hadid, DWORD_PTR dwInstance, DWORD fdwSupport ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMDRIVERENUMCB")]
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
public delegate bool ACMDRIVERENUMCB(HACMDRIVERID hadid, IntPtr dwInstance, ACMDRIVERDETAILS_SUPPORTF fdwSupport);
///
/// The acmDriverProc function specifies a callback function used with the ACM driver. The acmDriverProc name is a
/// placeholder for an application-defined function name. The actual name must be exported by including it in the module-definition
/// file of the executable or DLL file.
///
/// Identifier of the installable ACM driver.
///
/// Handle to the installable ACM driver. This parameter is a unique handle the ACM assigns to the driver.
///
/// ACM driver message.
/// Message parameter.
/// Message parameter.
/// Returns zero if successful or an error otherwise.
///
/// Applications should not call any system-defined functions from inside a callback function, except for PostMessage,
/// timeGetSystemTime, timeGetTime, timeSetEvent, timeKillEvent, midiOutShortMsg, midiOutLongMsg, and OutputDebugStr.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmdriverproc ACMDRIVERPROC Acmdriverproc; LRESULT
// Acmdriverproc( DWORD_PTR unnamedParam1, HACMDRIVERID unnamedParam2, UINT unnamedParam3, LPARAM unnamedParam4, LPARAM
// unnamedParam5 ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMDRIVERPROC")]
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr ACMDRIVERPROC(IntPtr unnamedParam1, HACMDRIVERID unnamedParam2, uint unnamedParam3, IntPtr unnamedParam4, IntPtr unnamedParam5);
///
/// The acmFilterChooseHookProc function specifies a user-defined function that hooks the acmFilterChoose dialog box.
///
/// Window handle for the dialog box.
/// Window message.
/// Message parameter.
/// Message parameter.
/// None
///
/// To customize the dialog box selections, a hook function can optionally process the MM_ACM_FILTERCHOOSE message.
/// You should use this function the same way as you use the Common Dialog hook functions for customizing common dialog boxes.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmfilterchoosehookproc ACMFILTERCHOOSEHOOKPROC
// Acmfilterchoosehookproc; UINT Acmfilterchoosehookproc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMFILTERCHOOSEHOOKPROC")]
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate uint ACMFILTERCHOOSEHOOKPROC(HWND hwnd, uint uMsg, IntPtr wParam, IntPtr lParam);
///
/// The acmFilterEnumCallback function specifies a callback function used with the acmFilterEnum function. The
/// acmFilterEnumCallback name is a placeholder for an application-defined function name.
///
/// Handle to the ACM driver identifier.
/// Pointer to an ACMFILTERDETAILS structure that contains the enumerated filter details for a filter tag.
/// Application-defined value specified in acmFilterEnum.
///
///
/// Driver-support flags specific to the driver identified by ACMDRIVERDETAILS structure, but they are specific to the filter that
/// is being enumerated. This parameter can be a combination of the following values and identifies which operations the driver
/// supports for the filter tag.
///
///
///
/// Value
/// Meaning
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions with the specified filter tag.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags while using the specified filter. For example, if a driver supports
/// compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM with the specified filter, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag while using the specified filter. For example,
/// if a driver supports resampling of WAVE_FORMAT_PCM with the specified filter, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both with the specified filter through a waveform-audio device. An application should
/// use the acmMetrics function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indices to get
/// the waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
/// The callback function must return TRUE to continue enumeration or FALSE to stop enumeration.
///
///
/// The acmFilterEnum function will return MMSYSERR_NOERROR (zero) if no filters are to be enumerated. Moreover, the callback
/// function will not be called.
///
///
/// The following functions should not be called from within the callback function: acmDriverAdd, acmDriverRemove, and acmDriverPriority.
///
///
/// Note
///
/// The msacm.h header defines ACMFILTERENUMCB as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmfilterenumcbw ACMFILTERENUMCBW Acmfilterenumcbw; BOOL
// Acmfilterenumcbw( HACMDRIVERID hadid, LPACMFILTERDETAILSW pafd, DWORD_PTR dwInstance, DWORD fdwSupport ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMFILTERENUMCBW")]
[UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public delegate bool ACMFILTERENUMCB(HACMDRIVERID hadid, in ACMFILTERDETAILS pafd, IntPtr dwInstance, ACMDRIVERDETAILS_SUPPORTF fdwSupport);
///
/// The acmFilterTagEnumCallback function specifies a callback function used with the acmFilterTagEnum function. The
/// acmFilterTagEnumCallback function name is a placeholder for an application-defined function name.
///
/// Handle to the ACM driver identifier.
/// Pointer to an ACMFILTERTAGDETAILS structure that contains the enumerated filter tag details.
/// Application-defined value specified in acmFilterTagEnum.
///
///
/// Driver-support flags specific to the driver identifier ACMDRIVERDETAILS structure. This parameter can be a combination of the
/// following values and identifies which operations the driver supports with the filter tag.
///
///
///
/// Value
/// Meaning
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions with the specified filter tag.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags while using the specified filter tag. For example, if a driver
/// supports compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM with the specified filter tag, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag while using the specified filter tag. For
/// example, if a driver supports resampling of WAVE_FORMAT_PCM with the specified filter tag, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both with the specified filter tag through a waveform-audio device. An application
/// should use the acmMetrics function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indices to
/// get the waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
/// The callback function must return TRUE to continue enumeration or FALSE to stop enumeration.
///
///
/// The acmFilterTagEnum function returns MMSYSERR_NOERROR (zero) if no filter tags are to be enumerated. Moreover, the
/// callback function will not be called.
///
/// The following functions should not be called from within the callback function: acmDriverAdd, acmDriverRemove, and acmDriverPriority.
///
/// Note
///
/// The msacm.h header defines ACMFILTERTAGENUMCB as an alias which automatically selects the ANSI or Unicode version of this
/// function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
/// not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions
/// for Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmfiltertagenumcbw ACMFILTERTAGENUMCBW Acmfiltertagenumcbw;
// BOOL Acmfiltertagenumcbw( HACMDRIVERID hadid, LPACMFILTERTAGDETAILSW paftd, DWORD_PTR dwInstance, DWORD fdwSupport ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMFILTERTAGENUMCBW")]
[UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public delegate bool ACMFILTERTAGENUMCB(HACMDRIVERID hadid, in ACMFILTERTAGDETAILS paftd, IntPtr dwInstance, ACMDRIVERDETAILS_SUPPORTF fdwSupport);
///
/// The acmFormatChooseHookProc function specifies a user-defined function that hooks the acmFormatChoose dialog box. The
/// acmFormatChooseHookProc name is a placeholder for an application-defined name.
///
/// Window handle for the dialog box.
/// Window message.
/// Message parameter.
/// Message parameter.
/// None
///
///
/// If the hook function processes one of the WM_CTLCOLOR messages, this function must return a handle of the brush that should be
/// used to paint the control background.
///
/// A hook function can optionally process the MM_ACM_FORMATCHOOSE message.
/// You should use this function the same way as you use the Common Dialog hook functions for customizing common dialog boxes.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmformatchoosehookproc ACMFORMATCHOOSEHOOKPROC
// Acmformatchoosehookproc; UINT Acmformatchoosehookproc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMFORMATCHOOSEHOOKPROC")]
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate uint ACMFORMATCHOOSEHOOKPROC(HWND hwnd, uint uMsg, IntPtr wParam, IntPtr lParam);
///
/// The acmFormatEnumCallback function specifies a callback function used with the acmFormatEnum function. The
/// acmFormatEnumCallback name is a placeholder for the application-defined function name.
///
/// Handle to the ACM driver identifier.
/// Pointer to an ACMFORMATDETAILS structure that contains the enumerated format details for a format tag.
/// Application-defined value specified in the acmFormatEnum function.
///
///
/// Driver support flags specific to the driver identified by ACMDRIVERDETAILS structure, but they are specific to the format that
/// is being enumerated. This parameter can be a combination of the following values and indicates which operations the driver
/// supports for the format tag.
///
///
///
/// Value
/// Meaning
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions with the specified filter tag.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags for the specified format. For example, if a driver supports
/// compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM with the specified format, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag while using the specified format. For example,
/// if a driver supports resampling of WAVE_FORMAT_PCM to the specified format, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes) with the specified format. For
/// example, if a driver supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both of the specified format tags through a waveform-audio device. An application
/// should use the acmMetrics function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indexes to
/// get the waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
/// The callback function must return TRUE to continue enumeration or FALSE to stop enumeration.
///
///
/// The acmFormatEnum function will return MMSYSERR_NOERROR (zero) if no formats are to be enumerated. Moreover, the callback
/// function will not be called.
///
/// The following functions should not be called from within the callback function: acmDriverAdd, acmDriverRemove, and acmDriverPriority.
///
/// Note
///
/// The msacm.h header defines ACMFORMATENUMCB as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmformatenumcbw ACMFORMATENUMCBW Acmformatenumcbw; BOOL
// Acmformatenumcbw( HACMDRIVERID hadid, LPACMFORMATDETAILSW pafd, DWORD_PTR dwInstance, DWORD fdwSupport ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMFORMATENUMCBW")]
[UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public delegate bool ACMFORMATENUMCB(HACMDRIVERID hadid, in ACMFORMATDETAILS pafd, IntPtr dwInstance, ACMDRIVERDETAILS_SUPPORTF fdwSupport);
///
/// The acmFormatTagEnumCallback function specifies a callback function used with the acmFormatTagEnum function. The
/// acmFormatTagEnumCallback name is a placeholder for an application-defined function name.
///
/// Handle to the ACM driver identifier.
/// Pointer to an ACMFORMATTAGDETAILS structure that contains the enumerated format tag details.
/// Application-defined value specified in the acmFormatTagEnum function.
///
///
/// Driver-support flags specific to the format tag. These flags are identical to the ACMDRIVERDETAILS structure. This parameter can
/// be a combination of the following values and indicates which operations the driver supports with the format tag.
///
///
///
/// Value
/// Meaning
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions with the specified filter tag.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags where one of the tags is the specified format tag. For example, if
/// a driver supports compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the specified format tag. For example, if a driver supports
/// resampling of WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on the specified format tag, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both of the specified format tag through a waveform-audio device. An application
/// should use acmMetrics with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indexes to get the
/// waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
/// The callback function must return TRUE to continue enumeration or FALSE to stop enumeration.
///
///
/// The acmFormatTagEnum function will return MMSYSERR_NOERROR (zero) if no format tags are to be enumerated. Moreover, the callback
/// function will not be called.
///
/// The following functions should not be called from within the callback function: acmDriverAdd, acmDriverRemove, and acmDriverPriority.
///
/// Note
///
/// The msacm.h header defines ACMFORMATTAGENUMCB as an alias which automatically selects the ANSI or Unicode version of this
/// function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
/// not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions
/// for Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nc-msacm-acmformattagenumcbw ACMFORMATTAGENUMCBW Acmformattagenumcbw;
// BOOL Acmformattagenumcbw( HACMDRIVERID hadid, LPACMFORMATTAGDETAILSW paftd, DWORD_PTR dwInstance, DWORD fdwSupport ) {...}
[PInvokeData("msacm.h", MSDNShortId = "NC:msacm.ACMFORMATTAGENUMCBW")]
[UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public delegate bool ACMFORMATTAGENUMCB(HACMDRIVERID hadid, in ACMFORMATTAGDETAILS paftd, IntPtr dwInstance, uint fdwSupport);
/// Flags for adding ACM drivers.
[Flags]
public enum ACM_DRIVERADDF : uint
{
///
/// The lParam parameter is a registry value name in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32.
/// The value identifies a DLL that implements an ACM codec. Applications can use this flag if new registry entries are created
/// after the application has already started using the ACM.
///
ACM_DRIVERADDF_NAME = 0x00000001,
///
/// The lParam parameter is a driver function address conforming to the acmDriverProc prototype. The function may reside in
/// either an executable or DLL file.
///
ACM_DRIVERADDF_FUNCTION = 0x00000003,
///
/// The lParam parameter is a handle of a notification window that receives messages when changes to global driver priorities
/// and states are made. The window message to receive is defined by the application and must be passed in dwPriority. The
/// wParam and lParam parameters passed with the window message are reserved for future use and should be ignored.
/// ACM_DRIVERADDF_GLOBAL cannot be specified in conjunction with this flag. For more information about driver priorities, see
/// the description for the acmDriverPriority function.
///
ACM_DRIVERADDF_NOTIFYHWND = 0x00000004,
///
/// The ACM automatically gives a local driver higher priority than a global driver when searching for a driver to satisfy a
/// function call. For more information, see Adding Drivers Within an Application.
///
ACM_DRIVERADDF_LOCAL = 0x00000000,
///
/// Provided for compatibility with 16-bit applications. For the Win32 API, ACM drivers added by the acmDriverAdd function can
/// be used only by the application that added the driver. This is true whether or not ACM_DRIVERADDF_GLOBAL is specified. For
/// more information, see Adding Drivers Within an Application.
///
ACM_DRIVERADDF_GLOBAL = 0x00000008,
}
/// Flags for enumerating ACM drivers.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverEnum")]
[Flags]
public enum ACM_DRIVERENUMF : uint
{
/// Only global drivers should be included in the enumeration.
ACM_DRIVERENUMF_NOLOCAL = 0x40000000,
///
/// Disabled ACM drivers should be included in the enumeration. Drivers can be disabled by the user through the Control Panel or
/// by an application using the acmDriverPriority function. If a driver is disabled, the fdwSupport parameter to the callback
/// function will have the ACMDRIVERDETAILS_SUPPORTF_DISABLED flag set.
///
ACM_DRIVERENUMF_DISABLED = 0x80000000,
}
/// Flags for setting priorities of ACM drivers.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverPriority")]
[Flags]
public enum ACM_DRIVERPRIORITYF : uint
{
/// ACM driver should be enabled if it is currently disabled. Enabling an enabled driver does nothing.
ACM_DRIVERPRIORITYF_ENABLE = 0x00000001,
/// ACM driver should be disabled if it is currently enabled. Disabling a disabled driver does nothing.
ACM_DRIVERPRIORITYF_DISABLE = 0x00000002,
///
/// Change notification broadcasts should be deferred. An application must reenable notification broadcasts as soon as possible
/// with the ACM_DRIVERPRIORITYF_END flag. Note that hadid must be NULL, dwPriority must be zero, and only the
/// ACM_DRIVERPRIORITYF_BEGIN flag can be set.
///
ACM_DRIVERPRIORITYF_BEGIN = 0x00010000,
///
/// Calling task wants to reenable change notification broadcasts. An application must call acmDriverPriority with
/// ACM_DRIVERPRIORITYF_END for each successful call with the ACM_DRIVERPRIORITYF_BEGIN flag. Note that hadid must be NULL,
/// dwPriority must be zero, and only the ACM_DRIVERPRIORITYF_END flag can be set.
///
ACM_DRIVERPRIORITYF_END = 0x00020000,
}
/// Flags for getting the details.
[Flags]
public enum ACM_FILTERDETAILSF : uint
{
///
/// A filter index for the filter tag was given in the dwFilterIndex member of the ACMFILTERDETAILS structure. The filter
/// details will be returned in the structure defined by pafd. The index ranges from zero to one less than the cStandardFilters
/// member returned in the ACMFILTERTAGDETAILS structure for a filter tag. An application must specify a driver handle for had
/// when retrieving filter details with this flag. For information about what members should be initialized before calling this
/// function, see the ACMFILTERDETAILS structure.
///
ACM_FILTERDETAILSF_INDEX = 0x00000000,
///
/// A WAVEFILTER structure pointed to by the pwfltr member of the ACMFILTERDETAILS structure was given and the remaining details
/// should be returned. The dwFilterTag member of the ACMFILTERDETAILS structure must be initialized to the same filter tag
/// pwfltr specifies. This query type can be used to get a string description of an arbitrary filter structure. If an
/// application specifies an ACM driver handle for had, details on the filter will be returned for that driver. If an
/// application specifies NULL for had, the ACM finds the first acceptable driver to return the details.
///
ACM_FILTERDETAILSF_FILTER = 0x00000001,
}
/// Optional flags for restricting the type of filters listed in the dialog box.
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFILTERCHOOSE")]
[Flags]
public enum ACM_FILTERENUMF : uint
{
///
/// The dwFilterTag member of the WAVEFILTER structure pointed to by the pwfltrEnum member is valid. The enumerator will only
/// enumerate a filter that conforms to this attribute.
///
ACM_FILTERENUMF_DWFILTERTAG = 0x00010000
}
/// Flags for getting the details.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFilterTagDetailsW")]
[Flags]
public enum ACM_FILTERTAGDETAILSF : uint
{
///
ACM_FILTERTAGDETAILSF_INDEX = 0x00000000,
///
ACM_FILTERTAGDETAILSF_FILTERTAG = 0x00000001,
///
ACM_FILTERTAGDETAILSF_LARGESTSIZE = 0x00000002,
}
/// Flags for getting the waveform-audio format tag details.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatDetailsW")]
[Flags]
public enum ACM_FORMATDETAILSF : uint
{
///
/// A format index for the format tag was given in the dwFormatIndex member of the ACMFORMATDETAILS structure. The format
/// details will be returned in the structure defined by pafd. The index ranges from zero to one less than the cStandardFormats
/// member returned in the ACMFORMATTAGDETAILS structure for a format tag. An application must specify a driver handle for had
/// when retrieving format details with this flag. For information about which members should be initialized before calling this
/// function, see the ACMFORMATDETAILS structure.
///
ACM_FORMATDETAILSF_INDEX = 0x00000000,
///
/// ACMFORMATDETAILS structure was given and the remaining details should be returned. The dwFormatTag member of the
/// ACMFORMATDETAILS structure must be initialized to the same format tag as pwfx specifies. This query type can be used to get
/// a string description of an arbitrary format structure. If an application specifies an ACM driver handle for had , details on
/// the format will be returned for that driver. If an application specifies NULL for had , the ACM finds the first acceptable
/// driver to return the details.
///
ACM_FORMATDETAILSF_FORMAT = 0x00000001,
}
/// Optional flags for restricting the type of formats listed in the dialog box.
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFORMATCHOOSE")]
[Flags]
public enum ACM_FORMATENUMF : uint
{
///
/// The wFormatTag member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will
/// enumerate only a format that conforms to this attribute.
///
ACM_FORMATENUMF_WFORMATTAG = 0x00010000,
///
/// The nChannels member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will enumerate
/// only a format that conforms to this attribute.
///
ACM_FORMATENUMF_NCHANNELS = 0x00020000,
///
/// The nSamplesPerSec member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will
/// enumerate only a format that conforms to this attribute.
///
ACM_FORMATENUMF_NSAMPLESPERSEC = 0x00040000,
///
/// The wBitsPerSample member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will
/// enumerate only a format that conforms to this attribute.
///
ACM_FORMATENUMF_WBITSPERSAMPLE = 0x00080000,
///
/// The WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will enumerate only destination
/// formats that can be converted from the given pwfxEnum format.
///
ACM_FORMATENUMF_CONVERT = 0x00100000,
///
/// The WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will enumerate all suggested
/// destination formats for the given pwfxEnum format.
///
ACM_FORMATENUMF_SUGGEST = 0x00200000,
///
/// The enumerator should enumerate only formats that are supported in hardware by one or more of the installed waveform-audio
/// devices. This flag provides a way for an application to choose only formats native to an installed waveform-audio device.
///
ACM_FORMATENUMF_HARDWARE = 0x00400000,
/// The enumerator should enumerate only formats that are supported for input (recording).
ACM_FORMATENUMF_INPUT = 0x00800000,
/// The enumerator should enumerate only formats that are supported for output (playback).
ACM_FORMATENUMF_OUTPUT = 0x01000000,
}
/// Flags for matching the desired destination format.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatSuggest")]
[Flags]
public enum ACM_FORMATSUGGESTF : uint
{
///
/// The wFormatTag member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that
/// can suggest a destination format matching wFormatTag or fail.
///
ACM_FORMATSUGGESTF_WFORMATTAG = 0x00010000,
///
/// The nChannels member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that
/// can suggest a destination format matching nChannels or fail.
///
ACM_FORMATSUGGESTF_NCHANNELS = 0x00020000,
///
/// The nSamplesPerSec member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers
/// that can suggest a destination format matching nSamplesPerSec or fail.
///
ACM_FORMATSUGGESTF_NSAMPLESPERSEC = 0x00040000,
///
/// The wBitsPerSample member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers
/// that can suggest a destination format matching wBitsPerSample or fail.
///
ACM_FORMATSUGGESTF_WBITSPERSAMPLE = 0x00080000,
}
/// Flags for getting the details.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatTagDetailsW")]
[Flags]
public enum ACM_FORMATTAGDETAILSF : uint
{
///
/// ACMDRIVERDETAILS structure for an ACM driver. An application must specify a driver handle forhadwhen retrieving format tag
/// details with this flag.
///
ACM_FORMATTAGDETAILSF_INDEX = 0x00000000,
///
/// ACMFORMATTAGDETAILS structure. The format tag details will be returned in the structure pointed to bypaftd. If an
/// application specifies an ACM driver handle forhad, details on the format tag will be returned for that driver. If an
/// application specifiesNULLforhad, the ACM finds the first acceptable driver to return the details.
///
ACM_FORMATTAGDETAILSF_FORMATTAG = 0x00000001,
///
/// ACMFORMATTAGDETAILS structure must either be WAVE_FORMAT_UNKNOWN or the format tag to find the largest size for. If an
/// application specifies an ACM driver handle forhad, details on the largest format tag will be returned for that driver. If an
/// application specifiesNULLforhad, the ACM finds an acceptable driver with the largest format tag requested to return the details.
///
ACM_FORMATTAGDETAILSF_LARGESTSIZE = 0x00000002,
}
/// Metric index to be returned in pMetric.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmMetrics")]
public enum ACM_METRIC
{
///
/// Returned value is the total number of enabled global ACM drivers (of all support types) in the system. The hao parameter
/// must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_DRIVERS = 1,
///
/// Returned value is the number of global ACM compressor or decompressor drivers in the system. The hao parameter must be NULL
/// for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_CODECS,
///
/// Returned value is the number of global ACM converter drivers in the system. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_CONVERTERS,
///
/// Returned value is the number of global ACM filter drivers in the system. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_FILTERS,
///
/// Returned value is the total number of global disabled ACM drivers (of all support types) in the system. The hao parameter
/// must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value. The sum
/// of the ACM_METRIC_COUNT_DRIVERS and ACM_METRIC_COUNT_DISABLED metric indices is the total number of globally installed ACM drivers.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_DISABLED,
///
/// Returned value is the number of global ACM hardware drivers in the system. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_HARDWARE,
///
/// Returned value is the total number of enabled local ACM drivers (of all support types) for the calling task. The hao
/// parameter must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_LOCAL_DRIVERS = 20,
///
/// Returned value is the number of local ACM compressor drivers, ACM decompressor drivers, or both for the calling task. The
/// hao parameter must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_LOCAL_CODECS,
///
/// Returned value is the number of local ACM converter drivers for the calling task. The hao parameter must be NULL for this
/// metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_LOCAL_CONVERTERS,
///
/// Returned value is the number of local ACM filter drivers for the calling task. The hao parameter must be NULL for this
/// metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_LOCAL_FILTERS,
///
/// Returned value is the total number of local disabled ACM drivers, of all support types, for the calling task. The hao
/// parameter must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
/// The sum of the ACM_METRIC_COUNT_LOCAL_DRIVERS and ACM_METRIC_COUNT_LOCAL_DISABLED metric indices is the total number of
/// locally installed ACM drivers.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_COUNT_LOCAL_DISABLED,
///
/// Returned value is the waveform-audio input device identifier associated with the specified driver. The hao parameter must be
/// a valid ACM driver identifier of the HACMDRIVERID data type that supports the ACMDRIVERDETAILS_SUPPORTF_HARDWARE flag. If no
/// waveform-audio input device is associated with the driver, MMSYSERR_NOTSUPPORTED is returned. The pMetric parameter must
/// point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_HARDWARE_WAVE_INPUT = 30,
///
/// Returned value is the waveform-audio output device identifier associated with the specified driver. The hao parameter must
/// be a valid ACM driver identifier of the HACMDRIVERID data type that supports the ACMDRIVERDETAILS_SUPPORTF_HARDWARE flag. If
/// no waveform-audio output device is associated with the driver, MMSYSERR_NOTSUPPORTED is returned. The pMetric parameter must
/// point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_HARDWARE_WAVE_OUTPUT,
///
/// Returned value is the size of the largest WAVEFORMATEX structure. If hao is NULL, the return value is the largest
/// WAVEFORMATEX structure in the system. If hao identifies an open instance of an ACM driver of the HACMDRIVER data type or an
/// ACM driver identifier of the HACMDRIVERID data type, the largest WAVEFORMATEX structure for that driver is returned. The
/// pMetric parameter must point to a buffer of a size equal to a DWORD value. This metric is not allowed for an ACM stream
/// handle of the HACMSTREAM data type.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_MAX_SIZE_FORMAT = 50,
///
/// Returned value is the size of the largest WAVEFILTER structure. If hao is NULL, the return value is the largest WAVEFILTER
/// structure in the system. If hao identifies an open instance of an ACM driver of the HACMDRIVER data type or an ACM driver
/// identifier of the HACMDRIVERID data type, the largest WAVEFILTER structure for that driver is returned. The pMetric
/// parameter must point to a buffer of a size equal to a DWORD value. This metric is not allowed for an ACM stream handle of
/// the HACMSTREAM data type.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_MAX_SIZE_FILTER,
///
/// Returned value is the fdwSupport flags for the specified driver. The hao parameter must be a valid ACM driver identifier of
/// the HACMDRIVERID data type. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_DRIVER_SUPPORT = 100,
///
/// Returned value is the current priority for the specified driver. The hao parameter must be a valid ACM driver identifier of
/// the HACMDRIVERID data type. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
[CorrespondingType(typeof(uint))]
ACM_METRIC_DRIVER_PRIORITY,
}
/// Flags for doing the conversion.
[Flags]
public enum ACM_STREAMCONVERTF : uint
{
///
/// Only integral numbers of blocks will be converted. Converted data will end on block-aligned boundaries. An application
/// should use this flag for all conversions on a stream until there is not enough source data to convert to a block-aligned
/// destination. In this case, the last conversion should be specified without this flag.
///
ACM_STREAMCONVERTF_BLOCKALIGN = 0x00000004,
///
/// ACM conversion stream should reinitialize its instance data. For example, if a conversion stream holds instance data, such
/// as delta or predictor information, this flag will restore the stream to starting defaults. This flag can be specified with
/// the ACM_STREAMCONVERTF_END flag.
///
ACM_STREAMCONVERTF_START = 0x00000010,
///
/// ACM conversion stream should begin returning pending instance data. For example, if a conversion stream holds instance data,
/// such as the end of an echo filter operation, this flag will cause the stream to start returning this remaining data with
/// optional source data. This flag can be specified with the ACM_STREAMCONVERTF_START flag.
///
ACM_STREAMCONVERTF_END = 0x00000020,
}
///
[Flags]
public enum ACM_STREAMOPENF : uint
{
///
/// ACM will be queried to determine whether it supports the given conversion. A conversion stream will not be opened, and no
/// handle will be returned in the phas parameter.
///
ACM_STREAMOPENF_QUERY = 0x00000001,
/// ACMSTREAMHEADER structure for the ACMSTREAMHEADER_STATUSF_DONE flag.
ACM_STREAMOPENF_ASYNC = 0x00000002,
///
/// ACM will not consider time constraints when converting the data. By default, the driver will attempt to convert the data in
/// real time. For some formats, specifying this flag might improve the audio quality or other characteristics.
///
ACM_STREAMOPENF_NONREALTIME = 0x00000004,
/// The dwCallback parameter is a window handle.
CALLBACK_WINDOW = 0x00010000,
/// The dwCallback parameter is a callback procedure address.
CALLBACK_FUNCTION = 0x00030000,
/// The dwCallback parameter is an event handle.
CALLBACK_EVENT = 0x00050000,
}
/// Flags for the stream size query.
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamSize")]
[Flags]
public enum ACM_STREAMSIZEF : uint
{
///
/// The cbInput parameter contains the size of the source buffer. The pdwOutputBytes parameter will receive the recommended
/// destination buffer size, in bytes.
///
ACM_STREAMSIZEF_SOURCE = 0x00000000,
///
/// The cbInput parameter contains the size of the destination buffer. The pdwOutputBytes parameter will receive the recommended
/// source buffer size, in bytes.
///
ACM_STREAMSIZEF_DESTINATION = 0x00000001,
}
/// Support flags for the driver.
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMDRIVERDETAILS")]
[Flags]
public enum ACMDRIVERDETAILS_SUPPORTF : uint
{
///
/// Driver supports conversion between two different format tags. For example, if a driver supports compression from
/// WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, this flag is set.
///
ACMDRIVERDETAILS_SUPPORTF_CODEC = 0x00000001,
///
/// Driver supports conversion between two different formats of the same format tag. For example, if a driver supports
/// resampling of WAVE_FORMAT_PCM, this flag is set.
///
ACMDRIVERDETAILS_SUPPORTF_CONVERTER = 0x00000002,
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
ACMDRIVERDETAILS_SUPPORTF_FILTER = 0x00000004,
///
/// Driver supports hardware input, output, or both through a waveform-audio device. An application should use the acmMetrics
/// function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indexes to get the
/// waveform-audio device identifiers associated with the supporting ACM driver.
///
ACMDRIVERDETAILS_SUPPORTF_HARDWARE = 0x00000008,
/// Driver supports asynchronous conversions.
ACMDRIVERDETAILS_SUPPORTF_ASYNC = 0x00000010,
/// The driver has been installed locally with respect to the current task.
ACMDRIVERDETAILS_SUPPORTF_LOCAL = 0x40000000,
///
/// Driver has been disabled. This flag is set by the ACM for a driver when it has been disabled for any of a number of reasons.
/// Disabled drivers cannot be opened and can be used only under very limited circumstances.
///
ACMDRIVERDETAILS_SUPPORTF_DISABLED = 0x80000000,
}
/// Optional style flags for the acmFilterChoose function.
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFILTERCHOOSE")]
[Flags]
public enum ACMFILTERCHOOSE_STYLEF : uint
{
///
/// A help button will appear in the dialog box. To use a custom Help file, an application must register the ACMHELPMSGSTRING
/// value with the RegisterWindowMessage function. When the user presses the help button, the registered message is posted to
/// the owner.
///
ACMFILTERCHOOSE_STYLEF_SHOWHELP = 0x00000004,
///
/// Enables the hook function specified in the pfnHook member. An application can use hook functions for a variety of
/// customizations, including answering the MM_ACM_FILTERCHOOSE message.
///
ACMFILTERCHOOSE_STYLEF_ENABLEHOOK = 0x00000008,
/// Causes the ACM to create the dialog box template identified by the hInstance and pszTemplateName members.
ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE = 0x00000010,
///
/// The hInstance member identifies a data block that contains a preloaded dialog box template. If this flag is specified, the
/// ACM ignores the pszTemplateName member.
///
ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE = 0x00000020,
///
/// The buffer pointed to by pwfltr contains a valid WAVEFILTER structure that the dialog box will use as the initial selection.
///
ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT = 0x00000040,
///
/// Context-sensitive help will be available in the dialog box. To use this feature, an application must register the
/// ACMHELPMSGCONTEXTMENU and ACMHELPMSGCONTEXTHELP constants, using the RegisterWindowMessage function. When the user invokes
/// help, the registered message will be posted to the owning window. The message will contain the wParam and lParam parameters
/// from the original WM_CONTEXTMENU or WM_CONTEXTHELP message.
///
ACMFILTERCHOOSE_STYLEF_CONTEXTHELP = 0x00000080,
}
/// Optional style flags for the acmFormatChoose function.
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFORMATCHOOSE")]
[Flags]
public enum ACMFORMATCHOOSE_STYLEF : uint
{
///
/// A help button will appear in the dialog box. To use a custom Help file, an application must register the ACMHELPMSGSTRING
/// constant with the RegisterWindowMessage function. When the user presses the help button, the registered message will be
/// posted to the owner.
///
ACMFORMATCHOOSE_STYLEF_SHOWHELP = 0x00000004,
///
/// Enables the hook function pointed to by the pfnHook member. An application can use hook functions for a variety of
/// customizations, including answering the MM_ACM_FORMATCHOOSE message.
///
ACMFORMATCHOOSE_STYLEF_ENABLEHOOK = 0x00000008,
/// Causes the ACM to create the dialog box template identified by hInstance and pszTemplateName.
ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE = 0x00000010,
///
/// The hInstance member identifies a data block that contains a preloaded dialog box template. If this flag is specified, the
/// ACM ignores the pszTemplateName member.
///
ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE = 0x00000020,
///
/// The buffer pointed to by pwfx contains a valid WAVEFORMATEX structure that the dialog box will use as the initial selection.
///
ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT = 0x00000040,
///
/// Context-sensitive help will be available in the dialog box. To use this feature, an application must register the
/// ACMHELPMSGCONTEXTMENU and ACMHELPMSGCONTEXTHELP constants, using the RegisterWindowMessage function. When the user invokes
/// help, the registered message will be posted to the owning window. The message will contain the wParam and lParam parameters
/// from the original WM_CONTEXTMENU or WM_CONTEXTHELP message.
///
ACMFORMATCHOOSE_STYLEF_CONTEXTHELP = 0x00000080,
}
/// Flags giving information about the conversion buffers.
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMSTREAMHEADER")]
[Flags]
public enum ACMSTREAMHEADER_STATUSF : uint
{
///
/// Set by the ACM or driver to indicate that it is finished with the conversion and is returning the buffers to the application.
///
ACMSTREAMHEADER_STATUSF_DONE = 0x00010000,
/// Set by the ACM to indicate that the buffers have been prepared by using the acmStreamPrepareHeader function.
ACMSTREAMHEADER_STATUSF_PREPARED = 0x00020000,
/// Set by the ACM or driver to indicate that the buffers are queued for conversion.
ACMSTREAMHEADER_STATUSF_INQUEUE = 0x00100000,
}
///
/// The acmDriverAdd function adds a driver to the list of available ACM drivers. The driver type and location are dependent
/// on the flags used to add ACM drivers. After a driver is successfully added, the driver entry function will receive ACM driver messages.
///
///
/// Pointer to the buffer that receives a handle identifying the installed driver. This handle is used to identify the driver in
/// calls to other ACM functions.
///
///
/// Handle to the instance of the module whose executable or dynamic-link library (DLL) contains the driver entry function.
///
/// Driver function address or a notification window handle, depending on the fdwAdd flags.
///
/// Window message to send for notification broadcasts. This parameter is used only with the ACM_DRIVERADDF_NOTIFYHWND flag. All
/// other flags require this member to be set to zero.
///
///
/// Flags for adding ACM drivers. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_DRIVERADDF_FUNCTION
///
/// The lParam parameter is a driver function address conforming to the acmDriverProc prototype. The function may reside in either
/// an executable or DLL file.
///
///
/// -
/// ACM_DRIVERADDF_GLOBAL
///
/// Provided for compatibility with 16-bit applications. For the Win32 API, ACM drivers added by the acmDriverAdd function can be
/// used only by the application that added the driver. This is true whether or not ACM_DRIVERADDF_GLOBAL is specified. For more
/// information, see Adding Drivers Within an Application.
///
///
/// -
/// ACM_DRIVERADDF_LOCAL
///
/// The ACM automatically gives a local driver higher priority than a global driver when searching for a driver to satisfy a
/// function call. For more information, see Adding Drivers Within an Application.
///
///
/// -
/// ACM_DRIVERADDF_NAME
///
/// The lParam parameter is a registry value name in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Drivers32. The
/// value identifies a DLL that implements an ACM codec. Applications can use this flag if new registry entries are created after
/// the application has already started using the ACM.
///
///
/// -
/// ACM_DRIVERADDF_NOTIFYHWND
///
/// The lParam parameter is a handle of a notification window that receives messages when changes to global driver priorities and
/// states are made. The window message to receive is defined by the application and must be passed in dwPriority. The wParam and
/// lParam parameters passed with the window message are reserved for future use and should be ignored. ACM_DRIVERADDF_GLOBAL cannot
/// be specified in conjunction with this flag. For more information about driver priorities, see the description for the
/// acmDriverPriority function.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOMEM
/// The system is unable to allocate resources.
///
///
///
///
/// Note
///
/// The msacm.h header defines acmDriverAdd as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriveraddw MMRESULT ACMAPI acmDriverAddW( LPHACMDRIVERID
// phadid, HINSTANCE hinstModule, LPARAM lParam, DWORD dwPriority, DWORD fdwAdd );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverAddW")]
public static extern MMRESULT acmDriverAdd(out HACMDRIVERID phadid, HINSTANCE hinstModule, IntPtr lParam, uint dwPriority, ACM_DRIVERADDF fdwAdd);
///
/// The acmDriverClose function closes a previously opened ACM driver instance. If the function is successful, the handle is invalidated.
///
/// Handle to the open driver instance to be closed.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_BUSY
/// The driver is in use and cannot be closed.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriverclose MMRESULT ACMAPI acmDriverClose( HACMDRIVER had,
// DWORD fdwClose );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverClose")]
public static extern MMRESULT acmDriverClose(HACMDRIVER had, uint fdwClose = 0);
/// The acmDriverDetails function queries a specified ACM driver to determine its capabilities.
/// Handle to the driver identifier of an installed ACM driver. Disabled drivers can be queried for details.
///
/// Pointer to an ACMDRIVERDETAILS structure that will receive the driver details. The cbStruct member must be initialized to
/// the size, in bytes, of the structure.
///
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMDRIVERDETAILS as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriverdetailsw MMRESULT ACMAPI acmDriverDetailsW(
// HACMDRIVERID hadid, LPACMDRIVERDETAILSW padd, DWORD fdwDetails );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverDetailsW")]
public static extern MMRESULT acmDriverDetails(HACMDRIVERID hadid, ACMDRIVERDETAILS padd, uint fdwDetails = 0);
///
/// The acmDriverEnum function enumerates the available ACM drivers, continuing until there are no more drivers or the
/// callback function returns FALSE.
///
/// Procedure instance address of the application-defined callback function.
///
/// A 64-bit (DWORD_PTR) or 32-bit (DWORD) application-defined value that is passed to the callback function along with ACM driver information.
///
///
/// Flags for enumerating ACM drivers. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_DRIVERENUMF_DISABLED
///
/// Disabled ACM drivers should be included in the enumeration. Drivers can be disabled by the user through the Control Panel or by
/// an application using the acmDriverPriority function. If a driver is disabled, the fdwSupport parameter to the callback function
/// will have the ACMDRIVERDETAILS_SUPPORTF_DISABLED flag set.
///
///
/// -
/// ACM_DRIVERENUMF_NOLOCAL
/// Only global drivers should be included in the enumeration.
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
/// The acmDriverEnum function will return MMSYSERR_NOERROR (zero) if no ACM drivers are installed. Moreover, the callback
/// function will not be called.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriverenum MMRESULT ACMAPI acmDriverEnum( ACMDRIVERENUMCB
// fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverEnum")]
public static extern MMRESULT acmDriverEnum(ACMDRIVERENUMCB fnCallback, IntPtr dwInstance, ACM_DRIVERENUMF fdwEnum);
///
/// The acmDriverID function returns the handle of an ACM driver identifier associated with an open ACM driver instance or
/// stream handle.
///
///
/// Handle to the open driver instance or stream handle. This is the handle of an ACM object, such as HACMDRIVER or HACMSTREAM.
///
/// Pointer to a buffer that receives a handle identifying the installed driver that is associated with hao.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriverid MMRESULT ACMAPI acmDriverID( HACMOBJ hao,
// LPHACMDRIVERID phadid, DWORD fdwDriverID );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverID")]
public static extern MMRESULT acmDriverID(HACMOBJ hao, out HACMDRIVERID phadid, uint fdwDriverID = 0);
/// The acmDriverMessage function sends a user-defined message to a given ACM driver instance.
/// Handle to the ACM driver instance to which the message will be sent.
///
/// Message that the ACM driver must process. This message must be in the ACMDM_USER message range (above or equal to ACMDM_USER and
/// less than ACMDM_RESERVED_LOW). The exceptions to this restriction are the ACMDM_DRIVER_ABOUT, DRV_QUERYCONFIGURE, and
/// DRV_CONFIGURE messages.
///
/// Message parameter.
/// Message parameter.
///
///
/// The return value is specific to the user-defined ACM driver message specified by the uMsg parameter. However, possible error
/// values include the following.
///
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// The uMsg parameter is not in the ACMDM_USER range.
///
/// -
/// MMSYSERR_NOTSUPPORTED
/// The ACM driver did not process the message.
///
///
///
///
///
/// To display a custom About dialog box from an ACM driver, an application must send the ACMDM_DRIVER_ABOUT message to the driver.
/// The lParam1 parameter should be the handle of the owner window for the custom About dialog box, and lParam2 must be set to zero.
/// If the driver does not support a custom About dialog box, MMSYSERR_NOTSUPPORTED will be returned and it is the application's
/// responsibility to display its own dialog box. For example, the Control Panel Sound Mapper option will display a default About
/// dialog box based on the ACMDRIVERDETAILS structure when an ACM driver returns MMSYSERR_NOTSUPPORTED. An application can
/// query a driver for custom About dialog box support without the dialog box being displayed by setting lParam1 to –1L. If the
/// driver supports a custom About dialog box, MMSYSERR_NOERROR will be returned. Otherwise, the return value is MMSYSERR_NOTSUPPORTED.
///
///
/// User-defined messages must be sent only to an ACM driver that specifically supports the messages. The caller should verify that
/// the ACM driver is the correct driver by retrieving the driver details and checking the wMid, wPid, and
/// vdwDriver members of the ACMDRIVERDETAILS structure.
///
/// Never send user-defined messages to an unknown ACM driver.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdrivermessage LRESULT ACMAPI acmDriverMessage( HACMDRIVER
// had, UINT uMsg, LPARAM lParam1, LPARAM lParam2 );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverMessage")]
public static extern IntPtr acmDriverMessage(HACMDRIVER had, uint uMsg, IntPtr lParam1, IntPtr lParam2);
///
/// The acmDriverOpen function opens the specified ACM driver and returns a driver instance handle that can be used to
/// communicate with the driver.
///
///
/// Pointer to a buffer that receives the new driver instance handle that can be used to communicate with the driver.
///
/// Handle to the driver identifier of an installed and enabled ACM driver.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOMEM
/// The system is unable to allocate resources.
///
/// -
/// MMSYSERR_NOTENABLED
/// The driver is not enabled.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriveropen MMRESULT ACMAPI acmDriverOpen( LPHACMDRIVER phad,
// HACMDRIVERID hadid, DWORD fdwOpen );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverOpen")]
public static extern MMRESULT acmDriverOpen(out SafeHACMDRIVER phad, HACMDRIVERID hadid, uint fdwOpen = 0);
/// The acmDriverPriority function modifies the priority and state of an ACM driver.
///
/// Handle to the driver identifier of an installed ACM driver. If the ACM_DRIVERPRIORITYF_BEGIN and ACM_DRIVERPRIORITYF_END flags
/// are specified, this parameter must be NULL.
///
///
/// New priority for a global ACM driver identifier. A zero value specifies that the priority of the driver identifier should remain
/// unchanged. A value of 1 specifies that the driver should be placed as the highest search priority driver. A value of –1
/// specifies that the driver should be placed as the lowest search priority driver. Priorities are used only for global drivers.
///
///
/// Flags for setting priorities of ACM drivers. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_DRIVERPRIORITYF_BEGIN
///
/// Change notification broadcasts should be deferred. An application must reenable notification broadcasts as soon as possible with
/// the ACM_DRIVERPRIORITYF_END flag. Note that hadid must be NULL, dwPriority must be zero, and only the ACM_DRIVERPRIORITYF_BEGIN
/// flag can be set.
///
///
/// -
/// ACM_DRIVERPRIORITYF_DISABLE
/// ACM driver should be disabled if it is currently enabled. Disabling a disabled driver does nothing.
///
/// -
/// ACM_DRIVERPRIORITYF_ENABLE
/// ACM driver should be enabled if it is currently disabled. Enabling an enabled driver does nothing.
///
/// -
/// ACM_DRIVERPRIORITYF_END
///
/// Calling task wants to reenable change notification broadcasts. An application must call acmDriverPriority with
/// ACM_DRIVERPRIORITYF_END for each successful call with the ACM_DRIVERPRIORITYF_BEGIN flag. Note that hadid must be NULL,
/// dwPriority must be zero, and only the ACM_DRIVERPRIORITYF_END flag can be set.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_ALLOCATED
/// The deferred broadcast lock is owned by a different task.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOTSUPPORTED
///
/// The requested operation is not supported for the specified driver. For example, local and notify driver identifiers do not
/// support priorities (but can be enabled and disabled). If an application specifies a nonzero value for dwPriority for local and
/// notify driver identifiers, this error will be returned.
///
///
///
///
///
/// All driver identifiers can be enabled and disabled, including global, local and notification driver identifiers.
///
/// If more than one global driver identifier needs to be enabled, disabled or shifted in priority, an application should defer
/// change notification broadcasts by using the ACM_DRIVERPRIORITYF_BEGIN flag. A single change notification will be broadcast when
/// the ACM_DRIVERPRIORITYF_END flag is specified.
///
///
/// An application can use the function with the acmMetrics ACM_METRIC_DRIVER_PRIORITY metric index to retrieve the current
/// priority of a global driver. Drivers are always enumerated from highest to lowest priority by the acmDriverEnum function.
///
///
/// All enabled driver identifiers will receive change notifications. An application can register a notification message by using
/// the acmDriverAdd function in conjunction with the ACM_DRIVERADDF_NOTIFYHWND flag. Changes to nonglobal driver identifiers
/// will not be broadcast.
///
///
/// Priorities are simply used for the search order when an application does not specify a driver. Boosting the priority of a driver
/// will have no effect on the performance of a driver.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriverpriority MMRESULT ACMAPI acmDriverPriority(
// HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverPriority")]
public static extern MMRESULT acmDriverPriority([In, Optional] HACMDRIVERID hadid, uint dwPriority, ACM_DRIVERPRIORITYF fdwPriority);
///
/// The acmDriverRemove function removes an ACM driver from the list of available ACM drivers. The driver will be removed for
/// the calling application only. If the driver is globally installed, other applications will still be able to use it.
///
/// Handle to the driver identifier to be removed.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_BUSY
/// The driver is in use and cannot be removed.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmdriverremove MMRESULT ACMAPI acmDriverRemove( HACMDRIVERID
// hadid, DWORD fdwRemove );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmDriverRemove")]
public static extern MMRESULT acmDriverRemove(HACMDRIVERID hadid, uint fdwRemove = 0);
///
/// The acmFilterChoose function creates an ACM-defined dialog box that enables the user to select a waveform-audio filter.
///
///
///
/// Pointer to an ACMFILTERCHOOSE structure that contains information used to initialize the dialog box. When acmFilterChoose
/// returns, this structure contains information about the user's filter selection.
///
///
/// The pwfltr member of this structure must contain a valid pointer to a memory location that will contain the returned
/// filter header structure. The cbwfltr member must be filled in with the size, in bytes, of this memory buffer.
///
///
///
/// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_CANCELED
/// The user chose the Cancel button or the Close command on the System menu to close the dialog box.
///
/// -
/// ACMERR_NOTPOSSIBLE
///
/// The buffer identified by the [ACMFILTERCHOOSE](./nf-msacm-acmfilterchoose.md) structure is too small to contain the selected filter.
///
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NODRIVER
/// A suitable driver is not available to provide valid filter selections.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMFILTERCHOOSE as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmfilterchoosew MMRESULT ACMAPI acmFilterChooseW(
// LPACMFILTERCHOOSEW pafltrc );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFilterChooseW")]
public static extern MMRESULT acmFilterChoose(ref ACMFILTERCHOOSE pafltrc);
///
/// The acmFilterDetails function queries the ACM for details about a filter with a specific waveform-audio filter tag.
///
///
/// Handle to the ACM driver to query for waveform-audio filter details for a filter tag. If this parameter is NULL, the ACM
/// uses the details from the first suitable ACM driver.
///
/// Pointer to the ACMFILTERDETAILS structure that is to receive the filter details for the given filter tag.
///
/// Flags for getting the details. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FILTERDETAILSF_FILTER
///
/// [ACMFILTERDETAILS](./nf-msacm-acmfilterdetails.md) structure was given and the remaining details should be returned. The
/// dwFilterTag member of the ACMFILTERDETAILS structure must be initialized to the same filter tag pwfltr specifies. This query
/// type can be used to get a string description of an arbitrary filter structure. If an application specifies an ACM driver handle
/// for had , details on the filter will be returned for that driver. If an application specifies NULL for had , the ACM finds the
/// first acceptable driver to return the details.
///
///
/// -
/// ACM_FILTERDETAILSF_INDEX
///
/// A filter index for the filter tag was given in the dwFilterIndex member of the ACMFILTERDETAILS structure. The filter details
/// will be returned in the structure defined by pafd. The index ranges from zero to one less than the cStandardFilters member
/// returned in the ACMFILTERTAGDETAILS structure for a filter tag. An application must specify a driver handle for had when
/// retrieving filter details with this flag. For information about what members should be initialized before calling this function,
/// see the ACMFILTERDETAILS structure.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The details requested are not available.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMFILTERDETAILS as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmfilterdetailsw MMRESULT ACMAPI acmFilterDetailsW( HACMDRIVER
// had, LPACMFILTERDETAILSW pafd, DWORD fdwDetails );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFilterDetailsW")]
public static extern MMRESULT acmFilterDetails([In, Optional] HACMDRIVER had, ref ACMFILTERDETAILS pafd, ACM_FILTERDETAILSF fdwDetails);
///
/// The acmFilterEnum function enumerates waveform-audio filters available for a given filter tag from an ACM driver. This
/// function continues enumerating until there are no more suitable filters for the filter tag or the callback function returns FALSE.
///
///
/// Handle to the ACM driver to query for waveform-audio filter details. If this parameter is NULL, the ACM uses the details
/// from the first suitable ACM driver.
///
///
/// Pointer to the ACMFILTERDETAILS structure that contains the filter details when it is passed to the function specified by
/// fnCallback. When your application calls acmFilterEnum, the cbStruct, pwfltr, and cbwfltr members of
/// this structure must be initialized. The dwFilterTag member must also be initialized to either WAVE_FILTER_UNKNOWN or a
/// valid filter tag.
///
/// Procedure-instance address of the application-defined callback function.
///
/// A 32-bit (DWORD), 64-bit (DWORD_PTR) application-defined value that is passed to the callback function along with ACM filter details.
///
///
/// Flags for enumerating the filters for a given filter tag. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FILTERENUMF_DWFILTERTAG
///
/// [ACMFILTERDETAILS](./nf-msacm-acmfilterdetails.md) structure is valid. The enumerator will enumerate only a filter that conforms
/// to this attribute. The dwFilterTag member of the ACMFILTERDETAILS structure must be equal to the dwFilterTag member of the
/// WAVEFILTER structure.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The details for the filter cannot be returned.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// The acmFilterEnum function will return MMSYSERR_NOERROR (zero) if no suitable ACM drivers are installed. Moreover, the
/// callback function will not be called.
///
///
/// The following functions should not be called from within the callback function: acmDriverAdd, acmDriverRemove, and acmDriverPriority.
///
///
/// Note
///
/// The msacm.h header defines acmFilterEnum as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmfilterenumw MMRESULT ACMAPI acmFilterEnumW( HACMDRIVER had,
// LPACMFILTERDETAILSW pafd, ACMFILTERENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFilterEnumW")]
public static extern MMRESULT acmFilterEnum([In, Optional] HACMDRIVER had, ref ACMFILTERDETAILS pafd, [In] ACMFILTERENUMCB fnCallback, IntPtr dwInstance, ACM_FILTERENUMF fdwEnum);
/// The acmFilterTagDetails function queries the ACM for details about a specific waveform-audio filter tag.
///
/// Handle to the ACM driver to query for waveform-audio filter tag details. If this parameter is NULL, the ACM uses the
/// details from the first suitable ACM driver. An application must specify a valid HACMDRIVER or HACMDRIVERID
/// identifier when using the ACM_FILTERTAGDETAILSF_INDEX query type. Driver identifiers for disabled drivers are not allowed.
///
/// Pointer to the ACMFILTERTAGDETAILS structure that is to receive the filter tag details.
///
/// Flags for getting the details. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FILTERTAGDETAILSF_FILTERTAG
///
/// [ACMFILTERTAGDETAILS](./nf-msacm-acmfiltertagdetails.md) structure. The filter tag details will be returned in the structure
/// pointed to by paftd . If an application specifies an ACM driver handle for had , details on the filter tag will be returned for
/// that driver. If an application specifies NULL for had , the ACM finds the first acceptable driver to return the details.
///
///
/// -
/// ACM_FILTERTAGDETAILSF_INDEX
///
/// [ACMDRIVERDETAILS](./nf-msacm-acmdriverdetails.md) structure for an ACM driver. An application must specify a driver handle for
/// had when retrieving filter tag details with this flag.
///
///
/// -
/// ACM_FILTERTAGDETAILSF_LARGESTSIZE
///
/// Details on the filter tag with the largest filter size, in bytes, are to be returned. The dwFilterTag member must either be
/// WAVE_FILTER_UNKNOWN or the filter tag to find the largest size for. If an application specifies an ACM driver handle for had,
/// details on the largest filter tag will be returned for that driver. If an application specifies NULL for had, the ACM finds an
/// acceptable driver with the largest filter tag requested to return the details.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The details requested are not available.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMFILTERTAGDETAILS as an alias which automatically selects the ANSI or Unicode version of this
/// function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
/// not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions
/// for Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmfiltertagdetailsw MMRESULT ACMAPI acmFilterTagDetailsW(
// HACMDRIVER had, LPACMFILTERTAGDETAILSW paftd, DWORD fdwDetails );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFilterTagDetailsW")]
public static extern MMRESULT acmFilterTagDetails([In, Optional] HACMDRIVER had, ref ACMFILTERTAGDETAILS paftd, ACM_FILTERTAGDETAILSF fdwDetails);
///
/// The acmFilterTagEnum function enumerates waveform-audio filter tags available from an ACM driver. This function continues
/// enumerating until there are no more suitable filter tags or the callback function returns FALSE.
///
///
/// Handle to the ACM driver to query for waveform-audio filter tag details. If this parameter is NULL, the ACM uses the
/// details from the first suitable ACM driver.
///
///
/// Pointer to the ACMFILTERTAGDETAILS structure that contains the filter tag details when it is passed to the fnCallback
/// function. When your application calls acmFilterTagEnum, the cbStruct member of this structure must be initialized.
///
/// Procedure instance address of the application-defined callback function.
///
/// A 64-bit (DWORD_PTR) or 32-bit (DWORD) application-defined value that is passed to the callback function along with ACM filter
/// tag details.
///
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// This function will return MMSYSERR_NOERROR (zero) if no suitable ACM drivers are installed. Moreover, the callback function will
/// not be called.
///
///
/// Note
///
/// The msacm.h header defines acmFilterTagEnum as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmfiltertagenumw MMRESULT ACMAPI acmFilterTagEnumW( HACMDRIVER
// had, LPACMFILTERTAGDETAILSW paftd, ACMFILTERTAGENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFilterTagEnumW")]
public static extern MMRESULT acmFilterTagEnum([In, Optional] HACMDRIVER had, ref ACMFILTERTAGDETAILS paftd, ACMFILTERTAGENUMCB fnCallback, IntPtr dwInstance, uint fdwEnum);
///
/// The acmFormatChoose function creates an ACM-defined dialog box that enables the user to select a waveform-audio format.
///
///
///
/// Pointer to an ACMFORMATCHOOSE structure that contains information used to initialize the dialog box. When this function returns,
/// this structure contains information about the user's format selection.
///
///
/// The pwfx member of this structure must contain a valid pointer to a memory location that will contain the returned format
/// header structure. Moreover, the cbwfx member must be filled in with the size, in bytes, of this memory buffer.
///
///
///
/// Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible return values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_CANCELED
/// The user chose the Cancel button or the Close command on the System menu to close the dialog box.
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The buffer identified by the pwfx member of the ACMFORMATCHOOSE structure is too small to contain the selected format.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NODRIVER
/// A suitable driver is not available to provide valid format selections.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMFORMATCHOOSE as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformatchoosew MMRESULT ACMAPI acmFormatChooseW(
// LPACMFORMATCHOOSEW pafmtc );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatChooseW")]
public static extern MMRESULT acmFormatChoose(ref ACMFORMATCHOOSE pafmtc);
/// The acmFormatDetails function queries the ACM for format details for a specific waveform-audio format tag.
///
/// Handle to the ACM driver to query for waveform-audio format details for a format tag. If this parameter is NULL, the ACM
/// uses the details from the first suitable ACM driver.
///
/// Pointer to an ACMFORMATDETAILS structure to contain the format details for the given format tag.
///
/// Flags for getting the waveform-audio format tag details. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FORMATDETAILSF_FORMAT
///
/// ACMFORMATDETAILS structure was given and the remaining details should be returned. The dwFormatTag member of the
/// ACMFORMATDETAILS structure must be initialized to the same format tag as pwfx specifies. This query type can be used to get a
/// string description of an arbitrary format structure. If an application specifies an ACM driver handle for had , details on the
/// format will be returned for that driver. If an application specifies NULL for had , the ACM finds the first acceptable driver to
/// return the details.
///
///
/// -
/// ACM_FORMATDETAILSF_INDEX
///
/// A format index for the format tag was given in the dwFormatIndex member of the ACMFORMATDETAILS structure. The format details
/// will be returned in the structure defined by pafd. The index ranges from zero to one less than the cStandardFormats member
/// returned in the ACMFORMATTAGDETAILS structure for a format tag. An application must specify a driver handle for had when
/// retrieving format details with this flag. For information about which members should be initialized before calling this
/// function, see the ACMFORMATDETAILS structure.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The details requested are not available.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMFORMATDETAILS as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformatdetailsw MMRESULT ACMAPI acmFormatDetailsW( HACMDRIVER
// had, LPACMFORMATDETAILSW pafd, DWORD fdwDetails );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatDetailsW")]
public static extern MMRESULT acmFormatDetails([In, Optional] HACMDRIVER had, ref ACMFORMATDETAILS pafd, ACM_FORMATDETAILSF fdwDetails);
///
/// The acmFormatEnum function enumerates waveform-audio formats available for a given format tag from an ACM driver. This
/// function continues enumerating until there are no more suitable formats for the format tag or the callback function returns FALSE.
///
///
/// Handle to the ACM driver to query for waveform-audio format details. If this parameter is NULL, the ACM uses the details
/// from the first suitable ACM driver.
///
///
///
/// Pointer to an ACMFORMATDETAILS structure to contain the format details passed to the fnCallback function. This structure
/// must have the cbStruct, pwfx, and cbwfx members of the ACMFORMATDETAILS structure initialized. The
/// dwFormatTag member must also be initialized to either WAVE_FORMAT_UNKNOWN or a valid format tag.
///
/// The fdwSupport member of the structure must be initialized to zero.
/// To find the required size of the pwfx buffer, call acmMetrics with the ACM_METRIC_MAX_SIZE_FORMAT flag.
///
///
/// Address of an application-defined callback function. See acmFormatEnumCallback. This parameter cannot be NULL.
///
///
/// A 64-bit (DWORD_PTR) or 32-bit (DWORD) application-defined value that is passed to the callback function along with ACM format details.
///
///
/// Flags for enumerating the formats for a given format tag. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FORMATENUMF_CONVERT
///
/// ACMFORMATDETAILS structure is valid. The enumerator will only enumerate destination formats that can be converted from the given
/// pwfx format.If this flag is used, the wFormatTag member of the WAVEFORMATEX structure cannot be WAVE_FORMAT_UNKNOWN.
///
///
/// -
/// ACM_FORMATENUMF_HARDWARE
///
/// The enumerator should only enumerate formats that are supported as native input or output formats on one or more of the
/// installed waveform-audio devices. This flag provides a way for an application to choose only formats native to an installed
/// waveform-audio device. This flag must be used with one or both of the ACM_FORMATENUMF_INPUT and ACM_FORMATENUMF_OUTPUT flags.
/// Specifying both ACM_FORMATENUMF_INPUT and ACM_FORMATENUMF_OUTPUT will enumerate only formats that can be opened for input or
/// output. This is true regardless of whether this flag is specified.
///
///
/// -
/// ACM_FORMATENUMF_INPUT
/// Enumerator should enumerate only formats that are supported for input (recording).
///
/// -
/// ACM_FORMATENUMF_NCHANNELS
/// ACMFORMATDETAILS structure is valid. The enumerator will enumerate only a format that conforms to this attribute.
///
/// -
/// ACM_FORMATENUMF_NSAMPLESPERSEC
///
/// The nSamplesPerSec member of the WAVEFORMATEX structure pointed to by the pwfx member of the ACMFORMATDETAILS structure is
/// valid. The enumerator will enumerate only a format that conforms to this attribute.
///
///
/// -
/// ACM_FORMATENUMF_OUTPUT
/// Enumerator should enumerate only formats that are supported for output (playback).
///
/// -
/// ACM_FORMATENUMF_SUGGEST
///
/// ACMFORMATDETAILS structure is valid. The enumerator will enumerate all suggested destination formats for the given pwfx format.
/// This mechanism can be used instead of the acmFormatSuggest function to allow an application to choose the best suggested format
/// for conversion. The dwFormatIndex member will always be set to zero on return.If this flag is used, the wFormatTag member of the
/// WAVEFORMATEX structure cannot be WAVE_FORMAT_UNKNOWN.
///
///
/// -
/// ACM_FORMATENUMF_WBITSPERSAMPLE
///
/// The wBitsPerSample member of the WAVEFORMATEX structure pointed to by the pwfx member of the ACMFORMATDETAILS structure is
/// valid. The enumerator will enumerate only a format that conforms to this attribute.
///
///
/// -
/// ACM_FORMATENUMF_WFORMATTAG
///
/// The wFormatTag member of the WAVEFORMATEX structure pointed to by the pwfx member of the ACMFORMATDETAILS structure is valid.
/// The enumerator will enumerate only a format that conforms to this attribute. The dwFormatTag member of the ACMFORMATDETAILS
/// structure must be equal to the wFormatTag member.The value of wFormatTag cannot be WAVE_FORMAT_UNKNOWN in this case.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The details for the format cannot be returned.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// This function will return MMSYSERR_NOERROR (zero) if no suitable ACM drivers are installed. Moreover, the callback function will
/// not be called.
///
/// Examples
/// The following example shows how to enumerate formats that have the WAVE_FORMAT_MPEGLAYER3 format tag.
///
/// MMRESULT EnumerateMP3Codecs() { DWORD cbMaxSize = 0; MMRESULT result = MMSYSERR_NOERROR; ACMFORMATDETAILS acmFormatDetails; // Buffer to hold the format information. BYTE *pFormat = NULL; // Caller allocated. // Find the largest format buffer needed. result = acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &cbMaxSize); if (result != MMSYSERR_NOERROR) { return result; } // Allocate the format buffer. pFormat = new BYTE[cbMaxSize]; if (pFormat == NULL) { return MMSYSERR_NOMEM; } ZeroMemory(pFormat, cbMaxSize); // Ask for WAVE_FORMAT_MPEGLAYER3 formats. WAVEFORMATEX* pWaveFormat = (WAVEFORMATEX*)pFormat; pWaveFormat->wFormatTag = WAVE_FORMAT_MPEGLAYER3; // Set up the acmFormatDetails structure. ZeroMemory(&acmFormatDetails, sizeof(acmFormatDetails)); acmFormatDetails.cbStruct = sizeof(ACMFORMATDETAILS); acmFormatDetails.pwfx = pWaveFormat; acmFormatDetails.cbwfx = cbMaxSize; // For the ACM_FORMATENUMF_WFORMATTAG request, the format // tag in acmFormatDetails must match the format tag in // the pFormat buffer. acmFormatDetails.dwFormatTag = WAVE_FORMAT_MPEGLAYER3; result = acmFormatEnum(NULL, &acmFormatDetails, acmFormatEnumCallback, 0, ACM_FORMATENUMF_WFORMATTAG); delete [] pFormat; return result; }
///
///
/// The next example shows the callback function for the previous example. The callback function is called once for each matching
/// format or until the callback returns FALSE.
///
///
/// BOOL CALLBACK acmFormatEnumCallback( HACMDRIVERID hadid, LPACMFORMATDETAILS pafd, DWORD_PTR dwInstance, DWORD fdwSupport ) { BOOL bContinue = TRUE; MPEGLAYER3WAVEFORMAT *pMP3WaveFormat = NULL; if (pafd->pwfx->wFormatTag == WAVE_FORMAT_MPEGLAYER3) { pMP3WaveFormat = (MPEGLAYER3WAVEFORMAT*)pafd->pwfx; // TODO: Examine the format. // To halt the enumeration, set bContinue to FALSE. } return bContinue; }
///
///
/// Note
///
/// The msacm.h header defines acmFormatEnum as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformatenumw MMRESULT ACMAPI acmFormatEnumW( HACMDRIVER had,
// LPACMFORMATDETAILSW pafd, ACMFORMATENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatEnumW")]
public static extern MMRESULT acmFormatEnum([In, Optional] HACMDRIVER had, ref ACMFORMATDETAILS pafd, ACMFORMATENUMCB fnCallback, IntPtr dwInstance, ACM_FORMATENUMF fdwEnum);
///
/// The acmFormatSuggest function queries the ACM or a specified ACM driver to suggest a destination format for the supplied
/// source format. For example, an application can use this function to determine one or more valid PCM formats to which a
/// compressed format can be decompressed.
///
///
/// Handle to an open instance of a driver to query for a suggested destination format. If this parameter is NULL, the ACM
/// attempts to find the best driver to suggest a destination format.
///
///
/// Pointer to a WAVEFORMATEX structure that identifies the source format for which a destination format will be suggested by the
/// ACM or specified driver.
///
///
/// Pointer to a WAVEFORMATEX structure that will receive the suggested destination format for the pwfxSrc format. Depending on the
/// fdwSuggest parameter, some members of the structure pointed to by pwfxDst may require initialization.
///
///
/// Size, in bytes, available for the destination format. The acmMetrics and acmFormatTagDetails functions can be used to determine
/// the maximum size required for any format available for the specified driver (or for all installed ACM drivers).
///
///
/// Flags for matching the desired destination format. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FORMATSUGGESTF_NCHANNELS
///
/// The nChannels member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that can
/// suggest a destination format matching nChannels or fail.
///
///
/// -
/// ACM_FORMATSUGGESTF_NSAMPLESPERSEC
///
/// The nSamplesPerSec member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that
/// can suggest a destination format matching nSamplesPerSec or fail.
///
///
/// -
/// ACM_FORMATSUGGESTF_WBITSPERSAMPLE
///
/// The wBitsPerSample member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that
/// can suggest a destination format matching wBitsPerSample or fail.
///
///
/// -
/// ACM_FORMATSUGGESTF_WFORMATTAG
///
/// The wFormatTag member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that can
/// suggest a destination format matching wFormatTag or fail.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformatsuggest MMRESULT ACMAPI acmFormatSuggest( HACMDRIVER
// had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatSuggest")]
public static extern MMRESULT acmFormatSuggest([In, Optional] HACMDRIVER had, in WAVEFORMATEX pwfxSrc, out WAVEFORMATEX pwfxDst, uint cbwfxDst, ACM_FORMATSUGGESTF fdwSuggest);
///
/// The acmFormatSuggest function queries the ACM or a specified ACM driver to suggest a destination format for the supplied
/// source format. For example, an application can use this function to determine one or more valid PCM formats to which a
/// compressed format can be decompressed.
///
///
/// Handle to an open instance of a driver to query for a suggested destination format. If this parameter is NULL, the ACM
/// attempts to find the best driver to suggest a destination format.
///
///
/// Pointer to a WAVEFORMATEX structure that identifies the source format for which a destination format will be suggested by the
/// ACM or specified driver.
///
///
/// Pointer to a WAVEFORMATEX structure that will receive the suggested destination format for the pwfxSrc format. Depending on the
/// fdwSuggest parameter, some members of the structure pointed to by pwfxDst may require initialization.
///
///
/// Size, in bytes, available for the destination format. The acmMetrics and acmFormatTagDetails functions can be used to determine
/// the maximum size required for any format available for the specified driver (or for all installed ACM drivers).
///
///
/// Flags for matching the desired destination format. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FORMATSUGGESTF_NCHANNELS
///
/// The nChannels member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that can
/// suggest a destination format matching nChannels or fail.
///
///
/// -
/// ACM_FORMATSUGGESTF_NSAMPLESPERSEC
///
/// The nSamplesPerSec member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that
/// can suggest a destination format matching nSamplesPerSec or fail.
///
///
/// -
/// ACM_FORMATSUGGESTF_WBITSPERSAMPLE
///
/// The wBitsPerSample member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that
/// can suggest a destination format matching wBitsPerSample or fail.
///
///
/// -
/// ACM_FORMATSUGGESTF_WFORMATTAG
///
/// The wFormatTag member of the structure pointed to by pwfxDst is valid. The ACM will query acceptable installed drivers that can
/// suggest a destination format matching wFormatTag or fail.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformatsuggest MMRESULT ACMAPI acmFormatSuggest( HACMDRIVER
// had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatSuggest")]
public static extern MMRESULT acmFormatSuggest([In, Optional] HACMDRIVER had, in WAVEFORMATEX pwfxSrc, [Out] IntPtr pwfxDst, uint cbwfxDst, ACM_FORMATSUGGESTF fdwSuggest);
/// The acmFormatTagDetails function queries the ACM for details on a specific waveform-audio format tag.
///
/// Handle to the ACM driver to query for waveform-audio format tag details. If this parameter is NULL, the ACM uses the
/// details from the first suitable ACM driver. An application must specify a valid handle or driver identifier when using the
/// ACM_FORMATTAGDETAILSF_INDEX query type. Driver identifiers for disabled drivers are not allowed.
///
/// Pointer to the ACMFORMATTAGDETAILS structure that is to receive the format tag details.
///
/// Flags for getting the details. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_FORMATTAGDETAILSF_FORMATTAG
///
/// ACMFORMATTAGDETAILS structure. The format tag details will be returned in the structure pointed to bypaftd. If an application
/// specifies an ACM driver handle forhad, details on the format tag will be returned for that driver. If an application
/// specifiesNULLforhad, the ACM finds the first acceptable driver to return the details.
///
///
/// -
/// ACM_FORMATTAGDETAILSF_INDEX
///
/// ACMDRIVERDETAILS structure for an ACM driver. An application must specify a driver handle forhadwhen retrieving format tag
/// details with this flag.
///
///
/// -
/// ACM_FORMATTAGDETAILSF_LARGESTSIZE
///
/// ACMFORMATTAGDETAILS structure must either be WAVE_FORMAT_UNKNOWN or the format tag to find the largest size for. If an
/// application specifies an ACM driver handle forhad, details on the largest format tag will be returned for that driver. If an
/// application specifiesNULLforhad, the ACM finds an acceptable driver with the largest format tag requested to return the details.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The details requested are not available.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
/// Note
///
/// The msacm.h header defines ACMFORMATTAGDETAILS as an alias which automatically selects the ANSI or Unicode version of this
/// function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that
/// not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions
/// for Function Prototypes.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformattagdetailsw MMRESULT ACMAPI acmFormatTagDetailsW(
// HACMDRIVER had, LPACMFORMATTAGDETAILSW paftd, DWORD fdwDetails );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatTagDetailsW")]
public static extern MMRESULT acmFormatTagDetails([In, Optional] HACMDRIVER had, ref ACMFORMATTAGDETAILS paftd, ACM_FORMATTAGDETAILSF fdwDetails);
///
/// The acmFormatTagEnum function enumerates waveform-audio format tags available from an ACM driver. This function continues
/// enumerating until there are no more suitable format tags or the callback function returns FALSE.
///
///
/// Handle to the ACM driver to query for waveform-audio format tag details. If this parameter is NULL, the ACM uses the
/// details from the first suitable ACM driver.
///
///
/// Pointer to the ACMFORMATTAGDETAILS structure that is to receive the format tag details passed to the function specified in
/// fnCallback. This structure must have the cbStruct member of the ACMFORMATTAGDETAILS structure initialized.
///
/// Procedure instance address of the application-defined callback function.
///
/// A 64-bit (DWORD_PTR) or 32-bit (DWORD) application-defined value that is passed to the callback function along with ACM format
/// tag details.
///
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// This function will return MMSYSERR_NOERROR (zero) if no suitable ACM drivers are installed. Moreover, the callback function will
/// not be called.
///
///
/// Note
///
/// The msacm.h header defines acmFormatTagEnum as an alias which automatically selects the ANSI or Unicode version of this function
/// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not
/// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for
/// Function Prototypes.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmformattagenumw MMRESULT ACMAPI acmFormatTagEnumW( HACMDRIVER
// had, LPACMFORMATTAGDETAILSW paftd, ACMFORMATTAGENUMCBW fnCallback, DWORD_PTR dwInstance, DWORD fdwEnum );
[DllImport(Lib_Msacm32, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmFormatTagEnumW")]
public static extern MMRESULT acmFormatTagEnum([In, Optional] HACMDRIVER had, ref ACMFORMATTAGDETAILS paftd, ACMFORMATTAGENUMCB fnCallback, IntPtr dwInstance, uint fdwEnum = 0);
/// The acmGetVersion function returns the version number of the ACM.
///
/// The version number is returned as a hexadecimal number of the form 0xAABBCCCC, where AA is the major version number, BB is the
/// minor version number, and CCCC is the build number.
///
///
///
/// Win32 applications must verify that the ACM version is at least 0x03320000 (version 3.50) or greater before attempting to use
/// any other ACM functions. The build number (CCCC) is always zero for the retail (non-debug) version of the ACM.
///
///
/// To display the ACM version for a user, an application should use the following format (note that the values should be printed as
/// unsigned decimals):
///
///
/// { DWORD dw; TCHAR ach[10]; dw = acmGetVersion(); _stprintf_s(ach, TEXT("%u.%.02u"), HIWORD(dw) >> 8, HIWORD(dw) & 0x00FF); }
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmgetversion DWORD ACMAPI acmGetVersion();
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmGetVersion")]
public static extern uint acmGetVersion();
/// The acmMetrics function returns various metrics for the ACM or related ACM objects.
///
/// Handle to the ACM object to query for the metric specified in uMetric. For some queries, this parameter can be NULL.
///
///
/// Metric index to be returned in pMetric.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_METRIC_COUNT_CODECS
///
/// Returned value is the number of global ACM compressor or decompressor drivers in the system. The hao parameter must be NULL for
/// this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_CONVERTERS
///
/// Returned value is the number of global ACM converter drivers in the system. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_DISABLED
///
/// Returned value is the total number of global disabled ACM drivers (of all support types) in the system. The hao parameter must
/// be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value. The sum of the
/// ACM_METRIC_COUNT_DRIVERS and ACM_METRIC_COUNT_DISABLED metric indices is the total number of globally installed ACM drivers.
///
///
/// -
/// ACM_METRIC_COUNT_DRIVERS
///
/// Returned value is the total number of enabled global ACM drivers (of all support types) in the system. The hao parameter must be
/// NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_FILTERS
///
/// Returned value is the number of global ACM filter drivers in the system. The hao parameter must be NULL for this metric index.
/// The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_HARDWARE
///
/// Returned value is the number of global ACM hardware drivers in the system. The hao parameter must be NULL for this metric index.
/// The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_CODECS
///
/// Returned value is the number of local ACM compressor drivers, ACM decompressor drivers, or both for the calling task. The hao
/// parameter must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_CONVERTERS
///
/// Returned value is the number of local ACM converter drivers for the calling task. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_DISABLED
///
/// Returned value is the total number of local disabled ACM drivers, of all support types, for the calling task. The hao parameter
/// must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value. The sum of
/// the ACM_METRIC_COUNT_LOCAL_DRIVERS and ACM_METRIC_COUNT_LOCAL_DISABLED metric indices is the total number of locally installed
/// ACM drivers.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_DRIVERS
///
/// Returned value is the total number of enabled local ACM drivers (of all support types) for the calling task. The hao parameter
/// must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_FILTERS
///
/// Returned value is the number of local ACM filter drivers for the calling task. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_DRIVER_PRIORITY
///
/// Returned value is the current priority for the specified driver. The hao parameter must be a valid ACM driver identifier of the
/// HACMDRIVERID data type. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_DRIVER_SUPPORT
///
/// Returned value is the fdwSupport flags for the specified driver. The hao parameter must be a valid ACM driver identifier of the
/// HACMDRIVERID data type. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_HARDWARE_WAVE_INPUT
///
/// Returned value is the waveform-audio input device identifier associated with the specified driver. The hao parameter must be a
/// valid ACM driver identifier of the HACMDRIVERID data type that supports the ACMDRIVERDETAILS_SUPPORTF_HARDWARE flag. If no
/// waveform-audio input device is associated with the driver, MMSYSERR_NOTSUPPORTED is returned. The pMetric parameter must point
/// to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_HARDWARE_WAVE_OUTPUT
///
/// Returned value is the waveform-audio output device identifier associated with the specified driver. The hao parameter must be a
/// valid ACM driver identifier of the HACMDRIVERID data type that supports the ACMDRIVERDETAILS_SUPPORTF_HARDWARE flag. If no
/// waveform-audio output device is associated with the driver, MMSYSERR_NOTSUPPORTED is returned. The pMetric parameter must point
/// to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_MAX_SIZE_FILTER
///
/// Returned value is the size of the largest WAVEFILTER structure. If hao is NULL, the return value is the largest WAVEFILTER
/// structure in the system. If hao identifies an open instance of an ACM driver of the HACMDRIVER data type or an ACM driver
/// identifier of the HACMDRIVERID data type, the largest WAVEFILTER structure for that driver is returned. The pMetric parameter
/// must point to a buffer of a size equal to a DWORD value. This metric is not allowed for an ACM stream handle of the HACMSTREAM
/// data type.
///
///
/// -
/// ACM_METRIC_MAX_SIZE_FORMAT
///
/// Returned value is the size of the largest WAVEFORMATEX structure. If hao is NULL, the return value is the largest WAVEFORMATEX
/// structure in the system. If hao identifies an open instance of an ACM driver of the HACMDRIVER data type or an ACM driver
/// identifier of the HACMDRIVERID data type, the largest WAVEFORMATEX structure for that driver is returned. The pMetric parameter
/// must point to a buffer of a size equal to a DWORD value. This metric is not allowed for an ACM stream handle of the HACMSTREAM
/// data type.
///
///
///
///
/// Pointer to the buffer to receive the metric details. The exact definition depends on the uMetric index.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The index specified in uMetric cannot be returned for the specified hao.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOTSUPPORTED
/// The index specified in uMetric is not supported.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmmetrics MMRESULT ACMAPI acmMetrics( HACMOBJ hao, UINT
// uMetric, LPVOID pMetric );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmMetrics")]
public static extern MMRESULT acmMetrics([In, Optional] HACMOBJ hao, ACM_METRIC uMetric, [Out] IntPtr pMetric);
/// The acmMetrics function returns various metrics for the ACM or related ACM objects.
///
/// Handle to the ACM object to query for the metric specified in uMetric. For some queries, this parameter can be NULL.
///
///
/// Metric index to be returned in pMetric.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_METRIC_COUNT_CODECS
///
/// Returned value is the number of global ACM compressor or decompressor drivers in the system. The hao parameter must be NULL for
/// this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_CONVERTERS
///
/// Returned value is the number of global ACM converter drivers in the system. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_DISABLED
///
/// Returned value is the total number of global disabled ACM drivers (of all support types) in the system. The hao parameter must
/// be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value. The sum of the
/// ACM_METRIC_COUNT_DRIVERS and ACM_METRIC_COUNT_DISABLED metric indices is the total number of globally installed ACM drivers.
///
///
/// -
/// ACM_METRIC_COUNT_DRIVERS
///
/// Returned value is the total number of enabled global ACM drivers (of all support types) in the system. The hao parameter must be
/// NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_FILTERS
///
/// Returned value is the number of global ACM filter drivers in the system. The hao parameter must be NULL for this metric index.
/// The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_HARDWARE
///
/// Returned value is the number of global ACM hardware drivers in the system. The hao parameter must be NULL for this metric index.
/// The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_CODECS
///
/// Returned value is the number of local ACM compressor drivers, ACM decompressor drivers, or both for the calling task. The hao
/// parameter must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_CONVERTERS
///
/// Returned value is the number of local ACM converter drivers for the calling task. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_DISABLED
///
/// Returned value is the total number of local disabled ACM drivers, of all support types, for the calling task. The hao parameter
/// must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value. The sum of
/// the ACM_METRIC_COUNT_LOCAL_DRIVERS and ACM_METRIC_COUNT_LOCAL_DISABLED metric indices is the total number of locally installed
/// ACM drivers.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_DRIVERS
///
/// Returned value is the total number of enabled local ACM drivers (of all support types) for the calling task. The hao parameter
/// must be NULL for this metric index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_COUNT_LOCAL_FILTERS
///
/// Returned value is the number of local ACM filter drivers for the calling task. The hao parameter must be NULL for this metric
/// index. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_DRIVER_PRIORITY
///
/// Returned value is the current priority for the specified driver. The hao parameter must be a valid ACM driver identifier of the
/// HACMDRIVERID data type. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_DRIVER_SUPPORT
///
/// Returned value is the fdwSupport flags for the specified driver. The hao parameter must be a valid ACM driver identifier of the
/// HACMDRIVERID data type. The pMetric parameter must point to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_HARDWARE_WAVE_INPUT
///
/// Returned value is the waveform-audio input device identifier associated with the specified driver. The hao parameter must be a
/// valid ACM driver identifier of the HACMDRIVERID data type that supports the ACMDRIVERDETAILS_SUPPORTF_HARDWARE flag. If no
/// waveform-audio input device is associated with the driver, MMSYSERR_NOTSUPPORTED is returned. The pMetric parameter must point
/// to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_HARDWARE_WAVE_OUTPUT
///
/// Returned value is the waveform-audio output device identifier associated with the specified driver. The hao parameter must be a
/// valid ACM driver identifier of the HACMDRIVERID data type that supports the ACMDRIVERDETAILS_SUPPORTF_HARDWARE flag. If no
/// waveform-audio output device is associated with the driver, MMSYSERR_NOTSUPPORTED is returned. The pMetric parameter must point
/// to a buffer of a size equal to a DWORD value.
///
///
/// -
/// ACM_METRIC_MAX_SIZE_FILTER
///
/// Returned value is the size of the largest WAVEFILTER structure. If hao is NULL, the return value is the largest WAVEFILTER
/// structure in the system. If hao identifies an open instance of an ACM driver of the HACMDRIVER data type or an ACM driver
/// identifier of the HACMDRIVERID data type, the largest WAVEFILTER structure for that driver is returned. The pMetric parameter
/// must point to a buffer of a size equal to a DWORD value. This metric is not allowed for an ACM stream handle of the HACMSTREAM
/// data type.
///
///
/// -
/// ACM_METRIC_MAX_SIZE_FORMAT
///
/// Returned value is the size of the largest WAVEFORMATEX structure. If hao is NULL, the return value is the largest WAVEFORMATEX
/// structure in the system. If hao identifies an open instance of an ACM driver of the HACMDRIVER data type or an ACM driver
/// identifier of the HACMDRIVERID data type, the largest WAVEFORMATEX structure for that driver is returned. The pMetric parameter
/// must point to a buffer of a size equal to a DWORD value. This metric is not allowed for an ACM stream handle of the HACMSTREAM
/// data type.
///
///
///
///
/// Pointer to the buffer to receive the metric details. The exact definition depends on the uMetric index.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The index specified in uMetric cannot be returned for the specified hao.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOTSUPPORTED
/// The index specified in uMetric is not supported.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmmetrics MMRESULT ACMAPI acmMetrics( HACMOBJ hao, UINT
// uMetric, LPVOID pMetric );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmMetrics")]
public static extern MMRESULT acmMetrics([In, Optional] HACMOBJ hao, ACM_METRIC uMetric, out uint pMetric);
///
/// The acmStreamClose function closes an ACM conversion stream. If the function is successful, the handle is invalidated.
///
/// Handle to the open conversion stream to be closed.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_BUSY
/// The conversion stream cannot be closed because an asynchronous conversion is still in progress.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamclose MMRESULT ACMAPI acmStreamClose( HACMSTREAM has,
// DWORD fdwClose );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamClose")]
public static extern MMRESULT acmStreamClose(HACMSTREAM has, uint fdwClose = 0);
///
/// The acmStreamConvert function requests the ACM to perform a conversion on the specified conversion stream. A conversion
/// may be synchronous or asynchronous, depending on how the stream was opened.
///
/// Handle to the open conversion stream.
///
/// Pointer to a stream header that describes source and destination buffers for a conversion. This header must have been prepared
/// previously by using the acmStreamPrepareHeader function.
///
///
/// Flags for doing the conversion. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_STREAMCONVERTF_BLOCKALIGN
///
/// Only integral numbers of blocks will be converted. Converted data will end on block-aligned boundaries. An application should
/// use this flag for all conversions on a stream until there is not enough source data to convert to a block-aligned destination.
/// In this case, the last conversion should be specified without this flag.
///
///
/// -
/// ACM_STREAMCONVERTF_END
///
/// ACM conversion stream should begin returning pending instance data. For example, if a conversion stream holds instance data,
/// such as the end of an echo filter operation, this flag will cause the stream to start returning this remaining data with
/// optional source data. This flag can be specified with the ACM_STREAMCONVERTF_START flag.
///
///
/// -
/// ACM_STREAMCONVERTF_START
///
/// ACM conversion stream should reinitialize its instance data. For example, if a conversion stream holds instance data, such as
/// delta or predictor information, this flag will restore the stream to starting defaults. This flag can be specified with the
/// ACM_STREAMCONVERTF_END flag.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_BUSY
/// The stream header specified in pash is currently in use and cannot be reused.
///
/// -
/// ACMERR_UNPREPARED
/// The stream header specified in pash is currently not prepared by the acmStreamPrepareHeader function.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// You must use the acmStreamPrepareHeader function to prepare the source and destination buffers before they are passed to acmStreamConvert.
///
///
/// If an asynchronous conversion request is successfully queued by the ACM or driver and the conversion is later determined to be
/// impossible, the ACMSTREAMHEADER structure is posted back to the application's callback function with the cbDstLengthUsed
/// member set to zero.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamconvert MMRESULT ACMAPI acmStreamConvert( HACMSTREAM
// has, LPACMSTREAMHEADER pash, DWORD fdwConvert );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamConvert")]
public static extern MMRESULT acmStreamConvert(HACMSTREAM has, ref ACMSTREAMHEADER pash, ACM_STREAMCONVERTF fdwConvert);
/// The acmStreamMessage function sends a driver-specific message to an ACM driver.
/// Handle to an open conversion stream.
/// Message to send.
/// Message parameter.
/// Message parameter.
/// Returns the value returned by the ACM device driver.
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreammessage MMRESULT ACMAPI acmStreamMessage( HACMSTREAM
// has, UINT uMsg, LPARAM lParam1, LPARAM lParam2 );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamMessage")]
public static extern MMRESULT acmStreamMessage(HACMSTREAM has, uint uMsg, IntPtr lParam1, IntPtr lParam2);
///
/// The acmStreamOpen function opens an ACM conversion stream. Conversion streams are used to convert data from one specified
/// audio format to another.
///
///
/// Pointer to a handle that will receive the new stream handle that can be used to perform conversions. This handle is used to
/// identify the stream in calls to other ACM stream conversion functions. If the ACM_STREAMOPENF_QUERY flag is specified, this
/// parameter should be NULL.
///
///
/// Handle to an ACM driver. If this handle is specified, it identifies a specific driver to be used for a conversion stream. If
/// this parameter is NULL, all suitable installed ACM drivers are queried until a match is found.
///
/// Pointer to a WAVEFORMATEX structure that identifies the desired source format for the conversion.
/// Pointer to a WAVEFORMATEX structure that identifies the desired destination format for the conversion.
///
/// Pointer to a WAVEFILTER structure that identifies the desired filtering operation to perform on the conversion stream. If no
/// filtering operation is desired, this parameter can be NULL. If a filter is specified, the source (pwfxSrc) and
/// destination (pwfxDst) formats must be the same.
///
///
/// Pointer to a callback function, a handle of a window, or a handle of an event. A callback function will be called only if the
/// conversion stream is opened with the ACM_STREAMOPENF_ASYNC flag. A callback function is notified when the conversion stream is
/// opened or closed and after each buffer is converted. If the conversion stream is opened without the ACM_STREAMOPENF_ASYNC flag,
/// this parameter should be set to zero.
///
///
/// User-instance data passed to the callback function specified by the dwCallback parameter. This parameter is not used with window
/// and event callbacks. If the conversion stream is opened without the ACM_STREAMOPENF_ASYNC flag, this parameter should be set to zero.
///
///
/// Flags for opening the conversion stream. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_STREAMOPENF_ASYNC
/// ACMSTREAMHEADER structure for the ACMSTREAMHEADER_STATUSF_DONE flag.
///
/// -
/// ACM_STREAMOPENF_NONREALTIME
///
/// ACM will not consider time constraints when converting the data. By default, the driver will attempt to convert the data in real
/// time. For some formats, specifying this flag might improve the audio quality or other characteristics.
///
///
/// -
/// ACM_STREAMOPENF_QUERY
///
/// ACM will be queried to determine whether it supports the given conversion. A conversion stream will not be opened, and no handle
/// will be returned in the phas parameter.
///
///
/// -
/// CALLBACK_EVENT
/// The dwCallback parameter is a handle of an event.
///
/// -
/// CALLBACK_FUNCTION
///
/// The dwCallback parameter is a callback procedure address. The function prototype must conform to the acmStreamConvertCallback prototype.
///
///
/// -
/// CALLBACK_WINDOW
/// The dwCallback parameter is a window handle.
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The requested operation cannot be performed.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOMEM
/// The system is unable to allocate resources.
///
///
///
///
///
/// If an ACM driver cannot perform real-time conversions and the ACM_STREAMOPENF_NONREALTIME flag is not specified for the fdwOpen
/// parameter, the open operation will fail returning an ACMERR_NOTPOSSIBLE error code. An application can use the
/// ACM_STREAMOPENF_QUERY flag to determine if real-time conversions are supported for input.
///
///
/// If an application uses a window to receive callback information, the MM_ACM_OPEN, MM_ACM_CLOSE, and MM_ACM_DONE messages are
/// sent to the window procedure function to indicate the progress of the conversion stream. In this case, the ACMSTREAMHEADER
/// structure for MM_ACM_DONE, but it is not used for MM_ACM_OPEN and MM_ACM_CLOSE.
///
///
/// If an application uses a function to receive callback information, the MM_ACM_OPEN, MM_ACM_CLOSE, and MM_ACM_DONE messages are
/// sent to the function to indicate the progress of waveform-audio output. The callback function must reside in a dynamic-link
/// library (DLL).
///
///
/// If an application uses an event for callback notification, the event is signaled to indicate the progress of the conversion
/// stream. The event will be signaled when a stream is opened, after each buffer is converted, and when the stream is closed.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamopen MMRESULT ACMAPI acmStreamOpen( LPHACMSTREAM phas,
// HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, LPWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance,
// DWORD fdwOpen );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamOpen")]
public static extern MMRESULT acmStreamOpen(out SafeHACMSTREAM phas, [In, Optional] HACMDRIVER had, in WAVEFORMATEX pwfxSrc, in WAVEFORMATEX pwfxDst, in WAVEFILTER pwfltr, IntPtr dwCallback, IntPtr dwInstance, ACM_STREAMOPENF fdwOpen);
///
/// The acmStreamOpen function opens an ACM conversion stream. Conversion streams are used to convert data from one specified
/// audio format to another.
///
///
/// Pointer to a handle that will receive the new stream handle that can be used to perform conversions. This handle is used to
/// identify the stream in calls to other ACM stream conversion functions. If the ACM_STREAMOPENF_QUERY flag is specified, this
/// parameter should be NULL.
///
///
/// Handle to an ACM driver. If this handle is specified, it identifies a specific driver to be used for a conversion stream. If
/// this parameter is NULL, all suitable installed ACM drivers are queried until a match is found.
///
/// Pointer to a WAVEFORMATEX structure that identifies the desired source format for the conversion.
/// Pointer to a WAVEFORMATEX structure that identifies the desired destination format for the conversion.
///
/// Pointer to a WAVEFILTER structure that identifies the desired filtering operation to perform on the conversion stream. If no
/// filtering operation is desired, this parameter can be NULL. If a filter is specified, the source (pwfxSrc) and
/// destination (pwfxDst) formats must be the same.
///
///
/// Pointer to a callback function, a handle of a window, or a handle of an event. A callback function will be called only if the
/// conversion stream is opened with the ACM_STREAMOPENF_ASYNC flag. A callback function is notified when the conversion stream is
/// opened or closed and after each buffer is converted. If the conversion stream is opened without the ACM_STREAMOPENF_ASYNC flag,
/// this parameter should be set to zero.
///
///
/// User-instance data passed to the callback function specified by the dwCallback parameter. This parameter is not used with window
/// and event callbacks. If the conversion stream is opened without the ACM_STREAMOPENF_ASYNC flag, this parameter should be set to zero.
///
///
/// Flags for opening the conversion stream. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// ACM_STREAMOPENF_ASYNC
/// ACMSTREAMHEADER structure for the ACMSTREAMHEADER_STATUSF_DONE flag.
///
/// -
/// ACM_STREAMOPENF_NONREALTIME
///
/// ACM will not consider time constraints when converting the data. By default, the driver will attempt to convert the data in real
/// time. For some formats, specifying this flag might improve the audio quality or other characteristics.
///
///
/// -
/// ACM_STREAMOPENF_QUERY
///
/// ACM will be queried to determine whether it supports the given conversion. A conversion stream will not be opened, and no handle
/// will be returned in the phas parameter.
///
///
/// -
/// CALLBACK_EVENT
/// The dwCallback parameter is a handle of an event.
///
/// -
/// CALLBACK_FUNCTION
///
/// The dwCallback parameter is a callback procedure address. The function prototype must conform to the acmStreamConvertCallback prototype.
///
///
/// -
/// CALLBACK_WINDOW
/// The dwCallback parameter is a window handle.
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The requested operation cannot be performed.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOMEM
/// The system is unable to allocate resources.
///
///
///
///
///
/// If an ACM driver cannot perform real-time conversions and the ACM_STREAMOPENF_NONREALTIME flag is not specified for the fdwOpen
/// parameter, the open operation will fail returning an ACMERR_NOTPOSSIBLE error code. An application can use the
/// ACM_STREAMOPENF_QUERY flag to determine if real-time conversions are supported for input.
///
///
/// If an application uses a window to receive callback information, the MM_ACM_OPEN, MM_ACM_CLOSE, and MM_ACM_DONE messages are
/// sent to the window procedure function to indicate the progress of the conversion stream. In this case, the ACMSTREAMHEADER
/// structure for MM_ACM_DONE, but it is not used for MM_ACM_OPEN and MM_ACM_CLOSE.
///
///
/// If an application uses a function to receive callback information, the MM_ACM_OPEN, MM_ACM_CLOSE, and MM_ACM_DONE messages are
/// sent to the function to indicate the progress of waveform-audio output. The callback function must reside in a dynamic-link
/// library (DLL).
///
///
/// If an application uses an event for callback notification, the event is signaled to indicate the progress of the conversion
/// stream. The event will be signaled when a stream is opened, after each buffer is converted, and when the stream is closed.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamopen MMRESULT ACMAPI acmStreamOpen( LPHACMSTREAM phas,
// HACMDRIVER had, LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst, LPWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance,
// DWORD fdwOpen );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamOpen")]
public static extern MMRESULT acmStreamOpen(out SafeHACMSTREAM phas, [In, Optional] HACMDRIVER had, in WAVEFORMATEX pwfxSrc, in WAVEFORMATEX pwfxDst, [In, Optional] IntPtr pwfltr, IntPtr dwCallback, IntPtr dwInstance, ACM_STREAMOPENF fdwOpen);
///
/// The ACMSTREAMHEADER structure for an ACM stream conversion. This function must be called for every stream header before it can
/// be used in a conversion stream. An application needs to prepare a stream header only once for the life of a given stream. The
/// stream header can be reused as long as the sizes of the source and destination buffers do not exceed the sizes used when the
/// stream header was originally prepared.
///
/// Handle to the conversion steam.
/// Pointer to an ACMSTREAMHEADER structure that identifies the source and destination buffers to be prepared.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
/// -
/// MMSYSERR_NOMEM
/// The system is unable to allocate resources.
///
///
///
///
/// Preparing a stream header that has already been prepared has no effect, and the function returns zero. Nevertheless, you should
/// ensure your application does not prepare a stream header multiple times.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamprepareheader MMRESULT ACMAPI acmStreamPrepareHeader(
// HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwPrepare );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamPrepareHeader")]
public static extern MMRESULT acmStreamPrepareHeader(HACMSTREAM has, ref ACMSTREAMHEADER pash, uint fdwPrepare = 0);
///
/// The acmStreamReset function stops conversions for a given ACM stream. All pending buffers are marked as done and returned
/// to the application.
///
/// Handle to the conversion stream.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
///
///
///
/// Resetting an ACM conversion stream is necessary only for asynchronous conversion streams. Resetting a synchronous conversion
/// stream will succeed, but no action will be taken.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamreset MMRESULT ACMAPI acmStreamReset( HACMSTREAM has,
// DWORD fdwReset );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamReset")]
public static extern MMRESULT acmStreamReset(HACMSTREAM has, uint fdwReset = 0);
/// The acmStreamSize function returns a recommended size for a source or destination buffer on an ACM stream.
/// Handle to the conversion stream.
///
/// Size, in bytes, of the source or destination buffer. The fdwSize flags specify what the input parameter defines. This parameter
/// must be nonzero.
///
///
/// Pointer to a variable that contains the size, in bytes, of the source or destination buffer. The fdwSize flags specify what the
/// output parameter defines. If the acmStreamSize function succeeds, this location will always be filled with a nonzero value.
///
///
/// Flags for the stream size query. The following values are defined:
///
///
/// Value
/// Meaning
///
/// -
/// ACM_STREAMSIZEF_DESTINATION
///
/// The cbInput parameter contains the size of the destination buffer. The pdwOutputBytes parameter will receive the recommended
/// source buffer size, in bytes.
///
///
/// -
/// ACM_STREAMSIZEF_SOURCE
///
/// The cbInput parameter contains the size of the source buffer. The pdwOutputBytes parameter will receive the recommended
/// destination buffer size, in bytes.
///
///
///
///
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_NOTPOSSIBLE
/// The requested operation cannot be performed.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// An application can use this function to determine suggested buffer sizes for either source or destination buffers. The buffer
/// sizes returned might be only an estimation of the actual sizes required for conversion. Because actual conversion sizes cannot
/// always be determined without performing the conversion, the sizes returned will usually be overestimated.
///
///
/// In the event of an error, the location pointed to by pdwOutputBytes will receive zero. This assumes that the pointer specified
/// by pdwOutputBytes is valid.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamsize MMRESULT ACMAPI acmStreamSize( HACMSTREAM has,
// DWORD cbInput, LPDWORD pdwOutputBytes, DWORD fdwSize );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamSize")]
public static extern MMRESULT acmStreamSize(HACMSTREAM has, uint cbInput, out uint pdwOutputBytes, ACM_STREAMSIZEF fdwSize);
///
/// The acmStreamUnprepareHeader function cleans up the preparation performed by the acmStreamPrepareHeader function for an
/// ACM stream. This function must be called after the ACM is finished with the given buffers. An application must call this
/// function before freeing the source and destination buffers.
///
/// Handle to the conversion steam.
/// Pointer to an ACMSTREAMHEADER structure that identifies the source and destination buffers to be unprepared.
/// Reserved; must be zero.
///
/// Returns zero if successful or an error otherwise. Possible error values include the following.
///
///
/// Return code
/// Description
///
/// -
/// ACMERR_BUSY
/// The stream header specified in pash is currently in use and cannot be unprepared.
///
/// -
/// ACMERR_UNPREPARED
/// The stream header specified in pash is currently not prepared by the acmStreamPrepareHeader function.
///
/// -
/// MMSYSERR_INVALFLAG
/// At least one flag is invalid.
///
/// -
/// MMSYSERR_INVALHANDLE
/// The specified handle is invalid.
///
/// -
/// MMSYSERR_INVALPARAM
/// At least one parameter is invalid.
///
///
///
///
///
/// Unpreparing a stream header that has already been unprepared is an error. An application must specify the source and destination
/// buffer lengths ( cbSrcLength and cbDstLength, respectively) that were used during a call to the corresponding
/// acmStreamPrepareHeader. Failing to reset these member values will cause acmStreamUnprepareHeader to fail with an
/// MMSYSERR_INVALPARAM error.
///
///
/// The ACM can recover from some errors. The ACM will return a nonzero error, yet the stream header will be properly unprepared. To
/// determine whether the stream header was actually unprepared, an application can examine the ACMSTREAMHEADER_STATUSF_PREPARED
/// flag. If acmStreamUnprepareHeader returns success, the header will always be unprepared.
///
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/nf-msacm-acmstreamunprepareheader MMRESULT ACMAPI
// acmStreamUnprepareHeader( HACMSTREAM has, LPACMSTREAMHEADER pash, DWORD fdwUnprepare );
[DllImport(Lib_Msacm32, SetLastError = false, ExactSpelling = true)]
[PInvokeData("msacm.h", MSDNShortId = "NF:msacm.acmStreamUnprepareHeader")]
public static extern MMRESULT acmStreamUnprepareHeader(HACMSTREAM has, ref ACMSTREAMHEADER pash, uint fdwUnprepare = 0);
/// The ACMDRIVERDETAILS structure describes the features of an ACM driver.
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmdriverdetails typedef struct tACMDRIVERDETAILS { DWORD
// cbStruct; FOURCC fccType; FOURCC fccComp; WORD wMid; WORD wPid; DWORD vdwACM; DWORD vdwDriver; DWORD fdwSupport; DWORD
// cFormatTags; DWORD cFilterTags; HICON hicon; char szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS]; char
// szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS]; char szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS]; char
// szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS]; char szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS]; } ACMDRIVERDETAILS,
// *PACMDRIVERDETAILS, *LPACMDRIVERDETAILS;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMDRIVERDETAILS")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMDRIVERDETAILS
{
private const int ACMDRIVERDETAILS_SHORTNAME_CHARS = 32;
private const int ACMDRIVERDETAILS_LONGNAME_CHARS = 128;
private const int ACMDRIVERDETAILS_COPYRIGHT_CHARS = 80;
private const int ACMDRIVERDETAILS_LICENSING_CHARS = 128;
private const int ACMDRIVERDETAILS_FEATURES_CHARS = 512;
///
/// Size, in bytes, of the valid information contained in the ACMDRIVERDETAILS structure. An application should
/// initialize this member to the size, in bytes, of the desired information. The size specified in this member must be large
/// enough to contain the cbStruct member of the ACMDRIVERDETAILS structure. When the acmDriverDetails function
/// returns, this member contains the actual size of the information returned. The returned information will never exceed the
/// requested size.
///
public uint cbStruct;
/// Type of the driver. For ACM drivers, set this member to ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC.
public uint fccType;
/// Subtype of the driver. This member is currently set to ACMDRIVERDETAILS_FCCCOMP_UNDEFINED (zero).
public uint fccComp;
/// Manufacturer identifier. Manufacturer identifiers are defined in Manufacturer and Product Identifiers.
public ushort wMid;
/// Product identifier. Product identifiers are defined in Manufacturer and Product Identifiers.
public ushort wPid;
///
/// Version of the ACM for which this driver was compiled. The version number is a hexadecimal number in the format 0xAABBCCCC,
/// where AA is the major version number, BB is the minor version number, and CCCC is the build number. The version parts
/// (major, minor, and build) should be displayed as decimal numbers.
///
public uint vdwACM;
///
/// Version of the driver. The version number is a hexadecimal number in the format 0xAABBCCCC, where AA is the major version
/// number, BB is the minor version number, and CCCC is the build number. The version parts (major, minor, and build) should be
/// displayed as decimal numbers.
///
public uint vdwDriver;
///
/// Support flags for the driver. The following values are defined:
///
///
/// Name
/// Description
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags. For example, if a driver supports compression from
/// WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag. For example, if a driver supports
/// resampling of WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_DISABLED
///
/// Driver has been disabled. This flag is set by the ACM for a driver when it has been disabled for any of a number of reasons.
/// Disabled drivers cannot be opened and can be used only under very limited circumstances.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both through a waveform-audio device. An application should use the acmMetrics
/// function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indexes to get the
/// waveform-audio device identifiers associated with the supporting ACM driver.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_LOCAL
/// The driver has been installed locally with respect to the current task.
///
///
///
public ACMDRIVERDETAILS_SUPPORTF fdwSupport;
/// Number of unique format tags supported by this driver.
public uint cFormatTags;
/// Number of unique filter tags supported by this driver.
public uint cFilterTags;
///
/// Handle to a custom icon for this driver. An application can use this icon for referencing the driver visually. This member
/// can be NULL.
///
public HICON hicon;
///
/// Null-terminated string that describes the name of the driver. This string is intended to be displayed in small spaces.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMDRIVERDETAILS_SHORTNAME_CHARS)]
public string szShortName;
///
/// Null-terminated string that describes the full name of the driver. This string is intended to be displayed in large
/// (descriptive) spaces.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMDRIVERDETAILS_LONGNAME_CHARS)]
public string szLongName;
/// Null-terminated string that provides copyright information for the driver.
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMDRIVERDETAILS_COPYRIGHT_CHARS)]
public string szCopyright;
/// Null-terminated string that provides special licensing information for the driver.
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMDRIVERDETAILS_LICENSING_CHARS)]
public string szLicensing;
/// Null-terminated string that provides special feature information for the driver.
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMDRIVERDETAILS_FEATURES_CHARS)]
public string szFeatures;
}
///
/// The ACMFILTERCHOOSE structure contains information the ACM uses to initialize the system-defined waveform-audio filter
/// selection dialog box. After the user closes the dialog box, the system returns information about the user's selection in this structure.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmfilterchoose typedef struct tACMFILTERCHOOSE { DWORD
// cbStruct; DWORD fdwStyle; HWND hwndOwner; LPWAVEFILTER pwfltr; DWORD cbwfltr; LPCSTR pszTitle; char
// szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; char szFilter[ACMFILTERDETAILS_FILTER_CHARS]; LPSTR pszName; DWORD cchName;
// DWORD fdwEnum; LPWAVEFILTER pwfltrEnum; HINSTANCE hInstance; LPCSTR pszTemplateName; LPARAM lCustData; ACMFILTERCHOOSEHOOKPROC
// pfnHook; } ACMFILTERCHOOSE, *PACMFILTERCHOOSE, *LPACMFILTERCHOOSE;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFILTERCHOOSE")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMFILTERCHOOSE
{
///
/// Size, in bytes, of the ACMFILTERCHOOSE structure. This member must be initialized before an application calls the
/// acmFilterChoose function. The size specified in this member must be large enough to contain the base ACMFILTERCHOOSE structure.
///
public uint cbStruct;
///
///
/// Optional style flags for the acmFilterChoose function. This member must be initialized to a valid combination of the
/// following flags before an application calls the acmFilterChoose function. The following values are defined:
///
///
///
/// Name
/// Description
///
/// -
/// ACMFILTERCHOOSE_STYLEF_CONTEXTHELP
///
/// Context-sensitive help will be available in the dialog box. To use this feature, an application must register the
/// ACMHELPMSGCONTEXTMENU and ACMHELPMSGCONTEXTHELP constants, using the RegisterWindowMessage function. When the user invokes
/// help, the registered message will be posted to the owning window. The message will contain the wParam and lParam parameters
/// from the original WM_CONTEXTMENU or WM_CONTEXTHELP message.
///
///
/// -
/// ACMFILTERCHOOSE_STYLEF_ENABLEHOOK
///
/// Enables the hook function specified in the pfnHook member. An application can use hook functions for a variety of
/// customizations, including answering the MM_ACM_FILTERCHOOSE message.
///
///
/// -
/// ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE
/// Causes the ACM to create the dialog box template identified by the hInstance and pszTemplateName members.
///
/// -
/// ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE
///
/// The hInstance member identifies a data block that contains a preloaded dialog box template. If this flag is specified, the
/// ACM ignores the pszTemplateName member.
///
///
/// -
/// ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT
///
/// The buffer pointed to by pwfltr contains a valid WAVEFILTER structure that the dialog box will use as the initial selection.
///
///
/// -
/// ACMFILTERCHOOSE_STYLEF_SHOWHELP
///
/// A help button will appear in the dialog box. To use a custom Help file, an application must register the ACMHELPMSGSTRING
/// value with the RegisterWindowMessage function. When the user presses the help button, the registered message is posted to
/// the owner.
///
///
///
///
public ACMFILTERCHOOSE_STYLEF fdwStyle;
///
/// Handle to the window that owns the dialog box. This member can be any valid window handle or NULL if the dialog box
/// has no owner. This member must be initialized before calling the acmFilterChoose function.
///
public HWND hwndOwner;
///
/// Pointer to a WAVEFILTER structure. If the ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT flag is specified in the fdwStyle
/// member, this structure must be initialized to a valid filter. When the acmFilterChoose function returns, this buffer
/// contains the selected filter. If the user cancels the dialog box, no changes will be made to this buffer.
///
public IntPtr pwfltr;
///
/// Size, in bytes, of the buffer pointed to by the pwfltr member. The acmFilterChoose function returns
/// ACMERR_NOTPOSSIBLE if the buffer is too small to contain the filter information; the ACM also copies the required size into
/// this member. An application can use the acmMetrics and acmFilterTagDetails functions to determine the largest size required
/// for this buffer.
///
public uint cbwfltr;
///
/// Pointer to a string to be placed in the title bar of the dialog box. If this member is NULL, the ACM uses the default
/// title (that is, "Filter Selection").
///
[MarshalAs(UnmanagedType.LPTStr)]
public string pszTitle;
///
/// Buffer containing a null-terminated string describing the filter tag of the filter selection when the ACMFILTERTAGDETAILS
/// structure returned by acmFilterTagDetails. If the user cancels the dialog box, this member will contain a null-terminated string.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFILTERTAGDETAILS_FILTERTAG_CHARS)]
public string szFilterTag;
///
/// Buffer containing a null-terminated string describing the filter attributes of the filter selection when the
/// ACMFILTERDETAILS structure returned by acmFilterDetails. If the user cancels the dialog box, this member will contain a
/// null-terminated string.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFILTERDETAILS_FILTER_CHARS)]
public string szFilter;
///
///
/// Pointer to a string for a user-defined filter name. If this is a non-null-terminated string, the ACM attempts to match the
/// name with a previously saved user-defined filter name. If a match is found, the dialog box is initialized to that filter. If
/// a match is not found or this member is a null-terminated string, this member is ignored for input. When the acmFilterChoose
/// function returns, this buffer contains a null-terminated string describing the user-defined filter. If the filter name is
/// untitled (that is, the user has not given a name for the filter), this member will be a null-terminated string on return. If
/// the user cancels the dialog box, no changes will be made to this buffer.
///
///
/// If the ACMFILTERCHOOSE_STYLEF_INITTOFILTERSTRUCT flag is specified by the fdwStyle member, the pszName member
/// is ignored as an input member.
///
///
[MarshalAs(UnmanagedType.LPTStr)]
public string pszName;
///
/// Size, in characters, of the buffer identified by the pszName member. This buffer should be at least 128 characters
/// long. If pszName is NULL, this member is ignored.
///
public uint cchName;
///
///
/// Optional flags for restricting the type of filters listed in the dialog box. These flags are identical to the fdwEnum flags
/// for the acmFilterEnum function. If pwfltrEnum is NULL, this member should be zero.
///
///
///
/// Name
/// Description
///
/// -
/// ACM_FILTERENUMF_DWFILTERTAG
///
/// The dwFilterTag member of the WAVEFILTER structure pointed to by the pwfltrEnum member is valid. The enumerator will only
/// enumerate a filter that conforms to this attribute.
///
///
///
///
public ACM_FILTERENUMF fdwEnum;
///
/// Pointer to a WAVEFILTER structure that will be used to restrict the filters listed in the dialog box. The fdwEnum
/// member defines which members of this structure should be used for the enumeration restrictions. The cbStruct member
/// of this WAVEFILTER structure must be initialized to the size of the WAVEFILTER structure. If no special
/// restrictions are desired, this member can be NULL.
///
public IntPtr pwfltrEnum;
///
/// Handle to a data block that contains a dialog box template specified by the pszTemplateName member. This member is
/// used only if the fdwStyle member specifies the ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE or
/// ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATEHANDLE flag; otherwise, this member should be NULL on input.
///
public HINSTANCE hInstance;
///
/// Pointer to a null-terminated string that specifies the name of the resource file for the dialog box template that is to be
/// substituted for the dialog box template in the ACM. An application can use the MAKEINTRESOURCE macro for numbered dialog box
/// resources. This member is used only if the fdwStyle member specifies the ACMFILTERCHOOSE_STYLEF_ENABLETEMPLATE flag;
/// otherwise, this member should be NULL on input.
///
[MarshalAs(UnmanagedType.LPStr)]
public string pszTemplateName;
///
/// Application-defined data that the ACM passes to the hook function identified by the pfnHook member. The system passes
/// the data in the lParam parameter of the WM_INITDIALOG message.
///
public IntPtr lCustData;
///
/// Pointer to a callback function that processes messages intended for the dialog box. An application must specify the
/// ACMFILTERCHOOSE_STYLEF_ENABLEHOOK flag in the fdwStyle member to enable the hook; otherwise, this member should be
/// NULL. The hook function should return FALSE to pass a message to the standard dialog box procedure or
/// TRUE to discard the message. The callback function type is acmFilterChooseHookProc.
///
public ACMFILTERCHOOSEHOOKPROC pfnHook;
}
/// The ACMFILTERDETAILS structure details a waveform-audio filter for a specific filter tag for an ACM driver.
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmfilterdetails typedef struct tACMFILTERDETAILS { DWORD
// cbStruct; DWORD dwFilterIndex; DWORD dwFilterTag; DWORD fdwSupport; LPWAVEFILTER pwfltr; DWORD cbwfltr; char
// szFilter[ACMFILTERDETAILS_FILTER_CHARS]; } ACMFILTERDETAILS, *PACMFILTERDETAILS, *LPACMFILTERDETAILS;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFILTERDETAILS")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMFILTERDETAILS
{
///
/// Size, in bytes, of the ACMFILTERDETAILS structure. This member must be initialized before calling the
/// acmFilterDetails or acmFilterEnum functions. The size specified in this member must be large enough to contain the base
/// ACMFILTERDETAILS structure. When the acmFilterDetails function returns, this member contains the actual size
/// of the information returned. The returned information will never exceed the requested size.
///
public uint cbStruct;
///
/// Index of the filter about which details will be retrieved. The index ranges from zero to one less than the number of
/// standard filters supported by an ACM driver for a filter tag. The number of standard filters supported by a driver for a
/// filter tag is contained in the ACMFILTERTAGDETAILS structure. The dwFilterIndex member is used only when querying
/// standard filter details about a driver by index; otherwise, this member should be zero. Also, this member will be set to
/// zero by the ACM when an application queries for details on a filter; in other words, this member is used only for input and
/// is never returned by the ACM or an ACM driver.
///
public uint dwFilterIndex;
///
/// Waveform-audio filter tag that the ACMFILTERDETAILS structure describes. This member is used as an input for the
/// ACM_FILTERDETAILSF_INDEX query flag. For the ACM_FILTERDETAILSF_FORMAT query flag, this member must be initialized to the
/// same filter tag as the pwfltr member specifies. If the acmFilterDetails function is successful, this member is always
/// returned. This member should be set to WAVE_FILTER_UNKNOWN for all other query flags.
///
public uint dwFilterTag;
///
///
/// Driver-support flags specific to the specified filter. These flags are identical to the ACMDRIVERDETAILS structure, but they
/// are specific to the filter that is being queried. This member can be a combination of the following values and identifies
/// which operations the driver supports for the filter tag:
///
///
///
/// Name
/// Description
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags while using the specified filter. For example, if a driver
/// supports compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM with the specified filter, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag while using the specified filter. For
/// example, if a driver supports resampling of WAVE_FORMAT_PCM with the specified filter, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both with the specified filter through a waveform-audio device. An application
/// should use the acmMetrics function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric
/// indexes to retrieve the waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
public ACMDRIVERDETAILS_SUPPORTF fdwSupport;
///
/// Pointer to a WAVEFILTER structure that will receive the filter details. This structure requires no initialization by the
/// application unless the ACM_FILTERDETAILSF_FILTER flag is specified with the acmFilterDetails function. In this case, the
/// dwFilterTag member of the WAVEFILTER structure must be equal to the dwFilterTag member of the
/// ACMFILTERDETAILS structure.
///
public IntPtr pwfltr;
///
/// Size, in bytes, available for pwfltr to receive the filter details. The acmMetrics and acmFilterTagDetails functions
/// can be used to determine the maximum size required for any filter available for the specified driver (or for all installed
/// ACM drivers).
///
public uint cbwfltr;
///
/// String that describes the filter for the dwFilterTag type. If the acmFilterDetails function is successful, this
/// string is always returned.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFILTERDETAILS_FILTER_CHARS)]
public string szFilter;
}
/// The ACMFILTERTAGDETAILS structure details a waveform-audio filter tag for an ACM filter driver.
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmfiltertagdetails typedef struct tACMFILTERTAGDETAILS { DWORD
// cbStruct; DWORD dwFilterTagIndex; DWORD dwFilterTag; DWORD cbFilterSize; DWORD fdwSupport; DWORD cStandardFilters; char
// szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS]; } ACMFILTERTAGDETAILS, *PACMFILTERTAGDETAILS, *LPACMFILTERTAGDETAILS;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFILTERTAGDETAILS")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMFILTERTAGDETAILS
{
///
/// Size, in bytes, of the ACMFILTERTAGDETAILS structure. This member must be initialized before an application calls the
/// acmFilterTagDetails or acmFilterTagEnum function. The size specified in this member must be large enough to contain the base
/// ACMFILTERTAGDETAILS structure. When the acmFilterTagDetails function returns, this member contains the actual
/// size of the information returned. The returned information will never exceed the requested size.
///
public uint cbStruct;
///
/// Index of the filter tag to retrieve details for. The index ranges from zero to one less than the number of filter tags
/// supported by an ACM driver. The number of filter tags supported by a driver is contained in the ACMDRIVERDETAILS structure.
/// The dwFilterTagIndex member is used only when querying filter tag details about a driver by index; otherwise, this
/// member should be zero.
///
public uint dwFilterTagIndex;
///
/// Waveform-audio filter tag that the ACMFILTERTAGDETAILS structure describes. This member is used as an input for the
/// ACM_FILTERTAGDETAILSF_FILTERTAG and ACM_FILTERTAGDETAILSF_LARGESTSIZE query flags. This member is always returned if the
/// acmFilterTagDetails function is successful. This member should be set to WAVE_FILTER_UNKNOWN for all other query flags.
///
public uint dwFilterTag;
///
/// Largest total size, in bytes, of a waveform-audio filter of the dwFilterTag type. For example, this member will be 40
/// for WAVE_FILTER_ECHO and 36 for WAVE_FILTER_VOLUME.
///
public uint cbFilterSize;
///
///
/// Driver-support flags specific to the filter tag. These flags are identical to the ACMDRIVERDETAILS structure. This member
/// can be a combination of the following values and identifies which operations the driver supports with the filter tag:
///
///
///
/// Name
/// Description
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags while using the specified filter tag. For example, if a driver
/// supports compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM with the specified filter tag, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag while using the specified filter tag. For
/// example, if a driver supports resampling of WAVE_FORMAT_PCM with the specified filter tag, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both with the specified filter tag through a waveform-audio device. An
/// application should use the acmMetrics function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT
/// metric indexes to get the waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
public ACMDRIVERDETAILS_SUPPORTF fdwSupport;
///
/// Number of standard filters of the dwFilterTag type (that is, the combination of all filter characteristics). This
/// value cannot specify all filters supported by the driver.
///
public uint cStandardFilters;
///
/// String that describes the dwFilterTag type. This string is always returned if the acmFilterTagDetails function is successful.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFILTERTAGDETAILS_FILTERTAG_CHARS)]
public string szFilterTag;
}
///
/// The ACMFORMATCHOOSE structure contains information the ACM uses to initialize the system-defined waveform-audio format
/// selection dialog box. After the user closes the dialog box, the system returns information about the user's selection in this structure.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmformatchoose typedef struct tACMFORMATCHOOSE { DWORD
// cbStruct; DWORD fdwStyle; HWND hwndOwner; LPWAVEFORMATEX pwfx; DWORD cbwfx; LPCSTR pszTitle; char
// szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; char szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; LPSTR pszName; DWORD cchName;
// DWORD fdwEnum; LPWAVEFORMATEX pwfxEnum; HINSTANCE hInstance; LPCSTR pszTemplateName; LPARAM lCustData; ACMFORMATCHOOSEHOOKPROC
// pfnHook; } ACMFORMATCHOOSE, *PACMFORMATCHOOSE, *LPACMFORMATCHOOSE;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFORMATCHOOSE")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMFORMATCHOOSE
{
///
/// Size, in bytes, of the ACMFORMATCHOOSE structure. This member must be initialized before an application calls the
/// acmFormatChoose function. The size specified in this member must be large enough to contain the base ACMFORMATCHOOSE structure.
///
public uint cbStruct;
///
///
/// Optional style flags for the acmFormatChoose function. This member must be initialized to a valid combination of the
/// following flags before an application calls the acmFormatChoose function:
///
///
///
/// Name
/// Description
///
/// -
/// ACMFORMATCHOOSE_STYLEF_CONTEXTHELP
///
/// Context-sensitive help will be available in the dialog box. To use this feature, an application must register the
/// ACMHELPMSGCONTEXTMENU and ACMHELPMSGCONTEXTHELP constants, using the RegisterWindowMessage function. When the user invokes
/// help, the registered message will be posted to the owning window. The message will contain the wParam and lParam parameters
/// from the original WM_CONTEXTMENU or WM_CONTEXTHELP message.
///
///
/// -
/// ACMFORMATCHOOSE_STYLEF_ENABLEHOOK
///
/// Enables the hook function pointed to by the pfnHook member. An application can use hook functions for a variety of
/// customizations, including answering the MM_ACM_FORMATCHOOSE message.
///
///
/// -
/// ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE
/// Causes the ACM to create the dialog box template identified by hInstance and pszTemplateName.
///
/// -
/// ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE
///
/// The hInstance member identifies a data block that contains a preloaded dialog box template. If this flag is specified, the
/// ACM ignores the pszTemplateName member.
///
///
/// -
/// ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT
///
/// The buffer pointed to by pwfx contains a valid WAVEFORMATEX structure that the dialog box will use as the initial selection.
///
///
/// -
/// ACMFORMATCHOOSE_STYLEF_SHOWHELP
///
/// A help button will appear in the dialog box. To use a custom Help file, an application must register the ACMHELPMSGSTRING
/// constant with the RegisterWindowMessage function. When the user presses the help button, the registered message will be
/// posted to the owner.
///
///
///
///
public ACMFORMATCHOOSE_STYLEF fdwStyle;
///
/// Handle to the window that owns the dialog box. This member can be any valid window handle, or NULL if the dialog box
/// has no owner. This member must be initialized before calling the acmFormatChoose function.
///
public HWND hwndOwner;
///
/// Pointer to a WAVEFORMATEX structure. If the ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT flag is specified in the fdwStyle
/// member, this structure must be initialized to a valid format. When the acmFormatChoose function returns, this buffer
/// contains the selected format. If the user cancels the dialog box, no changes will be made to this buffer.
///
public IntPtr pwfx;
///
/// Size, in bytes, of the buffer pointed to by pwfx. If the buffer is too small to contain the format information, the
/// acmFormatChoose function returns ACMERR_NOTPOSSIBLE. Also, the ACM copies the required size into this member. An application
/// can use the acmMetrics and acmFormatTagDetails functions to determine the largest size required for this buffer.
///
public uint cbwfx;
///
/// Pointer to a string to be placed in the title bar of the dialog box. If this member is NULL, the ACM uses the default
/// title (that is, "Sound Selection").
///
[MarshalAs(UnmanagedType.LPTStr)]
public string pszTitle;
///
/// Buffer containing a null-terminated string describing the format tag of the format selection when the ACMFORMATTAGDETAILS
/// structure returned by the acmFormatTagDetails function. If the user cancels the dialog box, this member will contain a
/// null-terminated string.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFORMATTAGDETAILS_FORMATTAG_CHARS)]
public string szFormatTag;
///
/// Buffer containing a null-terminated string describing the format attributes of the format selection when the
/// ACMFORMATDETAILS structure returned by the acmFormatDetails function. If the user cancels the dialog box, this member will
/// contain a null-terminated string.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFORMATDETAILS_FORMAT_CHARS)]
public string szFormat;
///
/// Pointer to a string for a user-defined format name. If this is a non-null-terminated string, the ACM will attempt to match
/// the name with a previously saved user-defined format name. If a match is found, the dialog box is initialized to that
/// format. If a match is not found or this member is a null-terminated string, this member is ignored on input. When the
/// acmFormatChoose function returns, this buffer contains a null-terminated string describing the user-defined format. If the
/// format name is untitled (that is, the user has not given a name for the format), this member will be a null-terminated
/// string on return. If the user cancels the dialog box, no changes will be made to this buffer.
///
[MarshalAs(UnmanagedType.LPTStr)]
public string pszName;
///
/// Size, in characters, of the buffer identified by the pszName member. This buffer should be at least 128 characters
/// long. If the pszName member is NULL, this member is ignored.
///
public uint cchName;
///
///
/// Optional flags for restricting the type of formats listed in the dialog box. These flags are identical to the fdwEnum flags
/// for the acmFormatEnum function. If pwfxEnum is NULL, this member should be zero. The following values are defined:
///
///
///
/// Name
/// Description
///
/// -
/// ACM_FORMATENUMF_CONVERT
///
/// The WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will enumerate only destination
/// formats that can be converted from the given pwfxEnum format.
///
///
/// -
/// ACM_FORMATENUMF_HARDWARE
///
/// The enumerator should enumerate only formats that are supported in hardware by one or more of the installed waveform-audio
/// devices. This flag provides a way for an application to choose only formats native to an installed waveform-audio device.
///
///
/// -
/// ACM_FORMATENUMF_INPUT
/// The enumerator should enumerate only formats that are supported for input (recording).
///
/// -
/// ACM_FORMATENUMF_NCHANNELS
///
/// The nChannels member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will enumerate
/// only a format that conforms to this attribute.
///
///
/// -
/// ACM_FORMATENUMF_NSAMPLESPERSEC
///
/// The nSamplesPerSec member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will
/// enumerate only a format that conforms to this attribute.
///
///
/// -
/// ACM_FORMATENUMF_OUTPUT
/// The enumerator should enumerate only formats that are supported for output (playback).
///
/// -
/// ACM_FORMATENUMF_SUGGEST
///
/// The WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will enumerate all suggested
/// destination formats for the given pwfxEnum format.
///
///
/// -
/// ACM_FORMATENUMF_WBITSPERSAMPLE
///
/// The wBitsPerSample member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will
/// enumerate only a format that conforms to this attribute.
///
///
/// -
/// ACM_FORMATENUMF_WFORMATTAG
///
/// The wFormatTag member of the WAVEFORMATEX structure pointed to by the pwfxEnum member is valid. The enumerator will
/// enumerate only a format that conforms to this attribute.
///
///
///
///
public ACM_FORMATENUMF fdwEnum;
///
/// Pointer to a WAVEFORMATEX structure that will be used to restrict the formats listed in the dialog box. The
/// fdwEnum member defines the members of the structure pointed to by pwfxEnum that should be used for the
/// enumeration restrictions. If no special restrictions are desired, this member can be NULL. For other requirements
/// associated with the pwfxEnum member, see the description for the acmFormatEnum function.
///
public IntPtr pwfxEnum;
///
/// Handle to a data block that contains a dialog box template specified by the pszTemplateName member. This member is
/// used only if the fdwStyle member specifies the ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE or
/// ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATEHANDLE flag; otherwise, this member should be NULL on input.
///
public HINSTANCE hInstance;
///
/// Pointer to a null-terminated string that specifies the name of the resource file for the dialog box template that is to be
/// substituted for the dialog box template in the ACM. An application can use the MAKEINTRESOURCE macro for numbered dialog box
/// resources. This member is used only if the fdwStyle member specifies the ACMFORMATCHOOSE_STYLEF_ENABLETEMPLATE flag;
/// otherwise, this member should be NULL on input.
///
[MarshalAs(UnmanagedType.LPTStr)]
public string pszTemplateName;
///
/// Application-defined data that the ACM passes to the hook function identified by the pfnHook member. The system passes
/// the data in the lParam parameter of the WM_INITDIALOG message.
///
public IntPtr lCustData;
///
/// Pointer to a callback function that processes messages intended for the dialog box. An application must specify the
/// ACMFORMATCHOOSE_STYLEF_ENABLEHOOK flag in the fdwStyle member to enable the hook; otherwise, this member should be
/// NULL. The hook function should return FALSE to pass a message to the standard dialog box procedure or
/// TRUE to discard the message. The callback function type is acmFormatChooseHookProc.
///
public ACMFORMATCHOOSEHOOKPROC pfnHook;
}
/// The ACMFORMATDETAILS structure details a waveform-audio format for a specific format tag for an ACM driver.
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmformatdetails typedef struct tACMFORMATDETAILS { DWORD
// cbStruct; DWORD dwFormatIndex; DWORD dwFormatTag; DWORD fdwSupport; LPWAVEFORMATEX pwfx; DWORD cbwfx; char
// szFormat[ACMFORMATDETAILS_FORMAT_CHARS]; } ACMFORMATDETAILS, *PACMFORMATDETAILS, *LPACMFORMATDETAILS;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFORMATDETAILS")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMFORMATDETAILS
{
///
/// Size, in bytes, of the ACMFORMATDETAILS structure. This member must be initialized before an application calls the
/// acmFormatDetails or acmFormatEnum function. The size specified by this member must be large enough to contain the base
/// ACMFORMATDETAILS structure. When the acmFormatDetails function returns, this member contains the actual size
/// of the information returned. The returned information will never exceed the requested size.
///
public uint cbStruct;
///
/// Index of the format to retrieve details for. The index ranges from zero to one less than the number of standard formats
/// supported by an ACM driver for a format tag. The number of standard formats supported by a driver for a format tag is
/// contained in the ACMFORMATTAGDETAILS structure. The dwFormatIndex member is used only when an application queries
/// standard format details about a driver by index; otherwise, this member should be zero. Also, this member will be set to
/// zero by the ACM when an application queries for details on a format; in other words, this member is used only for input and
/// is never returned by the ACM or an ACM driver.
///
public uint dwFormatIndex;
///
/// Waveform-audio format tag that the ACMFORMATDETAILS structure describes. This member is used for input for the
/// ACM_FORMATDETAILSF_INDEX query flag. For the ACM_FORMATDETAILSF_FORMAT query flag, this member must be initialized to the
/// same format tag as the pwfx member specifies. If a call to the acmFormatDetails function is successful, this member
/// is always returned. This member should be set to WAVE_FORMAT_UNKNOWN for all other query flags.
///
public uint dwFormatTag;
///
///
/// Driver-support flags specific to the specified format. These flags are identical to the ACMDRIVERDETAILS structure. This
/// member can be a combination of the following values and indicates which operations the driver supports for the format tag:
///
///
///
/// Name
/// Description
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions with the specified format tag.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags for the specified format. For example, if a driver supports
/// compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM with the specified format, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the same format tag while using the specified format. For
/// example, if a driver supports resampling of WAVE_FORMAT_PCM to the specified format, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (which modifies data without changing any format attributes) with the specified format. For
/// example, if a driver supports volume or echo operations on WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input and/or output of the specified format through a waveform-audio device. An application should
/// use acmMetrics with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric indexes to get the
/// waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
public ACMDRIVERDETAILS_SUPPORTF fdwSupport;
///
/// Pointer to a WAVEFORMATEX structure that will receive the format details. This structure requires no initialization by the
/// application unless the ACM_FORMATDETAILSF_FORMAT flag is specified in the acmFormatDetails function. In this case, the
/// wFormatTag member of the WAVEFORMATEX structure must be equal to the dwFormatTag of the
/// ACMFORMATDETAILS structure.
///
public IntPtr pwfx;
///
/// Size, in bytes, available for pwfx to receive the format details. The acmMetrics and acmFormatTagDetails functions
/// can be used to determine the maximum size required for any format available for the specified driver (or for all installed
/// ACM drivers).
///
public uint cbwfx;
///
/// String that describes the format for the dwFormatTag type. If the acmFormatDetails function is successful, this
/// string is always returned.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFORMATDETAILS_FORMAT_CHARS)]
public string szFormat;
}
/// The ACMFORMATTAGDETAILS structure details a waveform-audio format tag for an ACM driver.
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmformattagdetails typedef struct tACMFORMATTAGDETAILS { DWORD
// cbStruct; DWORD dwFormatTagIndex; DWORD dwFormatTag; DWORD cbFormatSize; DWORD fdwSupport; DWORD cStandardFormats; char
// szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]; } ACMFORMATTAGDETAILS, *PACMFORMATTAGDETAILS, *LPACMFORMATTAGDETAILS;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMFORMATTAGDETAILS")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct ACMFORMATTAGDETAILS
{
///
/// Size, in bytes, of the ACMFORMATTAGDETAILS structure. This member must be initialized before an application calls the
/// acmFormatTagDetails or acmFormatTagEnum function. The size specified by this member must be large enough to contain the base
/// ACMFORMATTAGDETAILS structure. When the acmFormatTagDetails function returns, this member contains the actual
/// size of the information returned. The returned information will never exceed the requested size.
///
public uint cbStruct;
///
/// Index of the format tag for which details will be retrieved. The index ranges from zero to one less than the number of
/// format tags supported by an ACM driver. The number of format tags supported by a driver is contained in the ACMDRIVERDETAILS
/// structure. The dwFormatTagIndex member is used only when querying format tag details on a driver by index; otherwise,
/// this member should be zero.
///
public uint dwFormatTagIndex;
///
/// Waveform-audio format tag that the ACMFORMATTAGDETAILS structure describes. This member is used for input for the
/// ACM_FORMATTAGDETAILSF_FORMATTAG and ACM_FORMATTAGDETAILSF_LARGESTSIZE query flags. If the acmFormatTagDetails function is
/// successful, this member is always returned. This member should be set to WAVE_FORMAT_UNKNOWN for all other query flags.
///
public uint dwFormatTag;
///
/// Largest total size, in bytes, of a waveform-audio format of the dwFormatTag type. For example, this member will be 16
/// for WAVE_FORMAT_PCM and 50 for WAVE_FORMAT_ADPCM.
///
public uint cbFormatSize;
///
///
/// Driver-support flags specific to the format tag. These flags are identical to the ACMDRIVERDETAILS structure. This member
/// may be some combination of the following values and refer to what operations the driver supports with the format tag:
///
///
///
/// Name
/// Description
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_ASYNC
/// Driver supports asynchronous conversions with the specified format tag.
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CODEC
///
/// Driver supports conversion between two different format tags where one of the tags is the specified format tag. For example,
/// if a driver supports compression from WAVE_FORMAT_PCM to WAVE_FORMAT_ADPCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_CONVERTER
///
/// Driver supports conversion between two different formats of the specified format tag. For example, if a driver supports
/// resampling of WAVE_FORMAT_PCM, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_FILTER
///
/// Driver supports a filter (modification of the data without changing any of the format attributes). For example, if a driver
/// supports volume or echo operations on the specified format tag, this flag is set.
///
///
/// -
/// ACMDRIVERDETAILS_SUPPORTF_HARDWARE
///
/// Driver supports hardware input, output, or both of the specified format tag through a waveform-audio device. An application
/// should use the acmMetrics function with the ACM_METRIC_HARDWARE_WAVE_INPUT and ACM_METRIC_HARDWARE_WAVE_OUTPUT metric
/// indexes to get the waveform-audio device identifiers associated with the supporting ACM driver.
///
///
///
///
public ACMDRIVERDETAILS_SUPPORTF fdwSupport;
///
/// Number of standard formats of the dwFormatTag type; that is, the combination of all sample rates, bits per sample,
/// channels, and so on. This value can specify all formats supported by the driver, but not necessarily.
///
public uint cStandardFormats;
///
/// String that describes the dwFormatTag type. If the acmFormatTagDetails function is successful, this string is always returned.
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = ACMFORMATTAGDETAILS_FORMATTAG_CHARS)]
public string szFormatTag;
}
///
/// The ACMSTREAMHEADER structure defines the header used to identify an ACM conversion source and destination buffer pair
/// for a conversion stream.
///
///
/// Before an ACMSTREAMHEADER structure can be used for a conversion, it must be prepared by using the acmStreamPrepareHeader
/// function. When an application is finished with an ACMSTREAMHEADER structure, it must call the acmStreamUnprepareHeader
/// function before freeing the source and destination buffers.
///
// https://docs.microsoft.com/en-us/windows/win32/api/msacm/ns-msacm-acmstreamheader typedef struct tACMSTREAMHEADER { DWORD
// cbStruct; DWORD fdwStatus; DWORD_PTR dwUser; LPBYTE pbSrc; DWORD cbSrcLength; DWORD cbSrcLengthUsed; DWORD_PTR dwSrcUser; LPBYTE
// pbDst; DWORD cbDstLength; DWORD cbDstLengthUsed; DWORD_PTR dwDstUser; DWORD dwReservedDriver[_DRVRESERVED]; } ACMSTREAMHEADER,
// *PACMSTREAMHEADER, *LPACMSTREAMHEADER;
[PInvokeData("msacm.h", MSDNShortId = "NS:msacm.tACMSTREAMHEADER")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
public struct ACMSTREAMHEADER
{
///
/// Size, in bytes, of the ACMSTREAMHEADER structure. This member must be initialized before the application calls any
/// ACM stream functions using this structure. The size specified in this member must be large enough to contain the base
/// ACMSTREAMHEADER structure.
///
public uint cbStruct;
///
///
/// Flags giving information about the conversion buffers. This member must be initialized to zero before the application calls
/// the acmStreamPrepareHeader function and should not be modified by the application while the stream header remains prepared.
///
///
///
/// Name
/// Description
///
/// -
/// ACMSTREAMHEADER_STATUSF_DONE
/// Set by the ACM or driver to indicate that it is finished with the conversion and is returning the buffers to the application.
///
/// -
/// ACMSTREAMHEADER_STATUSF_INQUEUE
/// Set by the ACM or driver to indicate that the buffers are queued for conversion.
///
/// -
/// ACMSTREAMHEADER_STATUSF_PREPARED
/// Set by the ACM to indicate that the buffers have been prepared by using the acmStreamPrepareHeader function.
///
///
///
public ACMSTREAMHEADER_STATUSF fdwStatus;
/// User data. This can be any instance data specified by the application.
public IntPtr dwUser;
///
/// Pointer to the source buffer. This pointer must always refer to the same location while the stream header remains prepared.
/// If an application needs to change the source location, it must unprepare the header and reprepare it with the alternate location.
///
public IntPtr pbSrc;
///
/// Length, in bytes, of the source buffer pointed to by pbSrc. When the header is prepared, this member must specify the
/// maximum size that will be used in the source buffer. Conversions can be performed on source lengths less than or equal to
/// the original prepared size. However, this member must be reset to the original size when an application unprepares the header.
///
public uint cbSrcLength;
///
/// Amount of data, in bytes, used for the conversion. This member is not valid until the conversion is complete. This value can
/// be less than or equal to cbSrcLength. An application must use the cbSrcLengthUsed member when advancing to the
/// next piece of source data for the conversion stream.
///
public uint cbSrcLengthUsed;
/// User data. This can be any instance data specified by the application.
public IntPtr dwSrcUser;
///
/// Pointer to the destination buffer. This pointer must always refer to the same location while the stream header remains
/// prepared. If an application needs to change the destination location, it must unprepare the header and reprepare it with the
/// alternate location.
///
public IntPtr pbDst;
///
/// Length, in bytes, of the destination buffer pointed to by pbDst. When the header is prepared, this member must
/// specify the maximum size that will be used in the destination buffer.
///
public uint cbDstLength;
///
/// Amount of data, in bytes, returned by a conversion. This member is not valid until the conversion is complete. This value
/// can be less than or equal to cbDstLength. An application must use the cbDstLengthUsed member when advancing to
/// the next destination location for the conversion stream.
///
public uint cbDstLengthUsed;
/// User data. This can be any instance data specified by the application.
public IntPtr dwDstUser;
///
/// Reserved; do not use. This member requires no initialization by the application and should never be modified while the
/// header remains prepared.
///
// Hack to mimic uint[_DRVRESERVED] where _DRVRESERVED is 10 on 32-bit and 15 on 64-bit
private readonly uint dwReservedDriver1;
private readonly uint dwReservedDriver2;
private readonly IntPtr dwReservedDriver6;
private readonly uint dwReservedDriver3;
private readonly uint dwReservedDriver4;
private readonly IntPtr dwReservedDriver7;
private readonly IntPtr dwReservedDriver8;
private readonly IntPtr dwReservedDriver9;
private readonly IntPtr dwReservedDriver10;
private readonly uint dwReservedDriver5;
}
/// Provides a handle to an ACM driver.
[StructLayout(LayoutKind.Sequential)]
public struct HACMDRIVER : IHandle
{
private readonly IntPtr handle;
/// Initializes a new instance of the struct.
/// An object that represents the pre-existing handle to use.
public HACMDRIVER(IntPtr preexistingHandle) => handle = preexistingHandle;
/// Returns an invalid handle by instantiating a object with .
public static HACMDRIVER 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(HACMDRIVER h) => h.handle;
/// Performs an implicit conversion from to .
/// The pointer to a handle.
/// The result of the conversion.
public static implicit operator HACMDRIVER(IntPtr h) => new(h);
/// Implements the operator !=.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator !=(HACMDRIVER h1, HACMDRIVER h2) => !(h1 == h2);
/// Implements the operator ==.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator ==(HACMDRIVER h1, HACMDRIVER h2) => h1.Equals(h2);
///
public override bool Equals(object obj) => obj is HACMDRIVER h && handle == h.handle;
///
public override int GetHashCode() => handle.GetHashCode();
///
public IntPtr DangerousGetHandle() => handle;
}
/// Provides a handle to an ACM driver.
[StructLayout(LayoutKind.Sequential)]
public struct HACMDRIVERID : IHandle
{
private readonly IntPtr handle;
/// Initializes a new instance of the struct.
/// An object that represents the pre-existing handle to use.
public HACMDRIVERID(IntPtr preexistingHandle) => handle = preexistingHandle;
/// Returns an invalid handle by instantiating a object with .
public static HACMDRIVERID 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(HACMDRIVERID h) => h.handle;
/// Performs an implicit conversion from to .
/// The pointer to a handle.
/// The result of the conversion.
public static implicit operator HACMDRIVERID(IntPtr h) => new(h);
/// Implements the operator !=.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator !=(HACMDRIVERID h1, HACMDRIVERID h2) => !(h1 == h2);
/// Implements the operator ==.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator ==(HACMDRIVERID h1, HACMDRIVERID h2) => h1.Equals(h2);
///
public override bool Equals(object obj) => obj is HACMDRIVERID h && handle == h.handle;
///
public override int GetHashCode() => handle.GetHashCode();
///
public IntPtr DangerousGetHandle() => handle;
}
/// Provides a handle to an ACM object.
[StructLayout(LayoutKind.Sequential)]
public struct HACMOBJ : IHandle
{
private readonly IntPtr handle;
/// Initializes a new instance of the struct.
/// An object that represents the pre-existing handle to use.
public HACMOBJ(IntPtr preexistingHandle) => handle = preexistingHandle;
/// Returns an invalid handle by instantiating a object with .
public static HACMOBJ 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(HACMOBJ h) => h.handle;
/// Performs an implicit conversion from to .
/// The pointer to a handle.
/// The result of the conversion.
public static implicit operator HACMOBJ(IntPtr h) => new(h);
/// Implements the operator !=.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator !=(HACMOBJ h1, HACMOBJ h2) => !(h1 == h2);
/// Implements the operator ==.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator ==(HACMOBJ h1, HACMOBJ h2) => h1.Equals(h2);
///
public override bool Equals(object obj) => obj is HACMOBJ h && handle == h.handle;
///
public override int GetHashCode() => handle.GetHashCode();
///
public IntPtr DangerousGetHandle() => handle;
}
/// Provides a handle to an ACM stream.
[StructLayout(LayoutKind.Sequential)]
public struct HACMSTREAM : IHandle
{
private readonly IntPtr handle;
/// Initializes a new instance of the struct.
/// An object that represents the pre-existing handle to use.
public HACMSTREAM(IntPtr preexistingHandle) => handle = preexistingHandle;
/// Returns an invalid handle by instantiating a object with .
public static HACMSTREAM 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(HACMSTREAM h) => h.handle;
/// Performs an implicit conversion from to .
/// The pointer to a handle.
/// The result of the conversion.
public static implicit operator HACMSTREAM(IntPtr h) => new(h);
/// Implements the operator !=.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator !=(HACMSTREAM h1, HACMSTREAM h2) => !(h1 == h2);
/// Implements the operator ==.
/// The first handle.
/// The second handle.
/// The result of the operator.
public static bool operator ==(HACMSTREAM h1, HACMSTREAM h2) => h1.Equals(h2);
///
public override bool Equals(object obj) => obj is HACMSTREAM h && handle == h.handle;
///
public override int GetHashCode() => handle.GetHashCode();
///
public IntPtr DangerousGetHandle() => handle;
}
/// Provides a for that is disposed using .
public class SafeHACMDRIVER : SafeHANDLE
{
/// Initializes a new instance of the class and assigns an existing handle.
/// An object that represents the pre-existing handle to use.
/// to reliably release the handle during the finalization phase; otherwise, (not recommended).
public SafeHACMDRIVER(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// Initializes a new instance of the class.
private SafeHACMDRIVER() : base() { }
/// Performs an implicit conversion from to .
/// The safe handle instance.
/// The result of the conversion.
public static implicit operator HACMDRIVER(SafeHACMDRIVER h) => h.handle;
///
protected override bool InternalReleaseHandle() => acmDriverClose(handle) == MMRESULT.MMSYSERR_NOERROR;
}
/// Provides a for that is disposed using .
public class SafeHACMSTREAM : SafeHANDLE
{
/// Initializes a new instance of the class and assigns an existing handle.
/// An object that represents the pre-existing handle to use.
///
/// to reliably release the handle during the finalization phase; otherwise, (not recommended).
///
public SafeHACMSTREAM(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { }
/// Initializes a new instance of the class.
private SafeHACMSTREAM() : base() { }
/// Performs an implicit conversion from to .
/// The safe handle instance.
/// The result of the conversion.
public static implicit operator HACMSTREAM(SafeHACMSTREAM h) => h.handle;
///
protected override bool InternalReleaseHandle() => acmStreamClose(handle) == MMRESULT.MMSYSERR_NOERROR;
}
}
}