All of lore.kernel.org
 help / color / mirror / Atom feed
From: Irfan shaikh <irfan.shaikh@sasken.com>
To: alsa-devel@alsa-project.org
Subject: ALSA Underrun / Silence playback
Date: Mon, 5 Dec 2011 12:10:10 +0530	[thread overview]
Message-ID: <4EDC674A.4030302@sasken.com> (raw)

Hello devel,

          I am trying to implement s/w params for ALSA playback device 
such that there is SILENCE playback for UNDERRUN (-32).
          To achieve above i used below s/w params API's. But still i 
observe UNDERRUN in my AUDIO Playback.
          Please correct me if i am mising somenting.
{When i do get boundry, i get some weird value 1572864000. Thus i tried 
to use alsa buffer size for threshold}

/*************************************************************************************/ 

   if (snd_pcm_sw_params_get_boundary (alsaParams->p_swparams, 
&boundary) < 0)
         {
                 printf ("Could not gete snd_pcm_sw_params_get_boundary");
                 return NULL;
         }

//      threshold = boundary;
         threshold = alsaParams->periodsize * alsaParams->no_of_periods;

         if (snd_pcm_sw_params_set_stop_threshold 
(alsaParams->pcm_handle, alsaParams->p_swparams, threshold) < 0)
         {
                 printf("Could not gete snd_pcm_sw_params_get_boundary");
                 return NULL;
         }

         if (snd_pcm_sw_params_set_silence_threshold 
(alsaParams->pcm_handle, alsaParams->p_swparams, 0) < 0 ||
                         snd_pcm_sw_params_set_silence_size 
(alsaParams->pcm_handle, alsaParams->p_swparams, boundary) < 0)      /* 
play silence on XRUN */
         {
                 printf("Could not set silence params");
                 return NULL;
         }
/*************************************************************************************/

Thanks in advance !!

Regards,

             reply	other threads:[~2011-12-05  6:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05  6:40 Irfan shaikh [this message]
2011-12-05  9:50 ` ALSA Underrun / Silence playback Clemens Ladisch
2011-12-05 10:04   ` Irfan shaikh
2011-12-05 10:45     ` Clemens Ladisch
2011-12-05 11:56       ` Irfan shaikh

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=4EDC674A.4030302@sasken.com \
    --to=irfan.shaikh@sasken.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 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.