Kontron KTAM3874-pITX Manual de usuario Pagina 105

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 293
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 104
KTD-S0057-I Page 101 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
data.samples = NULL; /* we do not require the global sample area for direct write */
data.areas = NULL; /* we do not require the global areas for direct write */
data.phase = 0;
err = snd_async_add_pcm_handler (&ahandler, handle, async_direct_callback, &data);
if (err < 0)
{
printf ("Unable to register async handler\n");
exit (EXIT_FAILURE);
}
for (count = 0; count < 2; count++)
{
size = period_size;
while (size > 0)
{
frames = size;
err = snd_pcm_mmap_begin (handle, &my_areas, &offset, &frames);
if (err < 0)
{
if ((err = xrun_recovery (handle, err)) < 0)
{
printf ("MMAP begin avail error: %s\n", snd_strerror (err));
exit (EXIT_FAILURE);
}
}
generate_sine (my_areas, offset, frames, &data.phase);
commitres = snd_pcm_mmap_commit (handle, offset, frames);
if (commitres < 0 || (snd_pcm_uframes_t) commitres != frames)
{
if ((err = xrun_recovery (handle, commitres >= 0 ? -EPIPE : commitres)) < 0)
{
printf ("MMAP commit error: %s\n", snd_strerror (err));
exit (EXIT_FAILURE);
}
}
size -= frames;
}
}
err = snd_pcm_start (handle);
if (err < 0)
{
printf ("Start error: %s\n", snd_strerror (err));
exit (EXIT_FAILURE);
}
/* because all other work is done in the signal handler, suspend the process */
while (1)
{
sleep(1);
}
}
Vista de pagina 104
1 2 ... 100 101 102 103 104 105 106 107 108 109 110 ... 292 293

Comentarios a estos manuales

Sin comentarios