* [PATCH] pcm: use the same set of uint_XX types everywhere
@ 2013-10-02 15:36 John Spencer
2013-10-10 11:48 ` John Spencer
0 siblings, 1 reply; 7+ messages in thread
From: John Spencer @ 2013-10-02 15:36 UTC (permalink / raw)
To: alsa-devel; +Cc: John Spencer
previously, pcm.h prototyped the functions
snd_pcm_format_silence* with u_int_XX types
(legacy BSD types from sys/types.h),
while the implementation in pcm_misc.c used the C99
stdint.h types uint_XX.
this caused compilation errors on systems where the
typedef for u_int_XX and uint_XX is not exactly the same.
we fix it by using the C99 stdint.h types everywhere.
Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
---
include/pcm.h | 9 +++++----
src/pcm/pcm_misc.c | 42 +++++++++++++++++++++---------------------
2 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/include/pcm.h b/include/pcm.h
index 95b8aed..cd847e4 100644
--- a/include/pcm.h
+++ b/include/pcm.h
@@ -33,6 +33,7 @@
extern "C" {
#endif
+#include <stdint.h>
/**
* \defgroup PCM PCM Interface
* See the \ref pcm page for more details.
@@ -1048,10 +1049,10 @@ int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
+uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
+uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
+uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
+uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
index d52160c..2a8be21 100644
--- a/src/pcm/pcm_misc.c
+++ b/src/pcm/pcm_misc.c
@@ -363,7 +363,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
* \param format Sample format
* \return silence 64 bit word
*/
-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
+uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
switch (format) {
case SNDRV_PCM_FORMAT_S8:
@@ -437,7 +437,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
union {
float f[2];
- u_int64_t i;
+ uint64_t i;
} u;
u.f[0] = u.f[1] = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -450,7 +450,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
union {
double f;
- u_int64_t i;
+ uint64_t i;
} u;
u.f = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -463,7 +463,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
union {
float f[2];
- u_int64_t i;
+ uint64_t i;
} u;
u.f[0] = u.f[1] = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -476,7 +476,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
union {
double f;
- u_int64_t i;
+ uint64_t i;
} u;
u.f = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -509,10 +509,10 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
* \param format Sample format
* \return silence 32 bit word
*/
-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
+uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 32);
- return (u_int32_t)snd_pcm_format_silence_64(format);
+ return (uint32_t)snd_pcm_format_silence_64(format);
}
/**
@@ -520,10 +520,10 @@ u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
* \param format Sample format
* \return silence 16 bit word
*/
-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
+uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 16);
- return (u_int16_t)snd_pcm_format_silence_64(format);
+ return (uint16_t)snd_pcm_format_silence_64(format);
}
/**
@@ -531,10 +531,10 @@ u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
* \param format Sample format
* \return silence 8 bit word
*/
-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
+uint8_t snd_pcm_format_silence(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 8);
- return (u_int8_t)snd_pcm_format_silence_64(format);
+ return (uint8_t)snd_pcm_format_silence_64(format);
}
/**
@@ -550,7 +550,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
return 0;
switch (snd_pcm_format_physical_width(format)) {
case 4: {
- u_int8_t silence = snd_pcm_format_silence_64(format);
+ uint8_t silence = snd_pcm_format_silence_64(format);
unsigned int samples1;
if (samples % 2 != 0)
return -EINVAL;
@@ -559,13 +559,13 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
break;
}
case 8: {
- u_int8_t silence = snd_pcm_format_silence_64(format);
+ uint8_t silence = snd_pcm_format_silence_64(format);
memset(data, silence, samples);
break;
}
case 16: {
- u_int16_t silence = snd_pcm_format_silence_64(format);
- u_int16_t *pdata = (u_int16_t *)data;
+ uint16_t silence = snd_pcm_format_silence_64(format);
+ uint16_t *pdata = (uint16_t *)data;
if (! silence)
memset(data, 0, samples * 2);
else {
@@ -575,8 +575,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
break;
}
case 24: {
- u_int32_t silence = snd_pcm_format_silence_64(format);
- u_int8_t *pdata = (u_int8_t *)data;
+ uint32_t silence = snd_pcm_format_silence_64(format);
+ uint8_t *pdata = (uint8_t *)data;
if (! silence)
memset(data, 0, samples * 3);
else {
@@ -595,8 +595,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
break;
}
case 32: {
- u_int32_t silence = snd_pcm_format_silence_64(format);
- u_int32_t *pdata = (u_int32_t *)data;
+ uint32_t silence = snd_pcm_format_silence_64(format);
+ uint32_t *pdata = (uint32_t *)data;
if (! silence)
memset(data, 0, samples * 4);
else {
@@ -606,8 +606,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
break;
}
case 64: {
- u_int64_t silence = snd_pcm_format_silence_64(format);
- u_int64_t *pdata = (u_int64_t *)data;
+ uint64_t silence = snd_pcm_format_silence_64(format);
+ uint64_t *pdata = (uint64_t *)data;
if (! silence)
memset(data, 0, samples * 8);
else {
--
1.7.3.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] pcm: use the same set of uint_XX types everywhere
2013-10-02 15:36 [PATCH] pcm: use the same set of uint_XX types everywhere John Spencer
@ 2013-10-10 11:48 ` John Spencer
2013-10-10 12:49 ` Takashi Iwai
0 siblings, 1 reply; 7+ messages in thread
From: John Spencer @ 2013-10-10 11:48 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
Hi Takashi,
do you think this could be merged ?
thanks,
--JS
On 10/02/2013 05:36 PM, John Spencer wrote:
> previously, pcm.h prototyped the functions
> snd_pcm_format_silence* with u_int_XX types
> (legacy BSD types from sys/types.h),
> while the implementation in pcm_misc.c used the C99
> stdint.h types uint_XX.
>
> this caused compilation errors on systems where the
> typedef for u_int_XX and uint_XX is not exactly the same.
>
> we fix it by using the C99 stdint.h types everywhere.
>
> Signed-off-by: John Spencer<maillist-alsa@barfooze.de>
> ---
> include/pcm.h | 9 +++++----
> src/pcm/pcm_misc.c | 42 +++++++++++++++++++++---------------------
> 2 files changed, 26 insertions(+), 25 deletions(-)
>
> diff --git a/include/pcm.h b/include/pcm.h
> index 95b8aed..cd847e4 100644
> --- a/include/pcm.h
> +++ b/include/pcm.h
> @@ -33,6 +33,7 @@
> extern "C" {
> #endif
>
> +#include<stdint.h>
> /**
> * \defgroup PCM PCM Interface
> * See the \ref pcm page for more details.
> @@ -1048,10 +1049,10 @@ int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
> int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
> snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
> ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
> -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
> -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
> -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
> -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
> +uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
> +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
> +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
> +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
> int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
>
> snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
> diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
> index d52160c..2a8be21 100644
> --- a/src/pcm/pcm_misc.c
> +++ b/src/pcm/pcm_misc.c
> @@ -363,7 +363,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
> * \param format Sample format
> * \return silence 64 bit word
> */
> -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> {
> switch (format) {
> case SNDRV_PCM_FORMAT_S8:
> @@ -437,7 +437,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> {
> union {
> float f[2];
> - u_int64_t i;
> + uint64_t i;
> } u;
> u.f[0] = u.f[1] = 0.0;
> #ifdef SNDRV_LITTLE_ENDIAN
> @@ -450,7 +450,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> {
> union {
> double f;
> - u_int64_t i;
> + uint64_t i;
> } u;
> u.f = 0.0;
> #ifdef SNDRV_LITTLE_ENDIAN
> @@ -463,7 +463,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> {
> union {
> float f[2];
> - u_int64_t i;
> + uint64_t i;
> } u;
> u.f[0] = u.f[1] = 0.0;
> #ifdef SNDRV_LITTLE_ENDIAN
> @@ -476,7 +476,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> {
> union {
> double f;
> - u_int64_t i;
> + uint64_t i;
> } u;
> u.f = 0.0;
> #ifdef SNDRV_LITTLE_ENDIAN
> @@ -509,10 +509,10 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> * \param format Sample format
> * \return silence 32 bit word
> */
> -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> {
> assert(snd_pcm_format_physical_width(format)<= 32);
> - return (u_int32_t)snd_pcm_format_silence_64(format);
> + return (uint32_t)snd_pcm_format_silence_64(format);
> }
>
> /**
> @@ -520,10 +520,10 @@ u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> * \param format Sample format
> * \return silence 16 bit word
> */
> -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> {
> assert(snd_pcm_format_physical_width(format)<= 16);
> - return (u_int16_t)snd_pcm_format_silence_64(format);
> + return (uint16_t)snd_pcm_format_silence_64(format);
> }
>
> /**
> @@ -531,10 +531,10 @@ u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> * \param format Sample format
> * \return silence 8 bit word
> */
> -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
> +uint8_t snd_pcm_format_silence(snd_pcm_format_t format)
> {
> assert(snd_pcm_format_physical_width(format)<= 8);
> - return (u_int8_t)snd_pcm_format_silence_64(format);
> + return (uint8_t)snd_pcm_format_silence_64(format);
> }
>
> /**
> @@ -550,7 +550,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> return 0;
> switch (snd_pcm_format_physical_width(format)) {
> case 4: {
> - u_int8_t silence = snd_pcm_format_silence_64(format);
> + uint8_t silence = snd_pcm_format_silence_64(format);
> unsigned int samples1;
> if (samples % 2 != 0)
> return -EINVAL;
> @@ -559,13 +559,13 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> break;
> }
> case 8: {
> - u_int8_t silence = snd_pcm_format_silence_64(format);
> + uint8_t silence = snd_pcm_format_silence_64(format);
> memset(data, silence, samples);
> break;
> }
> case 16: {
> - u_int16_t silence = snd_pcm_format_silence_64(format);
> - u_int16_t *pdata = (u_int16_t *)data;
> + uint16_t silence = snd_pcm_format_silence_64(format);
> + uint16_t *pdata = (uint16_t *)data;
> if (! silence)
> memset(data, 0, samples * 2);
> else {
> @@ -575,8 +575,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> break;
> }
> case 24: {
> - u_int32_t silence = snd_pcm_format_silence_64(format);
> - u_int8_t *pdata = (u_int8_t *)data;
> + uint32_t silence = snd_pcm_format_silence_64(format);
> + uint8_t *pdata = (uint8_t *)data;
> if (! silence)
> memset(data, 0, samples * 3);
> else {
> @@ -595,8 +595,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> break;
> }
> case 32: {
> - u_int32_t silence = snd_pcm_format_silence_64(format);
> - u_int32_t *pdata = (u_int32_t *)data;
> + uint32_t silence = snd_pcm_format_silence_64(format);
> + uint32_t *pdata = (uint32_t *)data;
> if (! silence)
> memset(data, 0, samples * 4);
> else {
> @@ -606,8 +606,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> break;
> }
> case 64: {
> - u_int64_t silence = snd_pcm_format_silence_64(format);
> - u_int64_t *pdata = (u_int64_t *)data;
> + uint64_t silence = snd_pcm_format_silence_64(format);
> + uint64_t *pdata = (uint64_t *)data;
> if (! silence)
> memset(data, 0, samples * 8);
> else {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pcm: use the same set of uint_XX types everywhere
2013-10-10 11:48 ` John Spencer
@ 2013-10-10 12:49 ` Takashi Iwai
2013-10-10 13:13 ` Default volume set to maximum stéphane cerveau
0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2013-10-10 12:49 UTC (permalink / raw)
To: John Spencer; +Cc: alsa-devel
At Thu, 10 Oct 2013 13:48:32 +0200,
John Spencer wrote:
>
> Hi Takashi,
>
> do you think this could be merged ?
I don't think changing the format in the API header is good at this
point, even if it has the same effect in the end. The API has been
solid over years. For fixing the build issue, other way round, I'd
suggest rather to change to u_int_xx in pcm_misc.c
thanks,
Takashi
>
>
> thanks,
> --JS
>
> On 10/02/2013 05:36 PM, John Spencer wrote:
> > previously, pcm.h prototyped the functions
> > snd_pcm_format_silence* with u_int_XX types
> > (legacy BSD types from sys/types.h),
> > while the implementation in pcm_misc.c used the C99
> > stdint.h types uint_XX.
> >
> > this caused compilation errors on systems where the
> > typedef for u_int_XX and uint_XX is not exactly the same.
> >
> > we fix it by using the C99 stdint.h types everywhere.
> >
> > Signed-off-by: John Spencer<maillist-alsa@barfooze.de>
> > ---
> > include/pcm.h | 9 +++++----
> > src/pcm/pcm_misc.c | 42 +++++++++++++++++++++---------------------
> > 2 files changed, 26 insertions(+), 25 deletions(-)
> >
> > diff --git a/include/pcm.h b/include/pcm.h
> > index 95b8aed..cd847e4 100644
> > --- a/include/pcm.h
> > +++ b/include/pcm.h
> > @@ -33,6 +33,7 @@
> > extern "C" {
> > #endif
> >
> > +#include<stdint.h>
> > /**
> > * \defgroup PCM PCM Interface
> > * See the \ref pcm page for more details.
> > @@ -1048,10 +1049,10 @@ int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
> > int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
> > snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
> > ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
> > -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
> > -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
> > -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
> > -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
> > +uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
> > +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
> > +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
> > +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
> > int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
> >
> > snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
> > diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c
> > index d52160c..2a8be21 100644
> > --- a/src/pcm/pcm_misc.c
> > +++ b/src/pcm/pcm_misc.c
> > @@ -363,7 +363,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples)
> > * \param format Sample format
> > * \return silence 64 bit word
> > */
> > -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > {
> > switch (format) {
> > case SNDRV_PCM_FORMAT_S8:
> > @@ -437,7 +437,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > {
> > union {
> > float f[2];
> > - u_int64_t i;
> > + uint64_t i;
> > } u;
> > u.f[0] = u.f[1] = 0.0;
> > #ifdef SNDRV_LITTLE_ENDIAN
> > @@ -450,7 +450,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > {
> > union {
> > double f;
> > - u_int64_t i;
> > + uint64_t i;
> > } u;
> > u.f = 0.0;
> > #ifdef SNDRV_LITTLE_ENDIAN
> > @@ -463,7 +463,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > {
> > union {
> > float f[2];
> > - u_int64_t i;
> > + uint64_t i;
> > } u;
> > u.f[0] = u.f[1] = 0.0;
> > #ifdef SNDRV_LITTLE_ENDIAN
> > @@ -476,7 +476,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > {
> > union {
> > double f;
> > - u_int64_t i;
> > + uint64_t i;
> > } u;
> > u.f = 0.0;
> > #ifdef SNDRV_LITTLE_ENDIAN
> > @@ -509,10 +509,10 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
> > * \param format Sample format
> > * \return silence 32 bit word
> > */
> > -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> > +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> > {
> > assert(snd_pcm_format_physical_width(format)<= 32);
> > - return (u_int32_t)snd_pcm_format_silence_64(format);
> > + return (uint32_t)snd_pcm_format_silence_64(format);
> > }
> >
> > /**
> > @@ -520,10 +520,10 @@ u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
> > * \param format Sample format
> > * \return silence 16 bit word
> > */
> > -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> > +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> > {
> > assert(snd_pcm_format_physical_width(format)<= 16);
> > - return (u_int16_t)snd_pcm_format_silence_64(format);
> > + return (uint16_t)snd_pcm_format_silence_64(format);
> > }
> >
> > /**
> > @@ -531,10 +531,10 @@ u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
> > * \param format Sample format
> > * \return silence 8 bit word
> > */
> > -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
> > +uint8_t snd_pcm_format_silence(snd_pcm_format_t format)
> > {
> > assert(snd_pcm_format_physical_width(format)<= 8);
> > - return (u_int8_t)snd_pcm_format_silence_64(format);
> > + return (uint8_t)snd_pcm_format_silence_64(format);
> > }
> >
> > /**
> > @@ -550,7 +550,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> > return 0;
> > switch (snd_pcm_format_physical_width(format)) {
> > case 4: {
> > - u_int8_t silence = snd_pcm_format_silence_64(format);
> > + uint8_t silence = snd_pcm_format_silence_64(format);
> > unsigned int samples1;
> > if (samples % 2 != 0)
> > return -EINVAL;
> > @@ -559,13 +559,13 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> > break;
> > }
> > case 8: {
> > - u_int8_t silence = snd_pcm_format_silence_64(format);
> > + uint8_t silence = snd_pcm_format_silence_64(format);
> > memset(data, silence, samples);
> > break;
> > }
> > case 16: {
> > - u_int16_t silence = snd_pcm_format_silence_64(format);
> > - u_int16_t *pdata = (u_int16_t *)data;
> > + uint16_t silence = snd_pcm_format_silence_64(format);
> > + uint16_t *pdata = (uint16_t *)data;
> > if (! silence)
> > memset(data, 0, samples * 2);
> > else {
> > @@ -575,8 +575,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> > break;
> > }
> > case 24: {
> > - u_int32_t silence = snd_pcm_format_silence_64(format);
> > - u_int8_t *pdata = (u_int8_t *)data;
> > + uint32_t silence = snd_pcm_format_silence_64(format);
> > + uint8_t *pdata = (uint8_t *)data;
> > if (! silence)
> > memset(data, 0, samples * 3);
> > else {
> > @@ -595,8 +595,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> > break;
> > }
> > case 32: {
> > - u_int32_t silence = snd_pcm_format_silence_64(format);
> > - u_int32_t *pdata = (u_int32_t *)data;
> > + uint32_t silence = snd_pcm_format_silence_64(format);
> > + uint32_t *pdata = (uint32_t *)data;
> > if (! silence)
> > memset(data, 0, samples * 4);
> > else {
> > @@ -606,8 +606,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
> > break;
> > }
> > case 64: {
> > - u_int64_t silence = snd_pcm_format_silence_64(format);
> > - u_int64_t *pdata = (u_int64_t *)data;
> > + uint64_t silence = snd_pcm_format_silence_64(format);
> > + uint64_t *pdata = (uint64_t *)data;
> > if (! silence)
> > memset(data, 0, samples * 8);
> > else {
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Default volume set to maximum
2013-10-10 12:49 ` Takashi Iwai
@ 2013-10-10 13:13 ` stéphane cerveau
2013-10-10 14:11 ` Clemens Ladisch
0 siblings, 1 reply; 7+ messages in thread
From: stéphane cerveau @ 2013-10-10 13:13 UTC (permalink / raw)
To: alsa-devel
Dear all,
I would like to have a default volume set to maximum for my DAC/device.
Is there a way to tell alsa that my default volume is a certain value ?
Best regards.
Stéphane
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Default volume set to maximum
2013-10-10 13:13 ` Default volume set to maximum stéphane cerveau
@ 2013-10-10 14:11 ` Clemens Ladisch
2013-10-10 14:48 ` stéphane cerveau
0 siblings, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2013-10-10 14:11 UTC (permalink / raw)
To: stéphane cerveau, alsa-devel
stéphane cerveau wrote:
> Dear all,
Please do not reply to another message if you want to start
a new thread.
> I would like to have a default volume set to maximum for my DAC/device.
> Is there a way to tell alsa that my default volume is a certain value ?
The default value is whatever volume the device uses when it is
powered up, and typically cannot be changed.
It is possible to change the value later. Many distributions save/
restore mixer settings when the computer is shut down/started up.
What exactly is your problem?
Regards,
Clemens
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Default volume set to maximum
2013-10-10 14:11 ` Clemens Ladisch
@ 2013-10-10 14:48 ` stéphane cerveau
2013-10-11 11:52 ` Clemens Ladisch
0 siblings, 1 reply; 7+ messages in thread
From: stéphane cerveau @ 2013-10-10 14:48 UTC (permalink / raw)
To: Clemens Ladisch, alsa-devel
Thx for your reply
I just wanted to know if it was possible to put some default value
overriding the default alsa mixer value.
Best regards.
Steph
On 10/10/2013 04:11 PM, Clemens Ladisch wrote:
> stéphane cerveau wrote:
>> Dear all,
> Please do not reply to another message if you want to start
> a new thread.
>
>> I would like to have a default volume set to maximum for my DAC/device.
>> Is there a way to tell alsa that my default volume is a certain value ?
> The default value is whatever volume the device uses when it is
> powered up, and typically cannot be changed.
>
> It is possible to change the value later. Many distributions save/
> restore mixer settings when the computer is shut down/started up.
>
> What exactly is your problem?
>
>
> Regards,
> Clemens
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-10-11 11:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 15:36 [PATCH] pcm: use the same set of uint_XX types everywhere John Spencer
2013-10-10 11:48 ` John Spencer
2013-10-10 12:49 ` Takashi Iwai
2013-10-10 13:13 ` Default volume set to maximum stéphane cerveau
2013-10-10 14:11 ` Clemens Ladisch
2013-10-10 14:48 ` stéphane cerveau
2013-10-11 11:52 ` Clemens Ladisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).