diff mbox

BAT: Change maximum number of channels from 2 to 64

Message ID CAG5mAdx9iZC=JPKdShjqayaU3pEOa67Wb58CNyc-YNdJE2W1SA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Caleb Crome Oct. 22, 2015, 10:05 p.m. UTC
commit 23521f2e04df7ae39ccdbc7b4a9aa59220b56495
Author: Caleb Crome <ccrome@gmail.com>
Date:   Tue Oct 20 20:57:57 2015 +0000

    Change maximum number of channels from 2 to 64.

    Added a round-robbin frequency assignment from the command line so that
    if you specify -F 100:200:250 on the command line, then all subsequent
    channels will get assigned frequencies like this first set.  So by
    specifying

       -c 6 -F 100:200:250

    the resulting frequencies for the 6 channels will be the same as if you
    specified

       -c 6 -F 100:200:250:100:200:250

Comments

Takashi Iwai Oct. 23, 2015, 5:04 a.m. UTC | #1
On Fri, 23 Oct 2015 00:05:24 +0200,
Caleb Crome wrote:
> 
> commit 23521f2e04df7ae39ccdbc7b4a9aa59220b56495
> Author: Caleb Crome <ccrome@gmail.com>
> Date:   Tue Oct 20 20:57:57 2015 +0000
> 
>     Change maximum number of channels from 2 to 64.
> 
>     Added a round-robbin frequency assignment from the command line so that
>     if you specify -F 100:200:250 on the command line, then all subsequent
>     channels will get assigned frequencies like this first set.  So by
>     specifying
> 
>        -c 6 -F 100:200:250
> 
>     the resulting frequencies for the 6 channels will be the same as if you
>     specified
> 
>        -c 6 -F 100:200:250:100:200:250

Could you reformat the patch properly as applicable via git-am?
Use git-format-patch or any other command.  Also, don't forget to give
your signed-off-by tag.

> 
> diff --git a/bat/bat.c b/bat/bat.c
> index 56cfaf6..57c9db8 100644
> --- a/bat/bat.c
> +++ b/bat/bat.c
> @@ -72,16 +72,31 @@ err_exit:
> 
>  static void get_sine_frequencies(struct bat *bat, char *freq)
>  {
> -    char *tmp1;

The indentation looks wrong.


thanks,

Takashi
Caleb Crome Oct. 23, 2015, 7:06 p.m. UTC | #2
On Thu, Oct 22, 2015 at 10:04 PM, Takashi Iwai <tiwai@suse.de> wrote:
> On Fri, 23 Oct 2015 00:05:24 +0200,
> Caleb Crome wrote:
>>
>> commit 23521f2e04df7ae39ccdbc7b4a9aa59220b56495
>> Author: Caleb Crome <ccrome@gmail.com>
>> Date:   Tue Oct 20 20:57:57 2015 +0000
>>
>>     Change maximum number of channels from 2 to 64.
>>
>>     Added a round-robbin frequency assignment from the command line so that
>>     if you specify -F 100:200:250 on the command line, then all subsequent
>>     channels will get assigned frequencies like this first set.  So by
>>     specifying
>>
>>        -c 6 -F 100:200:250
>>
>>     the resulting frequencies for the 6 channels will be the same as if you
>>     specified
>>
>>        -c 6 -F 100:200:250:100:200:250
>
> Could you reformat the patch properly as applicable via git-am?
> Use git-format-patch or any other command.  Also, don't forget to give
> your signed-off-by tag.
>


Done!  I knew there must be a better way than copy-paste of git diff
outputs. :-)

I had to send twice because the first commit I forgot to add my
sign-off key.  Sorry.

-Caleb


>>
>> diff --git a/bat/bat.c b/bat/bat.c
>> index 56cfaf6..57c9db8 100644
>> --- a/bat/bat.c
>> +++ b/bat/bat.c
>> @@ -72,16 +72,31 @@ err_exit:
>>
>>  static void get_sine_frequencies(struct bat *bat, char *freq)
>>  {
>> -    char *tmp1;
>
> The indentation looks wrong.
>
>
> thanks,
>
> Takashi
Takashi Iwai Oct. 24, 2015, 6:42 a.m. UTC | #3
On Fri, 23 Oct 2015 21:06:14 +0200,
Caleb Crome wrote:
> 
> On Thu, Oct 22, 2015 at 10:04 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > On Fri, 23 Oct 2015 00:05:24 +0200,
> > Caleb Crome wrote:
> >>
> >> commit 23521f2e04df7ae39ccdbc7b4a9aa59220b56495
> >> Author: Caleb Crome <ccrome@gmail.com>
> >> Date:   Tue Oct 20 20:57:57 2015 +0000
> >>
> >>     Change maximum number of channels from 2 to 64.
> >>
> >>     Added a round-robbin frequency assignment from the command line so that
> >>     if you specify -F 100:200:250 on the command line, then all subsequent
> >>     channels will get assigned frequencies like this first set.  So by
> >>     specifying
> >>
> >>        -c 6 -F 100:200:250
> >>
> >>     the resulting frequencies for the 6 channels will be the same as if you
> >>     specified
> >>
> >>        -c 6 -F 100:200:250:100:200:250
> >
> > Could you reformat the patch properly as applicable via git-am?
> > Use git-format-patch or any other command.  Also, don't forget to give
> > your signed-off-by tag.
> >
> 
> 
> Done!  I knew there must be a better way than copy-paste of git diff
> outputs. :-)
> 
> I had to send twice because the first commit I forgot to add my
> sign-off key.  Sorry.

Thanks.  Now I wait for ack from Intel people.


Takashi
han.lu@intel.com Oct. 26, 2015, 8:53 a.m. UTC | #4
Hi Takashi,

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Saturday, October 24, 2015 2:42 PM
> To: Caleb Crome
> Cc: Liam Girdwood; alsa-devel@alsa-project.org; Lu, Han; Gautier, Bernard
> Subject: Re: [PATCH] BAT: Change maximum number of channels from 2 to
> 64
> 
> On Fri, 23 Oct 2015 21:06:14 +0200,
> Caleb Crome wrote:
> >
> > On Thu, Oct 22, 2015 at 10:04 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > > On Fri, 23 Oct 2015 00:05:24 +0200,
> > > Caleb Crome wrote:
> > >>
> > >> commit 23521f2e04df7ae39ccdbc7b4a9aa59220b56495
> > >> Author: Caleb Crome <ccrome@gmail.com>
> > >> Date:   Tue Oct 20 20:57:57 2015 +0000
> > >>
> > >>     Change maximum number of channels from 2 to 64.
> > >>
> > >>     Added a round-robbin frequency assignment from the command line
> so that
> > >>     if you specify -F 100:200:250 on the command line, then all
> subsequent
> > >>     channels will get assigned frequencies like this first set.  So by
> > >>     specifying
> > >>
> > >>        -c 6 -F 100:200:250
> > >>
> > >>     the resulting frequencies for the 6 channels will be the same as if you
> > >>     specified
> > >>
> > >>        -c 6 -F 100:200:250:100:200:250
> > >
> > > Could you reformat the patch properly as applicable via git-am?
> > > Use git-format-patch or any other command.  Also, don't forget to
> > > give your signed-off-by tag.
> > >
> >
> >
> > Done!  I knew there must be a better way than copy-paste of git diff
> > outputs. :-)
> >
> > I had to send twice because the first commit I forgot to add my
> > sign-off key.  Sorry.
> 
> Thanks.  Now I wait for ack from Intel people.
> 
> 
> Takashi

Acked-by: Lu, Han <han.lu@intel.com>

BR,
Han Lu
diff mbox

Patch

diff --git a/bat/bat.c b/bat/bat.c
index 56cfaf6..57c9db8 100644
--- a/bat/bat.c
+++ b/bat/bat.c
@@ -72,16 +72,31 @@  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)
@@ -301,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 */
@@ -312,8 +328,9 @@  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;
diff --git a/bat/common.h b/bat/common.h
index c04452d..6d5e46e 100644
--- a/bat/common.h
+++ b/bat/common.h
@@ -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)