win mobile audio
来源:互联网 发布:摄影书籍推荐知乎 编辑:程序博客网 时间:2024/05/22 01:51
Audio Architecture
l TheAudio Device Manager is a common name for the OS code between applications using the waveform audio API and audio device drivers. It manages audio devices, includes the software-based mixer in the kernel, and handles various aspects of security, inter-process communication, application callbacks.
Audio Compression Manager
The Audio Compression Manager (ACM) adds system-level support for the following services:
- Transparent run-time audiocompression and decompression
- Waveform Audio data format selection
- Waveform audio datafilter selection
- Waveform audio dataformat conversion
- Waveform audio datafiltering
MIDI
The following table shows the MIDI capabilities that are supported.
Capability
Description
Instruments
Sine wave generation, no other instruments.
Polyphony
No limit on the number of midi streams. Number of concurrent notes per stream limited by the capabilities of the driver, and is set to 32 for all sample drivers.
In practice, the total number of notes will be limited by the power of the CPU. Most devices should be capable of playing eight to ten notes concurrently.
Messages
Only note on, note off, and all notes off.
Timing
Sample accurate.
Extensions
Supports arbitrary frequency tone generation and tempo changes.
How to Play MIDI notes:
1. Build a MIDI waveformat header
2. Call function waveOutOpen to open the waveform audio device.
3. Build a MIDI buffer.
4. Call waveOutWrite to pass buffers to the driver and begin to play.
5. wait for playback to complete
6. cleanup and then return.
Waveform Audio
The waveform audio API provides:
Ø an application exact control overwaveform audio input/output devices.
Ø It also supports thehardware audio mixer API.
Ø In addition to providing volume control, the waveform audio API provides routing services to manage audio lines on your device for playing or recording. Routing services require specific hardware device and driver support. The mixer architecture allows several audio source lines to be mapped to a single destination audio line.
Hardware Audio Mixer
Audio mixer services control the routing of audio lines to a destination device for playing or recording. These services can also control volume and other effects.
The basic element of the mixer architecture is anaudio line. An audio line consists of one or more channels of data originating from a single source or a system resource. For example, a stereo audio line has two data channels, but it is considered a single audio line because it originates from a single source.
The mixer architecture provides routing services to manage audio lines on a computer. You can use the routing services if you have adequate hardware devices and software drivers installed. The mixer architecture allows several audio source lines to map to a single destination audio line.
Each audio line can have mixer controls associated with it. A mixer control can perform any number of functions, such as control volume, depending on the characteristics of the associated audio line.
Audio Compression Manager(ACM) Drivers
ACM drivers are stream interface drivers. Unlike other stream interface drivers, applications do not use these drivers directly. ACM drivers are called by the ACM, which sends messages to ACM drivers when applications need to play or record sounds
Ø Tosupport a particular audio file format. For example, audio files in other formats need customized ACM drivers.
Ø Toconvert audio file format to another format. The ACM driver APIs can be used to load an audio file into a common format, which ACM drivers can then translate into their own format.
Ø To use anencoding or compression algorithm tailored to the characteristics of a particular type of audio. For example, human speech has a relatively limited frequency range and many essentially silent periods. An ACM driver written with these characteristics in mind can produce recordings that require little memory and yet retain good sound quality.
Ø To performfiltering of audio data. For example, an ACM driver could be used to filter a data stream out of an audio signal that contains speech in the lower frequencies and data in the higher frequencies.
Codec
Codecs convert one audio format type to another; typically, a compressed format to an uncompressed format. A codec can convert a compressed format, such as MS-ADPCM, to an uncompressed format, such as PCM, which most audio hardware can play directly.
Converter
Converters change one variety of a format to another. For example, a converter can convert a PCM audio stream sampled at 44 kilohertz (kHz) to a PCM audio stream sampled at 11 kHz.
Filter
Filters modify audio data without changing the format of the data. Filters generally are used toadd some sort of audio effect to an audio stream. Filters perform tasks, such as equalizing graphics or adding an echo to an audio stream.
Audio Compression Manager Driver Reference
ACM Driver Functions
The following table shows the ACM functions and their associated calls.
Programming element
Description
ACM_Close
Called by the ACM when the driver is no longer needed.
ACM_Deinit
Called by the Device Manager when the driver is unloaded.
ACM_Init
Called by the Device Manager when the driver is loaded.
ACM_IOControl
Called by the ACM to pass messages to and receive information from the driver.
ACM_Open (ACM Driver)
Called by the ACM when the driver is opened for use.
ACM_PowerDown
Called by the Device Manager when the system enters the suspend state.
ACM_PowerUp
Called by the Device Manager when the system resumes from the suspend state.
ACM_Read
Never called.
ACM_Seek
Never called.
ACM_Write
Never called.
ACM Driver Messages
The following table lists the messages that the ACM passes to the ACM drivers.
Programming element
Description
ACMDM_DRIVER_ABOUT
Message that requests that the driver display its About dialog box.
ACMDM_DRIVER_DETAILS
Message that requests that the driver return detailed information about its capabilities.
ACMDM_DRIVER_NOTIFY
Message that notifies the driver of changes to other ACM drivers.
ACMDM_FILTER_DETAILS
Message that requests information about a filter that is associated with a specified filter tag.
ACMDM_FILTERTAG_DETAILS
Message that requests information about a specified filter tag.
ACMDM_FORMAT_DETAILS
Message that requests information about the format that is associated with a specified filter tag.
ACMDM_FORMAT_SUGGEST
Message that requests that the driver suggest a target conversion format for a specified source format.
ACMDM_FORMATTAG_DETAILS
Message that requests information about a format tag.
ACMDM_HARDWARE_WAVE_CAPS_INPUT
Message that requests information about the input capabilities of the audio hardware.
ACMDM_HARDWARE_WAVE_CAPS_OUTPUT
Message that requests information about the output capabilities of the audio hardware.
ACMDM_STREAM_CLOSE
Message that requests that the driver close a conversion stream.
ACMDM_STREAM_CONVERT
Message that requests that the driver convert an audio stream.
ACMDM_STREAM_OPEN
Message that requests that the driver open a new audio stream.
ACMDM_STREAM_PREPARE
Message that requests that the driver prepare any buffers that are associated with an audio stream.
ACMDM_STREAM_RESET
Message that requests that the driver stop operations on an audio stream.
ACMDM_STREAM_SIZE
Message that requests that the driver return the size that is required for a source or destination buffer.
ACMDM_STREAM_UNPREPARE
Message that requests that the driver clear any prepared buffers that are associated with an audio stream.
DRV_CLOSE
This message requests a driver to be closed. The codec receives a DRV_CLOSE message for each DRV_OPEN message that succeeds.
DRV_OPEN
This message requests a driver to be opened. Drivers are opened for many reasons. The most common reason is preparation for data conversion. Your driver must be able to handle multiple open-driver instances correctly. Multiple streams can and will be opened on a single driver instance. Do not store and/or create instance data that is unique to a stream.
ACM Driver Structures
The following table shows the structures related to the Audio Compression Manager (ACM) driver.
Programming element
Description
ACMDRV_MESSAGE_PARAMS
Structure that contains members passed to the ACM_IOControl function.
ACMDRVFORMATSUGGEST
Structure that contains client-specified input arguments to the AcmFormatSuggest function. The ACM fills in this structure with the client's input arguments and passes it to an ACM driver with an ACMDM_FORMAT_SUGGEST message.
ACMDRVOPENDESC
Structure that is used by the ACM for passing information to an ACM driver after the ACM sends the driver an ACM_Open function.
ACMDRVSTREAMHEADER
Structure that describes a source buffer and a destination buffer associated with a conversion stream.
ACMDRVSTREAMINSTANCE
Structure that describes an instance of a conversion stream.
ACMDRVSTREAMSIZE
Structure that contains information needed by an ACM driver to respond to an ACMDM_STREAM_SIZE message
Audio Mixer Driver Reference
Audio Mixer Messages
The Audio Mixer messages for theWAV_IOControl function are defined in the following table.
Programming element
Description
MXDM_CLOSE
Requests a user-mode mixer driver to close the specified device instance.
MXDM_GETCONTROLDETAILS
Requests a user-mode mixer driver to return detailed information about the specified control on the specified audio line.
MXDM_GETDEVCAPS
Requests a user-mode mixer driver to return capabilities information about the specified device.
MXDM_GETLINECONTROLS
Requests a user-mode mixer driver to return information about specified controls connected to a specified audio line for the specified device.
MXDM_GETLINEINFO
Requests a user-mode mixer driver to return information about a specified audio line for the specified device.
MXDM_GETNUMDEVS
Requests a user-mode mixer driver to return the number of device instances that it supports.
MXDM_INIT
Message received by the user-mode mixer driver's mxdMessage function while the driver is being installed.
MXDM_OPEN
Requests a user-mode mixer driver to open an instance of the specified device.
MXDM_SETCONTROLDETAILS
Requests a user-mode mixer driver to set information about specified controls connected to a specified audio line for a specified device.
Audio Mixer Structures
MIXEROPENDESC
typedef struct tMIXEROPENDESC {
HMIXER hmx; // handle to the device
LPVOID pReserved0; // reserved
DWORD dwCallback; // address of the callback function
DWORD dwInstance; // the application’s private instance info.
} MIXEROPENDESC, *PMIXEROPENDESC;
Waveform Audio Driver Reference
Waveform Audio Driver Functions
The following table shows the stream interface functions for the audio driver.
Programming element
Description
WAV_Close
This function closes the WAV I/O device.
WAV_Deinit
This function de-initializes the WAV I/O device.
WAV_Init
This function initializes the WAV I/O device.
WAV_IOControl
This function is the device I/O control routine for the WAV I/O device.
WAV_Open
This function opens the WAV I/O device.
WAV_PowerDown
This function turns off the WAV I/O device.
WAV_PowerUp
This function notifies the WAV I/O device that the system is leaving the suspend state.
WAV_Read
This function is the read routine for the WAV I/O device driver.
WAV_Seek
This function is the seek routine for the WAV I/O device.
WAV_Write
This function is the write routine for the WAV I/O device.
Waveform Audio Driver Structures
The following table shows the structures related to the WAV I/O device driver.
Programming element
Description
MMDRV_MESSAGE_PARAMS
Passed to theWAV_IOControl function.
WAVEOPENDESC
Contains information needed by waveform input and output drivers.
WAVEOUTEXTCAPS
Contains extended device caps information.
WAVEPROPINFO
Contains waveform input and output driver property information
Waveform Input Driver Messages
The following table shows the waveform input driver messages (WIDM_XXX).
Programming element
Description
WIDM_ADDBUFFER
This message is used to request a waveform input driver to add an empty input buffer to its input buffer queue.
WIDM_CLOSE
This message is used to request a waveform input driver to close a specified device instance previously opened with WIDM_OPEN.
WIDM_GETDEVCAPS
This message is used to request a waveform input driver to return the capabilities of a specified device.
WIDM_GETNUMDEVS
This message is used to request a waveform input driver to return the number of devices that it supports.
WIDM_GETPOS
This message is used to request a stream input driver to return the current input position within a waveform. The input position is relative to the first recorded sample of the waveform.
WIDM_GETPROP
This message is used to reqest the properties of a waveform input driver.
WIDM_OPEN
This message is used to request a waveform input driver to open a stream of a specified device.
WIDM_PREPARE
This message is used to request a waveform input driver to prepare a system-exclusive data buffer for input.
WIDM_RESET
This message is used to request a waveform input driver to stop recording and return all buffers in the input queue to the caller.
WIDM_SETPROP
This message isused to request a waveform input driver to change properties.
WIDM_START
This message is used to request a waveform input driver to begin recording.
WIDM_STOP
This message is used to request a waveform input driver to stop recording.
WIDM_UNPREPARE
This message is used to request a waveform input driver to undo the buffer preparation that was performed in response to a WIDM_PREPARE message.
Waveform Output Driver Messages
The following table shows the waveform output driver messages (WODM_XXX).
Programming element
Description
WODM_BREAKLOOP
This message is used to request a waveform output driver to break an output loop that was created with a WODM_WRITE message.
WODM_CLOSE
This message is used to request a waveform output driver to close a specified stream that was previously opened with a WODM_OPEN message.
WODM_GETDEVCAPS
This message is used to request a waveform output driver to return the capabilities of a specified device.
WODM_GETEXTDEVCAPS
This message is used in an MMDRV_MESSAGE_PARAMS structure passed to the WAV_IOControl function to request a waveform output driver to return the extended capabilities of a specified device.
WODM_GETNUMDEVS
This message is used to request a waveform output driver to return the number of device instances that it supports.
WODM_GETPITCH
This message is used to request a waveform output driver to return the specified device's current pitch multiplier value.
WODM_GETPLAYBACKRATE
This message is to request a waveform output driver to return the current playback rate multiplier value for the specified device.
WODM_GETPOS
This message is used to return the current position within a stream. The position is relative to the beginning of the waveform.
WODM_GETPROP
This message is used to request the properties of a waveform output driver.
WODM_GETVOLUME
This message is used to request a waveform output driver to return the current volume level setting for the specified device or stream.
WODM_OPEN
This message is used to request a waveform output driver to open a stream on the specified device.
WODM_PAUSE
This message is used to request a waveform output driver to pause playback of a waveform.
WODM_PREPARE
This message is used to request a waveform output driver to prepare a system-exclusive data buffer for output.
WODM_RESET
This message is used to request a waveform output driver to stop sending output data and return all output buffers to the list.
WODM_RESTART
This message is used to request a waveform output driver to continue playback of a waveform after playback has been paused with WODM_PAUSE.
WODM_SETPITCH
This message is used to request a waveform output driver to set the specified device's pitch multiplier value.
WODM_SETPLAYBACKRATE
This message is used to request a waveform output driver to set the playback rate multiplier value for the specified device.
WODM_SETPROP
This message isused to request a waveform output driver to change properties.
WODM_SETVOLUME
This message is used to request a waveform output driver to set the playback rate multiplier value for the specified device.
WODM_UNPREPARE
This message is used to request a waveform output driver to remove the buffer preparation performed in response to WODM_PREPARE.
WODM_WRITE
This message is used to request a waveform output driver to write a waveform data block to the specified device
- win mobile audio
- 重新拿起WIN MOBILE
- 初识WINCE和WIN MOBILE
- WIN MOBILE UI开发入门
- WIN MOBILE UI开发入门
- WIN MOBILE UI开发入门
- win mobile RDA 入门范例
- win音视频--枚举window系统Audio
- Win Mobile利用mapirule接收短信
- Win Mobile利用mapirule接收短信
- Win Mobile 获取Cell ID(再一次失败)
- Win mobile will be dead by 2011?
- WinCE 和Win Mobile的关系
- Win Mobile利用mapirule接收短信
- win mobile 开发应用软件环境搭建
- 《一》 Win Mobile 入门(摘录)
- Win CE/Mobile Physical/Virtual cached/uncached
- win mobile 通过ActiveSync和Google帐户进行同步
- 如何根据相机的参数知道摄像机的内参数矩阵
- JS函数的定义也有文章
- I2C--中断
- 通过Web Services上传和下载文件
- 关于在RHEL5下VPN搭建出现619错误的解决办法
- win mobile audio
- 尾递归与Continuation
- 白盒测试之基本路径测试法
- 写Makefile(三)
- steve专栏
- 谁谁谁的话
- JSP的那些事儿(3)----在Linux下安装Tomcat
- Build process in Windows Mobile
- 数据库死锁-解锁