On 22/01/2020 10:34, R.Wieser wrote:
> Or should I assume that the code simply isn't complete (would explain a few
> things).
The error return value from most of those sound functions is not being
checked. You have no idea if the function worked in this case, possibly
because the input parameters were not set correctly.
The ALSA project API web page has links to example programs that do use
the error return value:
e.g.
/* set the stream rate */
rrate = rate;
err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
if (err < 0) {
printf("Rate %uHz not available for playback: %s\n", rate,
snd_strerror(err));
I would always check the return values when trying new API calls I was
not extremely familiar in using because it's simplicity to bollox up the
input parameters when learning. When everything is working all
lovely-jubbly I would still check the error values 'coz I'm not a
script-kiddie. YMMV
Does the hardware you are using support 8000Hz sample rate?
Does aplay and arecord work with the sample rates you want to use?
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|