Stopping, Pausing, and Restarting a Waveform Audio I/O Device

While recording or playing waveform audio, you might want to stop, pause, or restart the audio I/O device. The following table shows the functions that control these capabilities.

Function
Description
waveInStop Stops recording on a waveform audio input device
waveOutPause Pauses playback on a waveform audio output device
waveInReset Stops recording on a waveform audio input device and marks all pending data blocks as done
waveOutReset Stops playback on a waveform audio output device and marks all pending data blocks as done
waveInStart Begins recording on a waveform audio input device
waveOutRestart Resumes playback on a paused waveform audio output device

Generally, the waveform audio I/O device begins recording or playing as soon as the waveOutWrite or waveInAddBuffer function sends the first waveform-audio data block.

    To delay activation of waveform-audio output

  1. Call waveOutPause to pause the waveform-audio output device.
  2. Call waveOutWrite.

    This sends the first data block to the waveform-audio output device. However, the device is paused by the previous call to waveOutPause.

  3. Call waveOutRestart to begin playback.

Once the device begins playback, it might not respond to waveOutPause immediately. Depending on the device driver, the device might finish playing the current data block before pausing.

You can also delay activation of waveform-audio input. Call waveInAddBuffer as needed to allocate space for the audio input. The device will not begin recording until you call waveInStart.

Once the device stops recording or playback in response to a waveOutReset or waveInReset command, you cannot restart playback with waveOutRestart or waveInStart. Instead, resume recording or playback by sending the next data block with waveOutWrite or waveInAddBuffer and waveInStart.