android 耳机左右声道接反,软件如何修正

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

你可能感兴趣的:(android)