]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aplay - show sample arrangement (mmap areas) in verbose more for debugging
authorJaroslav Kysela <perex@perex.cz>
Tue, 9 Sep 2008 10:53:28 +0000 (12:53 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 9 Sep 2008 10:53:28 +0000 (12:53 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
aplay/aplay.c

index d8b4772a26649625c0c47ae158e134bddaa4f685..246faac4bd57b628d8840c97e10d1096f7c09be5 100644 (file)
@@ -1073,6 +1073,22 @@ static void set_params(void)
                if (hwparams.channels != 2 || !interleaved || verbose > 2)
                        vumeter = VUMETER_MONO;
        }
+
+       /* show mmap buffer arragment */
+       if (mmap_flag && verbose) {
+               const snd_pcm_channel_area_t *areas;
+               snd_pcm_uframes_t offset;
+               int i;
+               err = snd_pcm_mmap_begin(handle, &areas, &offset, &chunk_size);
+               if (err < 0) {
+                       error("snd_pcm_mmap_begin problem: %s", snd_strerror(err));
+                       exit(EXIT_FAILURE);
+               }
+               for (i = 0; i < hwparams.channels; i++)
+                       fprintf(stderr, "mmap_area[%i] = %p,%u,%u (%u)\n", i, areas[i].addr, areas[i].first, areas[i].step, snd_pcm_format_physical_width(hwparams.format));
+               /* not required, but for sure */
+               snd_pcm_mmap_commit(handle, offset, 0);
+       }
 }
 
 #ifndef timersub