Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The following table shows the functions that retrieve the number of audio devices on a Windows Embedded CE–based device.
Function | Description |
---|---|
Retrieves the number of waveform audio input devices that are present in a system. |
|
Retrieves the number of waveform audio output devices that are present in a system. |
After you determine how many audio devices are present in a system, you can query the capabilities of each device. The following table shows the functions and structures that retrieve this information.
Function | Description | Returned structure |
---|---|---|
Retrieves the capabilities of a specified waveform audio input device. |
||
Retrieves the capabilities of a specified waveform audio output device. |
The waveInGetDevCapsand waveOutGetDevCapsfunctions fill the dwFormatsmember of the WAVEINCAPSand WAVEOUTCAPSstructures with flags that describe the standard supported sound formats for a specified audio I/O device. Waveform audio I/O devices also support nonstandard capabilities. You also can use the waveInOpenor the waveOutOpenfunction to determine if a waveform audio I/O device supports a specified format.
-
The common order for calling Waveform Audio functions to play audio is:
-
Specify the format that you want to query in the WAVEFORMATEXstructure.
-
Pass this structure into waveInOpenor waveOutOpenby using the pwfxparameter.
-
Call waveInOpenor waveOutOpenwith the WAVE_FORMAT_QUERY flag set.
This call does not open the device. Instead, the function returns a message that declares whether or not the audio device supports the specified format.
Note: Although the WAVEFORMATEXstructure supersedes the PCMWAVEFORMATand WAVEFORMATstructures, Windows Embedded CE maintains both of these structures for backward compatibility.
The following code example shows how to use the waveOutOpenfunction with the WAVE_FORMAT_QUERY flag to determine if a waveform audio device supports a specified format.
Copy Code | |
---|---|
MMRESULT IsFormatSupported (LPWAVEFORMATEX pwfx, UINT uDeviceID) { return waveOutOpen (NULL, // ptr can be NULL for query uDeviceID, // The device identifier pwfx, // Defines the requested // format. NULL, // No callback NULL, // No instance data WAVE_FORMAT_QUERY); // Query only, do not open. } |
The preceding example determines if the specified waveform audio output device supports a specified waveform audio format. It returns the MMSYSERROR_NOERROR return value if the device supports the format, the WAVERROR_BADFORMAT return value if the device does not support the format, and one of the other MMSYSERROR return values for other errors.
This technique for determining nonstandard format support also applies to waveform audio input devices. The only difference is that the function will use waveInOpeninstead of waveOutOpento query for format support.
To determine if any waveform audio I/O devices on a system support a particular waveform audio data format, use the technique that is illustrated in the previous example. However, you must specify the WAVE_MAPPER constant in the uDeviceIDparameter.