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

KTD-S0057-I
Page 105 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
printf ("Usage: pcm [OPTION]... [FILE]...\n"
"-h,--help help\n"
"-D,--device playback device\n"
"-r,--rate stream rate in Hz\n"
"-c,--channels
count
of channels in stream\n"
"-f,--frequency sine wave frequency in Hz\n"
"-b,--buffer ring buffer size in us\n"
"-p,--period period size in us\n"
"-m,--method transfer method\n"
"-o,--format sample format\n"
"-v,--verbose show the PCM setup parameters\n"
"-n,--noresample do not resample\n"
"-e,--pevent enable poll event after each period\n\n");
printf ("Recognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k)
{
const char *s = snd_pcm_format_name (k);
if
(s)
printf(" %s", s);
}
printf
("\n");
printf ("Recognized transfer methods are:");
for (k = 0; transfer_methods[k].name; k++)
printf (" %s", transfer_methods[k].name);
printf
("\n");
}
int main (int argc, char *argv[])
{
struct option long_option[] = {
{"help", 0, NULL, 'h'},
{"device", 1, NULL, 'D'},
{"rate", 1, NULL, 'r'},
{"channels", 1, NULL, 'c'},
{"frequency", 1, NULL, 'f'},
{"buffer", 1, NULL, 'b'},
{"period", 1, NULL, 'p'},
{"method", 1, NULL, 'm'},
{"format", 1, NULL, 'o'},
{"verbose", 1, NULL, 'v'},
{"noresample", 1, NULL, 'n'},
{"pevent", 1, NULL, 'e'},
{NULL, 0, NULL, 0} };
snd_pcm_t
*handle;
int err, morehelp;
snd_pcm_hw_params_t
*hwparams;
snd_pcm_sw_params_t
*swparams;
int method = 0;
signed short *samples;
unsigned int chn;
snd_pcm_channel_area_t
*areas;