i finally figured out the magic of snd_pcm_mmap_begin/commit, and what i did wrong all the time. its really simple, but to figure it out was somehow a 'long way'.
the baisc steps how i did it now are: frames_available = snd_pcm_avail_update(alsa_handler) gets the available space in audio-buffer to write to. frames_transmit = frames_available; snd_pcm_mmap_begin(alsa_handler, &area, &offset, &frames_transmit); prepare the areas and get back area, offset and frames_transmit. frames_transmit gives back the REAL value of available frames which could be written to in the mmaped-area. its sometimes for some unknown reasons < frames_available. this is what i did wrong all the time. i had the wrong idea that frames_transmit is always == frames_available. outbuffer = ((char *) area->addr + (area->first + area->step * offset) / 8); this mysterious formula setup and calculates the mmaped-buffer which could be written to. it works only with '2 chn, Signed 16-bit'-streams for me. should be modified for 'usigned 8-bit'-streams', but i currently don't know how. result = snd_pcm_mmap_commit(alsa_handler, offset, frames_transmit); gives back the virtually written (writable) frames which should be always == frames_transmit. a simple memcpy(outbuffer, data, result); finally transfers the current data into the mmaped-buffer. -- regards ____- joy ________/\---------%%%___________----------- webcast every sunday 2000 cest at pingfm.org pgp key at: x-hkp://wwwkeys.de.pgp.net
