From 1c33653cfd4048cc52da5485aa910b63388433e7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 5 Feb 2013 12:24:22 +0100 Subject: [PATCH] --- yaml --- r: 353234 b: refs/heads/master c: a690a2a1eb32e533e2b2afb1daeef3c4011d47e9 h: refs/heads/master v: v3 --- [refs] | 2 +- .../DocBook/writing-an-alsa-driver.tmpl | 39 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/[refs] b/[refs] index 06d4bc064431..95a50d879ee3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 05dc0fc9d01537a66d9a0cffe2e96296d8f4c7ac +refs/heads/master: a690a2a1eb32e533e2b2afb1daeef3c4011d47e9 diff --git a/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl b/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl index c0781bb1f9b5..c564faab981c 100644 --- a/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -3250,18 +3250,19 @@ struct _snd_pcm_runtime { Example of Hardware Constraints for Channels min < 2) { - fmt.bits[0] &= SNDRV_PCM_FMTBIT_S16_LE; - return snd_mask_refine(f, &fmt); + snd_interval_any(&ch); + if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { + ch.min = ch.max = 1; + ch.integer = 1; + return snd_interval_refine(c, &ch); } return 0; } @@ -3285,27 +3286,27 @@ struct _snd_pcm_runtime { - The rule function is called when an application sets the number of - channels. But an application can set the format before the number of - channels. Thus you also need to define the inverse rule: + The rule function is called when an application sets the PCM + format, and it refines the number of channels accordingly. + But an application may set the number of channels before + setting the format. Thus you also need to define the inverse rule: - Example of Hardware Constraints for Channels + Example of Hardware Constraints for Formats bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { - ch.min = ch.max = 1; - ch.integer = 1; - return snd_interval_refine(c, &ch); + snd_mask_any(&fmt); /* Init the struct */ + if (c->min < 2) { + fmt.bits[0] &= SNDRV_PCM_FMTBIT_S16_LE; + return snd_mask_refine(f, &fmt); } return 0; }