Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual
Page 116

KTD-S0057-I
Page 112 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
set_wav_header
(&wavhdr);
if (write_wav_file (wavhdr))
{
fprintf (stderr, "Cannot write wav file\n");
return
EXIT_FAILURE;
}
return
EXIT_SUCCESS;
}
Note: The audio driver does not support the full duplex mode.
If you complement the previous example with few lines of code for full duplex mode (red color) the pro-
gram generates an error message:
int main (void)
{
int
err;
unsigned int rrate;
wav_header
wavhdr;
snd_pcm_t
*capture_handle;
snd_pcm_t
*playback_handle;
snd_pcm_hw_params_t
*hw_params;
if ((err = snd_pcm_open (&playback_handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
{
fprintf (stderr, "Cannot open audio device %s (%s)\n", device, snd_strerror (err));
return
EXIT_FAILURE;
}
if ((err = snd_pcm_open (&capture_handle, device, SND_PCM_STREAM_CAPTURE, 0)) < 0)
{
fprintf (stderr, "Cannot open audio device %s (%s)\n", device, snd_strerror (err));
return
EXIT_FAILURE;
}
if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0)
{
fprintf (stderr, "Cannot allocate hardware parameter structure (%s)\n", snd_strerror (err));
return
EXIT_FAILURE;
}
.
.
This is the reason why you cannot use the
Latency
example from
http://www.alsa-project.org/alsa-doc/
alsa-lib/examples.html
.