Accessing pcm samples from snd_pcm_channel_area_t in an io type plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am writing an external io type plugin for an ARM based board. In the
transfer function
of the plugin, I try to grab the audio samples in a temp buffer and send it
to the DSP in
chunks of period sizes. Somehow the the alsa buffer's audio samples are not
copied to the
temp buffer which I want to send further.

What I do to copy the buffers,
static snd_pcm_sframes_t my_transfer(snd_pcm_ioplug_t *io,
                   const snd_pcm_channel_area_t *areas,
                   snd_pcm_uframes_t offset,
                   snd_pcm_uframes_t size)
{

    char *temp = NULL;
    temp = malloc(io->period_size * frame_size);  //For malloc,

    //I tried all the three approaches here one by one, including the
malloc/memcpy one
    1. memcpy(temp,areas->addr+ offset*io->channels*2, io->period_size *
frame_size);
    2. memcpy(temp, (char *)areas->addr + (areas->first + areas->step *
offset) /8, io->period_size * frame_size);
    //This should work straight off....
    3. temp = (char *)areas->addr + (areas->first + areas->step * offset) /
8;

    //write temp to DSP here
    .........
}

Somehow the empty buffers are being sent to DSP, when I try to send some
data from a static array then it goes
to DSP and is played well. Any idea what I am missing?

-phraoh.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux