]> git.alsa-project.org Git - alsa-utils.git/commitdiff
Don't show invalid plug example in the error message of aplay
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Apr 2006 13:14:43 +0000 (15:14 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 18 Apr 2006 13:14:43 +0000 (15:14 +0200)
Don't show invalid examples of usage with plug prefix
in the error message of aplay/arecord.

aplay/aplay.c

index b6dcc093e9513274edbe9a5926dd506e6dd37b7d..fa3fb4ed2edba8bc43b864946a05af7936e4a9b7 100644 (file)
@@ -916,8 +916,15 @@ static void set_params(void)
        assert(err >= 0);
        if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) {
                if (!quiet_mode) {
+                       char plugex[64];
                        fprintf(stderr, _("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate);
-                       fprintf(stderr, _("         please, try the plug plugin (-Dplug:%s)\n"), snd_pcm_name(handle));
+                       if (strchr(snd_pcm_name(handle), ':'))
+                               *plugex = 0;
+                       else
+                               snprintf(plugex, sizeof(plugex), "(-Dplug:%s)",
+                                        snd_pcm_name(handle));
+                       fprintf(stderr, _("         please, try the plug plugin %s\n"),
+                               plugex);
                }
        }
        rate = hwparams.rate;