Update of /cvsroot/alsa/alsa-lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10655

Modified Files:
        pcm.c 
Log Message:
Added verbose flag

Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/test/pcm.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- pcm.c       3 Feb 2004 16:14:39 -0000       1.29
+++ pcm.c       5 Feb 2004 11:01:55 -0000       1.30
@@ -19,6 +19,7 @@
 unsigned int buffer_time = 500000;             /* ring buffer length in us */
 unsigned int period_time = 100000;             /* period time in us */
 double freq = 440;                             /* sinusoidal wave frequency in Hz */
+int verbose = 0;                               /* verbose flag */
 
 snd_pcm_sframes_t buffer_size;
 snd_pcm_sframes_t period_size;
@@ -148,7 +149,8 @@
                printf("Unable to determine current swparams for playback: %s\n", 
snd_strerror(err));
                return err;
        }
-       /* start the transfer when the buffer is almost full */
+       /* start the transfer when the buffer is almost full: */
+       /* (buffer_size / avail_min) * avail_min */
        err = snd_pcm_sw_params_set_start_threshold(handle, swparams, (buffer_size / 
period_size) * period_size);
        if (err < 0) {
                printf("Unable to set start threshold mode for playback: %s\n", 
snd_strerror(err));
@@ -698,6 +700,7 @@
 "-b,--buffer   ring buffer size in us\n"
 "-p,--period   period size in us\n"
 "-m,--method   transfer method\n"
+"-v,--verbose   show the PCM setup parameters\n"
 "\n");
         printf("Recognized sample formats are:");
         for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) {
@@ -724,6 +727,7 @@
                {"buffer", 1, NULL, 'b'},
                {"period", 1, NULL, 'p'},
                {"method", 1, NULL, 'm'},
+               {"verbose", 1, NULL, 'v'},
                {NULL, 0, NULL, 0},
        };
        snd_pcm_t *handle;
@@ -741,7 +745,7 @@
        morehelp = 0;
        while (1) {
                int c;
-               if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:m:", long_option, 
NULL)) < 0)
+               if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:m:v", long_option, 
NULL)) < 0)
                        break;
                switch (c) {
                case 'h':
@@ -782,6 +786,9 @@
                        if (transfer_methods[method].name == NULL)
                                method = 0;
                        break;
+               case 'v':
+                       verbose = 1;
+                       break;
                }
        }
 
@@ -815,6 +822,9 @@
                exit(EXIT_FAILURE);
        }
 
+       if (verbose > 0)
+               snd_pcm_dump(handle, output);
+
        samples = malloc((period_size * channels * snd_pcm_format_width(format)) / 8);
        if (samples == NULL) {
                printf("No enough memory\n");



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to