|
Determining Nonstandard Format Support
To see whether a device supports a particular format (standard or
nonstandard), you can call the waveOutOpen function with the WAVE_FORMAT_QUERY flag. The following example uses this
technique to determine whether a waveform-audio device supports a specified format.
// Determines whether the specified waveform-audio output device
// supports a specified waveform-audio format. Returns
// MMSYSERR_NOERROR if the format is supported, WAVEERR_BADFORMAT if
// the format is not supported, and one of the other MMSYSERR_ error
// codes if there are other errors encountered in opening the
// specified waveform-audio device.
MMRESULT IsFormatSupported(LPWAVEFORMATEX pwfx, UINT uDeviceID)
{
return (waveOutOpen(
NULL, // ptr can be NULL for query
uDeviceID, // the device identifier
pwfx, // defines requested format
NULL, // no callback
NULL, // no instance data
WAVE_FORMAT_QUERY)); // query only, do not open device
}
This technique for determining nonstandard format support also applies to
waveform-audio input devices. The only difference is that the waveInOpen function is used in place of waveOutOpen to query for format support.
To determine whether a particular waveform-audio data format is supported by
any of the waveform-audio devices in a system, use the technique illustrated in
the previous example, but specify the WAVE_MAPPER constant for the uDeviceID parameter.
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
More Online Helps
Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|