I have been able to achieve the same in Linux using ALSA .asoundrc
configuration file. Once we specify duplication to be done on channels
then ALSA automatically takes care of playing stereo data on all the
channels.
However, it does not seems to work from Android as we have strip down
version of ALSA here. The only option I see now is to do copying of
32bit stereo output coming from the decoder into 256bit and send it to
DAC.

Where can I put my code for data duplication ?
1. AudioHardwareALSA.cpp

int AndroidAudioOutput::audout_thread_func()
{
  snd_pcm_writei(mHandle->handle,
                           (char *)buffer + sent,
                           snd_pcm_bytes_to_frames(mHandle->handle,
bytes - sent));
}

I think we can duplicate data here before sending...

2. Android_audio_output.cpp
int AndroidAudioOutput::audout_thread_func()
{
                bytesToWrite = bytesAvailInBuffer > len ? len :
bytesAvailInBuffer;
                //LOGV("16 bit :: cmdid = %d, len = %u,
bytesAvailInBuffer = %u, bytesToWrite = %u", cmdid, len,
bytesAvailInBuffer, bytesToWrite);
                bytesWritten = mAudioSink->write(data, bytesToWrite);
                if (bytesWritten != bytesToWrite) {
}

Here also I think we can duplicate the data before passing to
AudioTrack & AudioFlinger.

Any suggestion on this approach ?

White

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to