/*******************************************************************
• 此文章解释权归windsome所有,如要转载无须联系本人。
• 转载需要包含此抬头信息,如有疑问,欢迎联系本人。
• QQ: 35327864
• msn: fgwf1@hotmail.com
• mail: agooou@gmail.com
********************************************************************/
音频解码的核心过程由AudioEngine和AudioDecoder模块组成。每个AudioEngine模块可以包含2个AudioDecoder实例,每个AudioDecoder都可以独立解码一个音频流。当前的主要音频标准有:MPEG-1,AC-3,MP3,AAC,DTS,LPCM,MPL,WMA和WMA-Pro。
AudioDecoder模块从应用程序或demux模块获取音频数据和timestamp信息,这些数据被传递到相应的解码器。
数据被硬件解码成一个个sample放入到sampleFIFO中,之后被串行输出到放音设备,可以通过I2S和S/PDIF。
AudioDecoder模块通过EmhwlibSetAudioDecoderProperty, EMhwlibGetAudioDecoderProperty和 EMhwlibrExchangeAudioDecodeProperty这几个函数去get,set,exchage属性。
err = RUAGetProperty(pRUA, audio_decoder, RMAudioDecoderPropertyID_State, &state, sizeof(state));
err = RUASetProperty(pRUA, audio_decoder, RMAudioDecoderPropertyID_Command, &a_command, sizeof(a_command), 0);
err = RUAExchangeProperty(pRUA, audio_decoder, RMAudioDecoderPropertyID_DRAMSizeX, &dram_in, sizeof(dram_in), &dram_out, sizeof(dram_out));
AudioEngine同样用类似的方法去操作,分别是EmhwlibSetAudioEngineProperty, EMhwlibGetAudioEngineProperty和 EMhwlibExchangeAudioEngineProperty
对于SMP865X系列,最多有2个AudioEngine,一个AudioEngine内最多有2个AudioDecoder。目前设置不能分别设置decoder的音量,只能对AudioEngine设置音量。
如下为设置音量过程(对12个channel都做音量设置):
struct AudioEngine_Volume_type audio_volume;
RMuint32 audio_engine = EMHWLIB_MODULE(AudioEngine, pMainContext->AudioEngineID);
for (int i = 0; i <= 11; i++) {
audio_volume.Channel = i;
audio_volume.Volume = 0x10000000; //0db
DCCSP(pMainContext->pRUA, audio_engine, RMAudioEnginePropertyID_Volume, &audio_volume, sizeof(audio_volume));
}
SMP865X广告机之音频
最新推荐文章于 2012-01-19 13:02:30 发布