RFC: support for 12 & 24Khz
Hey Takashi,
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at pcm.h these are not defined so we can simply add them at the end. But am worried about wider impact of adding these rates.
Can you let me know if more is required to be done or below is fine
include/sound/pcm.h +2 -0
@@ -126,6 +126,8 @@ struct snd_pcm_ops {#define SNDRV_PCM_RATE_96000 (1<<10)/* 96000Hz */ #define SNDRV_PCM_RATE_176400 (1<<11)/* 176400Hz */ #define SNDRV_PCM_RATE_192000 (1<<12)/* 192000Hz */ +#define SNDRV_PCM_RATE_12000 <1<<13>/* 12000Hz */ +#define SNDRV_PCM_RATE_24000 <1<<14>/* 24000Hz */ #define SNDRV_PCM_RATE_CONTINUOUS (1<<30)/* continuous range */ #define SNDRV_PCM_RATE_KNOT (1<<31)/* supports more
non-continuos rates */
sound/core/pcm_native.c +0 -0
@@ -1779,12 +1779,13 @@ static int snd_pcm_hw_rule_sample_bits(struct
snd_pcm_hw_params *params,
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
}
-#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12 +#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_24000 != 1 << 14
#error "Change this table"
#endif
static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100,
- 48000, 64000, 88200, 96000, 176400, 192000 }; + 48000, 64000, 88200, 96000, 176400, 192000, + 12000, 24000 };
const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {
.count = ARRAY_SIZE(rates),
~Vinod
Quoted 14 lines · Vinod Koul
Hey Takashi,
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at
pcm.hthese are not defined so we can simply add them at the end. But am worried about wider impact of adding these rates.Can you let me know if more is required to be done or below is fine
include/sound/pcm.h +0
-0
include/sound/pcm.h struct snd_pcm_ops { · line 130
Quoted 5 lines
include/sound/pcm.h +2
-0@@ -126,6 +126,8 @@ struct snd_pcm_ops {#define SNDRV_PCM_RATE_96000 (1<<10)/* 96000Hz */ #define SNDRV_PCM_RATE_176400 (1<<11)/* 176400Hz */ #define SNDRV_PCM_RATE_192000 (1<<12)/* 192000Hz */ +#define SNDRV_PCM_RATE_12000 <1<<13>/* 12000Hz */ +#define SNDRV_PCM_RATE_24000 <1<<14>/* 24000Hz */
You probably meant (1<<13), not <1<<13> ?
Quoted 28 lines
include/sound/pcm.h +0
-0#define SNDRV_PCM_RATE_CONTINUOUS (1<<30)/* continuous range */ #define SNDRV_PCM_RATE_KNOT (1<<31)/* supports more non-continuos rates */
sound/core/pcm_native.c +3
-2@@ -1779,12 +1779,13 @@ static int snd_pcm_hw_rule_sample_bits(structsnd_pcm_hw_params *params, return snd_interval_refine(hw_param_interval(params, rule->var), &t); } -#if SNDRV_PCM_RATE_5512 !=1 <<0 ||SNDRV_PCM_RATE_192000 !=1 <<12 +#if SNDRV_PCM_RATE_5512 !=1 <<0 ||SNDRV_PCM_RATE_24000 !=1 <<14 #error "Change this table"#endif static unsigned int rates[] = {5512 ,8000 ,11025 ,16000 ,22050 ,32000 ,44100 , -48000 ,64000 ,88200 ,96000 ,176400 ,192000 }; +48000 ,64000 ,88200 ,96000 ,176400 ,192000 , +12000 ,24000 };const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = {.count =
ARRAY_SIZE(rates),~Vinod
Signature · 2 lines
David Henningsson, Canonical Ltd. https://launchpad.net/~diwic
Quoted 10 lines · David Henningsson
Quoted 9 lines · Vinod Koul
Hey Takashi,
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at
pcm.hthese are not defined so we can simply add them at the end. But am worried about wider impact of adding these rates.Can you let me know if more is required to be done or below is fine
Quoted 12 lines
include/sound/pcm.h struct snd_pcm_ops { · line 130
Quoted 10 lines
include/sound/pcm.h +2
-0@@ -126,6 +126,8 @@ struct snd_pcm_ops {#define SNDRV_PCM_RATE_96000 (1<<10)/* 96000Hz */ #define SNDRV_PCM_RATE_176400 (1<<11)/* 176400Hz */ #define SNDRV_PCM_RATE_192000 (1<<12)/* 192000Hz */ +#define SNDRV_PCM_RATE_12000 <1<<13>/* 12000Hz */ +#define SNDRV_PCM_RATE_24000 <1<<14>/* 24000Hz */ You probably meant (1<<13), not <1<<13> ?
Yup :)
~Vinod
Quoted 3 lines · Vinod Koul
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at
pcm.hthese are not defined
You don't need such symbols to use a rate. These symbols are intended for often-used rates. As long as only one or two drivers use a rate, they can just set KNOT and install a constraint.
Quoted 3 lines
But am worried about wider impact of adding these rates.
Can you let me know if more is required to be done or below is fine
Grep for 176400 in sound/core/, include/, and in alsa-lib.
Regards,
Clemens
Quoted 8 lines · Clemens Ladisch
Quoted 3 lines · Vinod Koul
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at
pcm.hthese are not definedYou don't need such symbols to use a rate. These symbols are intended for often-used rates. As long as only one or two drivers use a rate, they can just set KNOT and install a constraint.
okay so how exactly is the rate passed to driver and converted and sent to drivers?
Quoted 6 lines
Quoted 4 lines
But am worried about wider impact of adding these rates.
Can you let me know if more is required to be done or below is fine
Grep for 176400 in
sound/core/,include/, and in alsa-lib.
SNDRV_PCM_RATE_176400?
~Vinod
At Thu, 25 Jul 2013 21:15:01 +0530,
Quoted 5 lines · Vinod Koul
Quoted 3 lines · Clemens Ladisch
Quoted 2 lines · Vinod Koul
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Looking at
pcm.hthese are not definedYou don't need such symbols to use a rate. These symbols are intended for often-used rates. As long as only one or two drivers use a rate, they can just set KNOT and install a constraint.
okay so how exactly is the rate passed to driver and converted and sent to drivers?
Define the own hw_constraint. Usually it's implemented via snd_pcm_hw_constraint_list().
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
But am worried about wider impact of adding these rates.
Can you let me know if more is required to be done or below is fine
Grep for 176400 in
sound/core/,include/, and in alsa-lib.
SNDRV_PCM_RATE_176400?
Heh, this was an already added one. Rather take a look at SNDRV_PCM_RATE_KNOT.
Takashi
Quoted 9 lines · Takashi Iwai
At Thu, 25 Jul 2013 21:15:01 +0530,
Quoted 7 lines · Vinod Koul
Quoted 5 lines · Clemens Ladisch
Quoted 3 lines · Vinod Koul
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at
pcm.hthese are not defined
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
You don't need such symbols to use a rate. These symbols are intended for often-used rates. As long as only one or two drivers use a rate, they can just set KNOT and install a constraint.
okay so how exactly is the rate passed to driver and converted and sent to drivers?
Define the own
hw_constraint. Usually it's implemented viasnd_pcm_hw_constraint_list().
Thanks
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
But am worried about wider impact of adding these rates.
Can you let me know if more is required to be done or below is fine
Grep for 176400 in
sound/core/,include/, and in alsa-lib.
SNDRV_PCM_RATE_176400?Heh, this was an already added one. Rather take a look at
SNDRV_PCM_RATE_KNOT.
Okay so the orignal problem is that we use SNDRV_PCM_RATE_XXX to send the sample rate to decoder. Some decoders very commonly use 12 and 24Khz, so I would like them to be added.
I think 12 and 24 are fairly common rates and should be added. Do you agree?
~Vinod
At Fri, 26 Jul 2013 11:39:08 +0530,
Quoted 25 lines · Vinod Koul
Quoted 9 lines · Takashi Iwai
At Thu, 25 Jul 2013 21:15:01 +0530,
Quoted 7 lines · Vinod Koul
Quoted 5 lines · Clemens Ladisch
Quoted 3 lines · Vinod Koul
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Looking at
pcm.hthese are not definedQuoted 8 lines
Quoted 5 lines
Quoted 3 lines
You don't need such symbols to use a rate. These symbols are intended for often-used rates. As long as only one or two drivers use a rate, they can just set KNOT and install a constraint.
okay so how exactly is the rate passed to driver and converted and sent to drivers?
Define the own
hw_constraint. Usually it's implemented viasnd_pcm_hw_constraint_list().Thanks
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
But am worried about wider impact of adding these rates.
Can you let me know if more is required to be done or below is fine
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Grep for 176400 in
sound/core/,include/, and in alsa-lib.
SNDRV_PCM_RATE_176400?Heh, this was an already added one. Rather take a look at
SNDRV_PCM_RATE_KNOT.Okay so the orignal problem is that we use
SNDRV_PCM_RATE_XXXto send the sample rate to decoder.
Relying only on SNDRV_PCM_RATE_* bits doesn't scale. What if more other rates are needed at the next time?
Quoted 4 lines
Some decoders very commonly use 12 and 24Khz, so I would like them to be added.
I think 12 and 24 are fairly common rates and should be added. Do you agree?
It's no solution. It makes things easier, though.
Better to fix the code to be able to handle uncommon rates, at first.
Takashi
Quoted 2 lines · Takashi Iwai
Relying only on SNDRV_PCM_RATE_* bits doesn't scale. What if more other rates are needed at the next time?
Agreed, this is my thinking as well. Remove the usage of macro and use raw rate values...
~Vinod
Quoted 4 lines · Vinod Koul
Quoted 1 line · Clemens Ladisch
Quoted 1 line
For compressed audio we also need to support the PCM rates of 12 and 24KHz.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Looking at
pcm.hthese are not definedYou don't need such symbols to use a rate. These symbols are intended for often-used rates. As long as only one or two drivers use a rate, they can just set KNOT and install a constraint.
okay so how exactly is the rate passed to driver and converted and sent to drivers?
Having said that 24kHz sounds awfully familiar...
Quoted 2 lines · Mark Brown
Having said that 24kHz sounds awfully familiar...
Yup it is :)
I think todays rates defined in ALSA are HD-Audio based. IIRC HDA doesnt use 12/24 they were not added here!
~Vinod
At Fri, 26 Jul 2013 11:41:03 +0530,
Quoted 8 lines · Vinod Koul
Quoted 2 lines · Mark Brown
Having said that 24kHz sounds awfully familiar...
Yup it is :)
I think todays rates defined in ALSA are HD-Audio based. IIRC HDA doesnt use 12/24 they were not added here!
No, the values were defined at the time of AC97.
Takashi