[alsa-devel] Fwd: Fwd: Re: Basic questions

tsepp2001 at t-online.de tsepp2001 at t-online.de
Sun Jul 30 18:43:44 CEST 2017


Hi Clemens,

thank you. In blocking-mode it works. Then i will follow the 
non-blocking mode. I modified first the callback:

void playback_callback (snd_pcm_sframes_t nframes)
{
     snd_pcm_sframes_t avail;

     avail = snd_pcm_avail_update(handle);
     while (avail >= period_size)
     {
         snd_pcm_writei(handle, buffer_alsa , nframes);
         avail = snd_pcm_avail_update(handle);
         std::cout << "      Avail:  " << avail << std::endl;
     }
}

...
called it at the end:
playback_callback(period_size);

and I get (for "avail"):

Frames:  6894888
buffer_size (frames):  2048
buffer_time (frames):  46439
period_size (frames):  256
period_time (usec):  5804
periods (count):  8
Avail:  1282
Avail:  1027
Avail:  772
Avail:  517
Avail:  261
Avail:  6

the same mistake...

Regards
Thomas



tsepp2001 at t-online.de  wrote:
> Am I right to use async mode

No.  It is not supported by all devices, and almost impossible to use
correctly.

> to get lowest latency times

Latency depends on the buffer size, and how fast your code can react to
the notification that some space is available.

> and using pause/play/stop?

You probably want to use non-blocking mode.


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel at alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



More information about the Alsa-devel mailing list