Re: Invalid argument when setting periods, buffer, rate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

On Wed, 24 Jun 2020, Sleep wrote:

> Why does the program below issue errors for
> snd_pcm_hw_params_set_period_size(), snd_pcm_hw_params_set_buffer_size(), and
> snd_pcm_hw_params_set_rate()? If I raise the value of SAMPLES to 768 it only

I highly recommend to review well known clients like aplay.c in alsa-utils 
for reference. 

E.g. here, it's not guaranteed all hardware drivers support all period 
sizes. Typically you either use the ALSA plugin layer and not access hw 
devices directly, and/or use the "_near" variants like aplay does:

aplay.c:
	if (period_time > 0)
		err = snd_pcm_hw_params_set_period_time_near(handle, params,
							     &period_time, 
							     0);

... with _near(), you of course need to handle the case where the value 
set doesn't exactly match what you requested.

Br, Kai



_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux