[alsa-devel] Direct write (using mmap_bigin and commit)

David Henningsson david.henningsson at canonical.com
Tue Nov 16 08:10:53 CET 2010


On 2010-11-15 13:24, Irfan Shaikh wrote:
>                          err = snd_pcm_mmap_begin(handle,&my_areas,&offset,&frames);
>                          mybuffer=(char *)malloc(frames*2);
>                          result = fread (mybuffer,1,(frames*2),pFile);
>                          my_areas.addr=mybuffer;           // IS THIS CORRECT ? WILL THIS WORK ? How can i write my audio file data here in areas?
>                          commitres = snd_pcm_mmap_commit(handle, offset, frames);

No, fread should write directly into the buffer given by 
snd_pcm_mmap_begin, you don't need "mybuffer" at all.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic


More information about the Alsa-devel mailing list