Preparing to Stream the Waveform Data

When the waveform audio MCD receives a request to open a device, it issues SpiGetHandler and passes the names of the source and target stream handlers to the Sync/Stream Manager (SSM), so that it knows which stream handlers are going to stream the data. Data streaming cannot begin until the SSM has this information.

  /*********************************************************
  * Get 'A' stream Handler Handles for Source & target operations
  * The file system stream handler is the default 'A' handler
  * but the memory stream handler will be used for playlists.
  **********************************************************/


     if (ulrc = SpiGetHandler((PSZ)DEFAULT_SOURCE_HANDLER_NAME,
                               &hidASource,
                               &hidATarget))
        {
        return ( ulrc );
        }


  /***********************************************************
  * Get 'B' stream Handler Handles for Source & target operations
  * The audio stream handler is considered the B stream handler
  * since it will usually be the target.
  *************************************************************/

  ulrc = SpiGetHandler( (PSZ)DEFAULT_TARGET_HANDLER_NAME,
                        &hidBSource,
                        &hidBTarget);

  return ( ulrc );

After the waveform audio MCD gets its handler IDs, it must fill in the SPCBKEY data structure to tell the SSM what kind of data it is going to stream. SPCBKEY consists of three fields; the data type and two subdata types. For example, it might tell the SSM, "I'm going to stream PCM data at 8 bits, 22 kHz."

Next, the waveform audio MCD must fill in the device control block (DCB) to tell the SSM which device is being streamed to (as shown in the following example. The DCB contains two essential items of information:

The ASCII string device name is obtained from the INI file and passed down by MDM. The device handle is the system file number returned by the IOCtl when the open to the device was done from AUDIOIF.

   SysInfo.ulItem       = MCI_SYSINFO_QUERY_NAMES;   SysInfo.usDeviceType  = LOUSHORT(ulDeviceType);
   SysInfo.pSysInfoParm = &QueryNameParm;

   itoa (HIUSHORT(ulDeviceType), szIndex, 10);

   szIndex[1] = '\0';

   strncat (szAmpMix, szIndex, 2);
   strcpy (QueryNameParm.szLogicalName, szAmpMix);

   if (rc = mciSendCommand (0,
                            MCI_SYSINFO,
                            MCI_SYSINFO_ITEM | MCI_WAIT,
                            (PVOID) &SysInfo,
                            0))
           return (rc);




   /*******************************************
   * Get PDD associated with our AmpMixer
   * Device name is in pSysInfoParm->szPDDName
   ********************************************/

   SysInfo.ulItem       = MCI_SYSINFO_QUERY_DRIVER;
   SysInfo.usDeviceType  = (USHORT) ulDeviceType;
   SysInfo.pSysInfoParm = &SysInfoParm;

   strcpy (SysInfoParm.szInstallName, QueryNameParm.szInstallName);

   if (rc = mciSendCommand (0,
                            MCI_SYSINFO,
                            MCI_SYSINFO_ITEM | MCI_WAIT,
                            (PVOID) &SysInfo,
                            0))
       return (rc);

   strcpy (szPDDName, SysInfoParm.szPDDName);

   return ( MCIERR_SUCCESS );

} /* GetPDDName */


[Back: Sync/Stream Operations]
[Next: Creating the Stream]