The audio driver is implemented in the wavedev2 mode. This is a single-layer driver mode, and all platform-related functions are implemented in hwctxt. H and hwctxt. in CPP, it also includes MIDI support, software mixer support, S/pdif interface, gain class interface, forcespeaker interface, and so on.
(1) software implementation of the audio system
Audio Device Drivers transmit audio data streams through hardware control, and provide standard audio interfaces to the upper layer. One of the stream interface functions is wav_iocontrol (). It provides an interface for controlling audio devices at the application layer and controls hardware through input and output messages. It mainly includes handlewavemessage () and handlemixermessage (), handlewavemessage () is responsible for transmitting audio data, that is, playing digital audio files and recording operations. handlemixermessage () is responsible for mixing the output audio, such as volume adjustment and high-bass control.
During the audio data sampling process, if the audio sampling frequency is 44.1 kHz, 16 bits per audio channel, and two left and right audio channels, the bitstream is 1.411 Mbps, therefore, it is necessary to use a DMA controller for transmission. (For more information about audio DMA, see DMA on the wince platform)
(2) audio mixing
If you want the sound driver model of Windows CE to support sound mixing, consider the following:
A. Does the sound Device Support Hardware mixing?
B. Sound equipment must work at the same sampling frequency.
C. Sound equipment must be able to support both recording and playing operations
The sound driver is responsible for audio mixing for sound collection and sound mixing. The basic principles are as follows:
A. Set the sound device at a frequency, such as 44.1 kHz and 16 bit.
B. The driver allows multiple audio streams to be opened. Each audio stream allows different sampling rates, for example, (a: 8 kHz, 8 bit B: 44.1 kHz, 16 bit)
C. audio mixing in the final data preparation phase (that is, before DMA), the synthesis algorithm is used to perform mathematical operations on all streams to obtain the sampling frequency (44.1 kHz, 16 bits. Data is sent to codec through DMA.
D. The sound mixing operations of the recording are the basic data obtained from the sampling frequency (44.1 kHz, 16 bit) of the sound equipment, then, the audio streams are allocated to different frequencies through mathematical operations.
(3) audio system software implementation process
Sound releasing:
Recording:
Http://blog.csdn.net/cnhighway/archive/2009/05/15/4188016.aspx ()
Http://blog.sina.com.cn/s/blog_5f61e2240100czqz.html ()