mt6735 耳机左右声道接反,软件如何修正
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
硬件工程师不小心将耳机左右声道输出接反,软件该如何修改将其修正
[SOLUTION]
可以用如下方法:
修改AudioYusuStreamOut.cpp,添加方法:
void AudioYusuStreamOut::swS2M(const void* buffer, size_t bytes)
{
uint32 Idx_i;
int16 PCM_M;
short* pbuffer=(short*)buffer;
{
//enable software stereo to mono
for(Idx_i = 0; Idx_i<bytes>>1; Idx_i+=2)
{
PCM_M = pbuffer[Idx_i+1];
pbuffer[Idx_i+1]=pbuffer[Idx_i];
pbuffer[Idx_i]=PCM_M;
}
}
}
修改ssize_t AudioYusuStreamOut::write(const void* buffer, size_t bytes)
在 dumpPcmData(streamout_ori,outbuffer,bytes,streamout_ori_propty);
之前添加:swS2M(buffer,bytes);
硬件工程师不小心将耳机左右声道输出接反,软件该如何修改将其修正
[SOLUTION]
可以用如下方法:
修改AudioYusuStreamOut.cpp,添加方法:
void AudioYusuStreamOut::swS2M(const void* buffer, size_t bytes)
{
uint32 Idx_i;
int16 PCM_M;
short* pbuffer=(short*)buffer;
{
//enable software stereo to mono
for(Idx_i = 0; Idx_i<bytes>>1; Idx_i+=2)
{
PCM_M = pbuffer[Idx_i+1];
pbuffer[Idx_i+1]=pbuffer[Idx_i];
pbuffer[Idx_i]=PCM_M;
}
}
}
修改ssize_t AudioYusuStreamOut::write(const void* buffer, size_t bytes)
在 dumpPcmData(streamout_ori,outbuffer,bytes,streamout_ori_propty);
之前添加:swS2M(buffer,bytes);