public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Mina Almasry <almasrymina@google.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: External plugin question
Date: Fri, 07 Aug 2015 07:26:43 +0200	[thread overview]
Message-ID: <s5h4mkbd5yk.wl-tiwai@suse.de> (raw)
In-Reply-To: <CAHS8izNcdWdki1yPOAipvnn9eC1_NkiiyPwO8h9iv7r7toCv9g@mail.gmail.com>

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

  reply	other threads:[~2015-08-07  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07  0:02 External plugin question Mina Almasry
2015-08-07  5:26 ` Takashi Iwai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-06 23:57 Mina Almasry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h4mkbd5yk.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=almasrymina@google.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox