From: Paul Davis Subject: Re: mmaped play in multichannel mode (fwd) Date: Wed, 30 Jul 2003 16:36:18 -0400 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: <200307302036.h6UKaJ6p001930@localhost.localdomain> References: Return-path: In-reply-to: Your message of "Wed, 30 Jul 2003 22:37:14 +0200." Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: barat@medien.uni-weimar.de Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org >i have written some code for mmaped-play. it works so far for up to 2 >channels, but in multichannel-mode i get some mismatch about available >buffersize or exactly a snd_pcm_mmap_commit error. >the essential part is the following: > > snd_pcm_mmap_begin(alsa_handler, &area, &offset, &frames_transmit); > > /* this is specific to interleaved streams (or non-interleaved > * streams with only one channel) */ > outbuffer = ((char *) area->addr + (area->first + area->step * offset) / >8); > > //write data > memcpy(outbuffer, data, (frames_transmit * bytes_per_sample)); > > commitres = snd_pcm_mmap_commit(alsa_handler, offset, frames_transmit); > >i guess that outbuffer has a wrong size. does somebody have any idea about >this outbuffer calculation? i don't know exactly why you're spending time doing this. whether you decide to use it or not, JACK (http://jackit.sf.net/) has full, working code that shows how to do this. but i'd personally recommend that you consider using it instead of reinventing the wheel, etc. --p ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01