BAT: Add missing locale.h header
PATCH 1/2 BAT: Add missing locale.h header
Missing include became apparent when -O3 was not specified. Added the header to remove error messages during debug compile.
Signed-off-by Caleb Crome <[email protected]>
--- bat/bat.c | 1 + 1 file changed, 1 insertion(+)
bat/bat.c +1 -0
@@ -23,6 +23,7 @@#include <getopt.h> #include <math.h> #include <limits.h> +#include <locale.h> #include "aconfig.h" #include "gettext.h"
Signature · 1 line
2.6.1
PATCH 2/2 BAT: Change maximum number of channels from 2 to 64
Changed maximum number of channels to 64.
Added a round-robbin frequency assignment from the command line so that every frequency need not be specified on the command line. For example,
-c 6 -F 100:200:250
will result frequencies for the 6 channels to be set identically
as if the command was
-c 6 -F 100:200:250:100:200:250Signed-off-by Caleb Crome <[email protected]>
--- bat/bat.c | 37 ++++++++++++++++++++++++++----------- bat/common.h | 2 +- 2 files changed, 27 insertions(+), 12 deletions(-)
bat/bat.c +26 -11
@@ -73,16 +73,30 @@ err_exit:static void get_sine_frequencies (struct bat *bat,char *freq) { -char *tmp1; - - tmp1 =strchr (freq,':' ); -if (tmp1 ==NULL ) { - bat->target_freq[1 ] = bat->target_freq[0 ] =atof (optarg); - }else { - *tmp1 ='\0' ; - bat->target_freq[0 ] =atof (optarg); - bat->target_freq[1 ] =atof (tmp1 +1 ); +char *tmp0, *tmp1; +int ncolons; +int nfreqs; +int i; + ncolons =0 ; + tmp1 = freq; +while ((tmp1 =strchr (tmp1,':' ))) { + tmp1++; + ncolons ++; + } + nfreqs = ncolons+1 ; + + tmp0 = freq; + tmp1 =strchr (tmp0,':' ); +for (i =0 ; i <MAX_CHANNELS && i < nfreqs; i++) { +if (i+1 < nfreqs) + *tmp1 ='\0' ; + bat->target_freq[i] =atof (tmp0); + tmp0 = tmp1+1 ; +if (i+1 < nfreqs) + tmp1 =strchr (tmp0,':' ); } +for (i = nfreqs; i <MAX_CHANNELS ; i++) + bat->target_freq[i] = bat->target_freq[i % nfreqs]; }static void get_format (struct bat *bat,char *optarg)
@@ -302,6 +316,7 @@ _("Usage: bat [-options]...\n"static void set_defaults (struct bat *bat) { +int i;memset (bat,0 ,sizeof (struct bat ));/* Set default values */
@@ -313,8 +328,8 @@ static void set_defaults(struct bat *bat) bat->convert_float_to_sample = convert_float_to_int16; bat->convert_sample_to_double = convert_int16_to_double; bat->frames = bat->rate *2 ; - bat->target_freq[0 ] =997.0 ; - bat->target_freq[1 ] =997.0 ; +for (i =0 ; i <MAX_CHANNELS ; i++) + bat->target_freq[i] =997.0 ; bat->sigma_k =3.0 ; bat->playback.device =NULL ; bat->capture.device =NULL ;
bat/common.h +1 -1
@@ -30,7 +30,7 @@#define WAV_DATA COMPOSE('d', 'a', 't', 'a')#define WAV_FORMAT_PCM 1/* PCM WAVE file encoding */ -#define MAX_CHANNELS 2 +#define MAX_CHANNELS 64#define MIN_CHANNELS 1#define MAX_PEAKS 10#define MAX_FRAMES (10 * 1024 * 1024)
Signature · 1 line
2.6.1
Takashi Iwai
AppliedQuoted 5 lines · Caleb Crome
Missing include became apparent when -O3 was not specified. Added the header to remove error messages during debug compile.
Signed-off-by Caleb Crome <[email protected]>
Applied, thanks.
Takashi
Quoted 24 lines
--- bat/bat.c | 1 + 1 file changed, 1 insertion(+)bat/bat.c +1
-0@@ -23,6 +23,7 @@#include <getopt.h> #include <math.h> #include <limits.h> +#include <locale.h> #include "aconfig.h" #include "gettext.h" Signature · 6 lines
2.6.1 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel