[pulseaudio-discuss] pa_mix 32Bit write for S16NE format

kuldeep ghan ghankp at gmail.com
Wed Aug 17 01:04:19 PDT 2011


Hi,

  I am working on a setup which has Linux Kernel running and I have
pulseaudio as Sound server. ASoc Alsa driver *snd_pcm_mmap* function returns
me
 Virtual Memory mapped to physical memory which is strictly 32 Bit Aligned.

  When I am trying to Mix two streams with gst-launch, pa_mix function tries
to write 16Bit mixed samples to this physical memory resulting in Bus error.

  As a work around I am trying following code which is trying to write two
Mixed 16Bit samples write making it a 32Bit write.
src/pulsecore/sample-util.c

             //  *((int16_t*) data) = (int16_t) sum;
                if(j==0) {
                       temp[0]=(int16_t) sum;
                       j=1;
               } else {
                        temp[1]=(int16_t) sum;
                         j=0;
                        sum = ((temp[1] << 16) | (0x0000FFFF &
temp[0]));

                        data = (uint8_t*) data - sizeof(int16_t);
                       *((int32_t*) data) = (int32_t) sum;
                        data = (uint8_t*) data + sizeof(int16_t);
               }

With this I am able to mix a *gst-launch* stream and already loaded sample
from pulseaudio played with *play-sample* from *pacmd*.
But not able to mix two streams with gst-launch.

I am new to Pulseaudio. May I know What is that I am missing here ??
Kuldeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110817/cf32d4c7/attachment.html>


More information about the pulseaudio-discuss mailing list