Reading and Writing Data

The MCI_MIX_BUFFER structure is used for reading and writing data to and from the mixer.

Once the device is set up and memory has been allocated, the application can use the function pointers obtained during MCI_MIXSETUP to communicate with the mixer. During a playback operation, the application fills the buffers with audio data and then writes the buffers to the mixer device using the pmixWrite entry point. When audio data is being recorded, the mixer device fills the buffers using the pmixRead entry point. Each buffer returned the the application has a time stamp (in milliseconds) attached so the program can determine the current time of the device.

typedef struct_MCI_MIX_BUFFER {
  ULONG  ulStructLength;  /* Length of the structure */
  ULONG  pBuffer;         /* Pointer to a buffer */
  ULONG  ulBufferLength;  /* Length of the buffer */
  ULONG  ulFlags;         /* Flags */
  ULONG  ulUserParm;      /* User buffer parameter */
  ULONG  ulTime;          /* Device time in milliseconds */
  ULONG  ulReserved1;     /* Unused */
  ULONG  ulReserved2;     /* Unused */
  } MCI_MIX_BUFFER;
typedef MCI_MIX_BUFFER *PMCI_MIX_BUFFER

MCI_STOP, MCI_PAUSE, and MCI_RESUME are used to stop, pause, or resume the audio device, respectively. MCI_STOP and MCI_PAUSE can only be sent to the mixer device after mixRead and mixWrite have been called. MCI_RESUME will only work after MCI_PAUSE has been sent.

Note: After your application has completed data transfers, issue MCI_STOP to avoid a pause the next time the mixer device is started.