Audio Device Capabilities

If MCI_GETDEVCAPS_EXTENDED is specified in conjunction with MCI_GETDEVCAPS_ITEM, the MCI_GETDEVCAPS_WAVE_FORMAT value can be placed in the ulItem field for the waveaudio device as an extended request. The MCI_GETDEVCAPS_WAVE_FORMAT value allows an application to query if the device supports a specific waveaudio format. The application must fill in the ulBitsPerSample, ulFormatTag, ulSamplesPerSec, ulChannels, and ulFormatMode fields in the MCI_WAVE_GETDEVCAPS_PARMS data structure. The driver returns MCI_TRUE if the format is supported or returns a specific error describing why the command field failed if the format is not supported.

The following code fragment shows a portion of the Audio Recorder Sample program provided in the Toolkit (\TOOLKIT\SAMPLES\MM\RECORDER). This program uses the MCI_GETDEVCAPS message to determine the capabilities of the currently selected waveaudio device.

  ULONG                     ulRC;         /* return code from function */
  MCI_WAVE_GETDEVCAPS_PARMS mciAudioCaps; /* MCI_GETDEVCAPS_PARMS
                                             structure */
  memset( &mciAudioCaps , 0, sizeof(MCI_WAVE_GETDEVCAPS_PARMS));

  /* Test to see if the device can play 11 kHz, 8-bit, mono files. */
  mciAudioCaps.ulBitsPerSample = 8;
  mciAudioCaps.ulFormatTag     = DATATYPE_WAVEFORM;
  mciAudioCaps.ulSamplesPerSec = 11025;
  mciAudioCaps.ulChannels      = 1;
  mciAudioCaps.ulFormatMode    = MCI_PLAY;
  mciAudioCaps.ulItem          = MCI_GETDEVCAPS_WAVE_FORMAT;

  ulRC = mciSendCommand (mciOpenParms.usDeviceID,   /* Device ID    */
                         MCI_GETDEVCAPS,
                         MCI_WAIT | MCI_GETDEVCAPS_EXTENDED
                              | MCI_GETDEVCAPS_ITEM,
                         (PVOID) &mciAudioCaps,
                         0);
       .
       .
       .

/* Test to see if the device can record 11 kHz, 16-bit, mono files. */
  mciAudioCaps.ulBitsPerSample = 16;
  mciAudioCaps.ulFormatTag     = DATATYPE_WAVEFORM;
  mciAudioCaps.ulSamplesPerSec = 11025;
  mciAudioCaps.ulChannels      = 1;
  mciAudioCaps.ulFormatMode    = MCI_RECORD;
  mciAudioCaps.ulItem          = MCI_GETDEVCAPS_WAVE_FORMAT;

  ulRC = mciSendCommand (mciOpenParms.usDeviceID,  /* Device ID     */
                         MCI_GETDEVCAPS,
                         MCI_WAIT | MCI_GETDEVCAPS_EXTENDED
                              | MCI_GETDEVCAPS_ITEM,
                         (PVOID) &mciAudioCaps,
                         0);


[Back: M-Audio Adapter Specifics]
[Next: Using the Waveform Audio Device]