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