android耳机左右声道接反具体修正方法

时间:2022-02-23 23:13:05

可以用如下方法:
修改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);