To initialize the audio device, the waveform audio MCD needs information about the data element to be played. The driver makes a call to mmioGetHeader, which returns information contained in the header of the waveform element (for example, whether the data was recorded in stereo or mono, what its sampling rate and bits-per-sample are, and so on.). AUDIOMCD parses this information and puts it into the instance structure. Next, the instance structure is passed to AUDIOIF, which uses the information to initialize the device by means of the IOCtl interface.

  /*******************************************************
  * A streaming MCD should utilize MMIO to perform all
  * file manipulations.  If we use MMIO, then the MCD
  * will be free from file dependencies (that is, if a RIFF
  * IOProc or a VOC IOProc is loaded will be irrelevant.
  ********************************************************/

  ulrc = mmioGetHeader ( ulpInstance->hmmio,
                         (PVOID) &ulpInstance->mmAudioHeader ,
                         sizeof( ulpInstance->mmAudioHeader ),
                         (PLONG) &BytesRead,
                         (ULONG) NULL,
                         (ULONG) NULL);

  if ( ulrc == MMIO_SUCCESS )
      {

      /******************************************
      * Copy the data from the call into the instance
      * so that we can set the amp/mixer up with the
      * values that the file specifies.
      ******************************************/

      AMPMIX.sMode            = WAVEHDR.usFormatTag;
      AMPMIX.sChannels        = WAVEHDR.usChannels;
      AMPMIX.lSRate           = WAVEHDR.ulSamplesPerSec;
      AMPMIX.lBitsPerSRate    = WAVEHDR.usBitsPerSample;
      ulpInstance->ulDataSize = XWAVHDR.ulAudioLengthInBytes;
      AMPMIX.ulBlockAlignment = ( ULONG )WAVEHDR.usBlockAlign;
      ulpInstance->ulAverageBytesPerSec = WAVEHDR.usChannels *
         WAVEHDR.ulSamplesPerSec * ( WAVEHDR.usBitsPerSample / 8 );

      } /* SuccesFul GetHeader */

    else
      {
      ulrc = mmioGetLastError( ulpInstance->hmmio );

      }
      return (ulrc);

}  /* GetAudioHeader */

The handle hmmio that is passed to mmioGetHeader was returned by the call to mmioOpen to open the data element. The buffer pointed to by mmAudioHeader is filled in by the MMIO Manager on return from mmioGetHeader. It is an MMAUDIODATA structure. When the MMAUDIODATA structure is returned by mmioGetHeader, it contains all the information the waveform audio MCD needs to initialize the audio device. The information includes:


[Back] [Next]