From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: External plugin question Date: Fri, 07 Aug 2015 07:26:43 +0200 Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id C0AE0260670 for ; Fri, 7 Aug 2015 07:26:43 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mina Almasry Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Fri, 07 Aug 2015 02:02:47 +0200, Mina Almasry wrote: > > I'm new to alsa dev and I'm trying to write a very simple external pcm > plugin. I want my pcm plugin to output sound to multiple slave pcms when > sound is being writei'd to it. So: > > snd_pcm_myplugin_writei(pcm, buffer, size) { > foreach slave pcm { > snd_pcm_writei(slave_pcm, buffer, size); > } > } Can't it be better managed by splitting to multiple plugins, e.g. filter -> multi -> slave PCMs ?? > I'm having trouble implementing this plugin because the external plugin sdk > does not allow me to define the writei function for my plugin, but lets me > define the transfer function which has a very different signature than > writei: > > transfer(snd_pcm_ioplug_t *io, const snd_pcm_channel_area_t *areas, > snd_pcm_uframes_t offset, snd_pcm_uframes_t size) > > how do I extract buffer and size from these arguments? Any tips on how I > write my plugin. This is a kind of abstracted form to handle both interleaved and non-interleaved formats. The areas argument is the array of buffer pointers. Each of the array member corresponds to the buffer and the step of each channel. The rest, offset and size, are trivial and same. Takashi