]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: route: Use get/put labels for all 3 byte formats
authorTakashi Iwai <tiwai@suse.de>
Mon, 21 Jul 2014 14:30:54 +0000 (16:30 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 21 Jul 2014 14:30:54 +0000 (16:30 +0200)
So far, use_getput flag is set only when the src or dest format is
24bit physical width.  But, also 18 and 20 bit physical width formats
should set the flag, too.  This patch makes the check broader to cover
all 3 bytes formats.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_route.c

index 2f0be38b1906c90601f6f3796dd0b4f27c67dd9c..72c198cb25d218e3ce59828c4b795df8c19918bb 100644 (file)
@@ -644,8 +644,10 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
        }
        if (err < 0)
                return err;
-       route->params.use_getput = snd_pcm_format_physical_width(src_format) == 24 ||
-               snd_pcm_format_physical_width(dst_format) == 24;
+       /* 3 bytes formats? */
+       route->params.use_getput =
+               (snd_pcm_format_physical_width(src_format) + 7) / 3 == 3 ||
+               (snd_pcm_format_physical_width(dst_format) + 7) / 3 == 3;
        route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S16);
        route->params.put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
        route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format);