All of lore.kernel.org
 help / color / mirror / Atom feed
* Use of snd_pcm_format_set_silence
@ 2016-01-20 21:18 Ankhit Vivekananda
  2016-01-20 21:56 ` Clemens Ladisch
  0 siblings, 1 reply; 5+ messages in thread
From: Ankhit Vivekananda @ 2016-01-20 21:18 UTC (permalink / raw)
  To: alsa-devel

Hello,

I have an application where in I need to silence the first few samples of
the buffer that is read from snd_pcm_readi(). In order to do this, I call
the snd_pcm_format_set_silence() providing the same buffer that the
snd_pcm_readi() reads to.

1) By doing this, is there going to be a timing delay due to the use of
snd_pcm_format_set_silence()?
2) Is snd_pcm_format_set_silence() the correct function to achieve this
goal or are there better methods?
Please do let me know.

Thank you,
Ankhit

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Use of snd_pcm_format_set_silence
  2016-01-20 21:18 Use of snd_pcm_format_set_silence Ankhit Vivekananda
@ 2016-01-20 21:56 ` Clemens Ladisch
  2016-01-20 22:17   ` Ankhit Vivekananda
  0 siblings, 1 reply; 5+ messages in thread
From: Clemens Ladisch @ 2016-01-20 21:56 UTC (permalink / raw)
  To: Ankhit Vivekananda, alsa-devel

Ankhit Vivekananda wrote:
> I have an application where in I need to silence the first few samples of
> the buffer that is read from snd_pcm_readi(). In order to do this, I call
> the snd_pcm_format_set_silence() providing the same buffer that the
> snd_pcm_readi() reads to.
>
> 1) By doing this, is there going to be a timing delay due to the use of
> snd_pcm_format_set_silence()?

That function just modifies memory; it does not affect any PCM device.

> 2) Is snd_pcm_format_set_silence() the correct function to achieve this
> goal or are there better methods?

You already know your sample format; memset(0) might be simpler.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Use of snd_pcm_format_set_silence
  2016-01-20 21:56 ` Clemens Ladisch
@ 2016-01-20 22:17   ` Ankhit Vivekananda
  2016-01-21  7:43     ` Clemens Ladisch
  0 siblings, 1 reply; 5+ messages in thread
From: Ankhit Vivekananda @ 2016-01-20 22:17 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

Hello Clemens,

Thanks for your response. Just to clarify, the snd_pcm_format_set_silence()
would simply *replace* the actual buffer read from snd_pcm_readi() to
zeros(since my application is using signed 32 bit little endian format).
There would be no delay induced in doing so. Correct?

Regards,
Ankhit

On Wed, Jan 20, 2016 at 3:56 PM, Clemens Ladisch <clemens@ladisch.de> wrote:

> Ankhit Vivekananda wrote:
> > I have an application where in I need to silence the first few samples of
> > the buffer that is read from snd_pcm_readi(). In order to do this, I call
> > the snd_pcm_format_set_silence() providing the same buffer that the
> > snd_pcm_readi() reads to.
> >
> > 1) By doing this, is there going to be a timing delay due to the use of
> > snd_pcm_format_set_silence()?
>
> That function just modifies memory; it does not affect any PCM device.
>
> > 2) Is snd_pcm_format_set_silence() the correct function to achieve this
> > goal or are there better methods?
>
> You already know your sample format; memset(0) might be simpler.
>
>
> Regards,
> Clemens
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Use of snd_pcm_format_set_silence
  2016-01-20 22:17   ` Ankhit Vivekananda
@ 2016-01-21  7:43     ` Clemens Ladisch
  2016-01-21 16:29       ` Ankhit Vivekananda
  0 siblings, 1 reply; 5+ messages in thread
From: Clemens Ladisch @ 2016-01-21  7:43 UTC (permalink / raw)
  To: Ankhit Vivekananda; +Cc: alsa-devel

Ankhit Vivekananda wrote:
> the snd_pcm_format_set_silence() would simply /replace/ the actual
> buffer read from snd_pcm_readi() to zeros(since my application is
> using signed 32 bit little endian format).

Yes.

> There would be no delay induced in doing so.

Yes; this function does not block.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Use of snd_pcm_format_set_silence
  2016-01-21  7:43     ` Clemens Ladisch
@ 2016-01-21 16:29       ` Ankhit Vivekananda
  0 siblings, 0 replies; 5+ messages in thread
From: Ankhit Vivekananda @ 2016-01-21 16:29 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

Hello Clemens,

Thank you very much for the confirmation.

Regards,
Ankhit

On Thu, Jan 21, 2016 at 1:43 AM, Clemens Ladisch <clemens@ladisch.de> wrote:

> Ankhit Vivekananda wrote:
> > the snd_pcm_format_set_silence() would simply /replace/ the actual
> > buffer read from snd_pcm_readi() to zeros(since my application is
> > using signed 32 bit little endian format).
>
> Yes.
>
> > There would be no delay induced in doing so.
>
> Yes; this function does not block.
>
>
> Regards,
> Clemens
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-21 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20 21:18 Use of snd_pcm_format_set_silence Ankhit Vivekananda
2016-01-20 21:56 ` Clemens Ladisch
2016-01-20 22:17   ` Ankhit Vivekananda
2016-01-21  7:43     ` Clemens Ladisch
2016-01-21 16:29       ` Ankhit Vivekananda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.