次の方法で共有


Playing and Recording (Windows Embedded CE 6.0)

1/6/2010

The play operation involves an interrupt and two direct memory access (DMA) buffers for output data. The wave API manager prepares the data blocks and sends them to the audio driver's MDD layer. The MDD looks for block data to be played.

If MDD finds block data, it calls the PDD_WaveProc function by using the WPDM_START message. The PDD copies data from the block to the temporary DMA buffers. The DMA begins playing the data.

When the first of the two buffers finishes playing, an interrupt occurs. The PDD should report the interrupt to be of type AUDIO_STATE_OUT_PLAYING.

If there is more data to be played, the MDD sends the message WPDM_CONTINUE. Otherwise, it sends WPDM_ENDOFDATA.

As data blocks finish playing, the MDD marks them as complete and sends them back to the wave API manager.

The PDD should alternate between the two DMA buffers, filling one buffer as the other plays.

If the reserve buffer is not full before the first buffer's data is finished playing, the PDD layer should report this with the return value AUDIO_STATE_OUT_UNDERFLOW. This gives the MDD layer an opportunity to synchronize and continue playing.

The record operation uses a similar mechanism to the play operation, but in reverse order.

Recording starts with the PDD message WPDM_START, but no data is copied until the first DMA buffer is full. Then, the PDD copies the data from the DMA buffer into the user block. Again, as blocks are filled, the MDD returns them to the wave API manager.

Recording continues until the user application requests a stop and sends the WPDM_STOP message.

Note

Audio drivers should always inspect the header information on audio data to ensure that the format matches driver expectations. The driver should also exercise care when referencing the cbSize member of WAVEFORMATEX (Waveform Audio). This filed is only defined if wFormatTag is not WAVE_FORMAT_PCM. If wFormatTag is WAVE_FORMAT_PCM, cbSize should be ignored and is assumed to be zero.

See Also

Concepts

Sample Wavedev Drivers