Hi all,
I am try to write a plugin in alsa io plugin mode
static snd_pcm_sframes_t my_read (snd_pcm_ioplug_t * io, const snd_pcm_channel_area_t * areas, snd_pcm_uframes_t offset, snd_pcm_uframes_t size) {
}
In above function, I will copy the audio data to areas with calculate the offset like this:
memcpy((char *) areas->addr + (areas->first + areas->step * offset) / 8, data, size);
But after serveral calls, the application crash, and I print the "offset" value, it seem always increase, when reach one number (e.g. 66560) it crash. So my question is: is the "offset" value always increase is expected? Or does it should like a ring buffer, so it should start from begin again? I see there is hw_pointer and app_pointer, but they are both read_only, right? How could we adjust the read pointer? Thanks.
BTW, I test the plugin in this way:
arecord -D my_plug -c 1 -f S16_LE raw
Best Regards, Hermes