Changeset f1eda56


Ignore:
Timestamp:
Nov 4, 2007, 4:53:41 PM (13 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
aadd27a
Parents:
2d60be3
Message:

scale.c: redo indentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/scale.c

    r2d60be3 rf1eda56  
    11/*
    2         Copyright (C) 2003 Paul Brossier
     2  Copyright (C) 2003 Paul Brossier
    33
    4         This program is free software; you can redistribute it and/or modify
    5         it under the terms of the GNU General Public License as published by
    6         the Free Software Foundation; either version 2 of the License, or
    7         (at your option) any later version.
     4  This program is free software; you can redistribute it and/or modify
     5  it under the terms of the GNU General Public License as published by
     6  the Free Software Foundation; either version 2 of the License, or
     7  (at your option) any later version.
    88
    9         This program is distributed in the hope that it will be useful,
    10         but WITHOUT ANY WARRANTY; without even the implied warranty of
    11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12         GNU General Public License for more details.
     9  This program is distributed in the hope that it will be useful,
     10  but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12  GNU General Public License for more details.
    1313
    14          You should have received a copy of the GNU General Public License
    15          along with this program; if not, write to the Free Software
    16          Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     14   You should have received a copy of the GNU General Public License
     15   along with this program; if not, write to the Free Software
     16   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     17
    1718*/
    1819
     
    2223
    2324struct _aubio_scale_t {
    24         smpl_t ilow;
    25         smpl_t ihig;
    26         smpl_t olow;
    27         smpl_t ohig;
     25  smpl_t ilow;
     26  smpl_t ihig;
     27  smpl_t olow;
     28  smpl_t ohig;
    2829
    29         smpl_t scaler;
    30         smpl_t irange;
    31        
    32         /* not implemented yet : type in/out data
    33         bool inint;
    34         bool outint;
    35         */
     30  smpl_t scaler;
     31  smpl_t irange;
     32
     33  /* not implemented yet : type in/out data
     34     bool inint;
     35     bool outint;
     36     */
    3637};
    3738
    38 aubio_scale_t * new_aubio_scale (smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig     ){
    39         aubio_scale_t * s = AUBIO_NEW(aubio_scale_t);
    40         aubio_scale_set (s, ilow, ihig, olow, ohig);
    41         return s;       
     39aubio_scale_t * new_aubio_scale (smpl_t ilow, smpl_t ihig,
     40    smpl_t olow, smpl_t ohig) {
     41  aubio_scale_t * s = AUBIO_NEW(aubio_scale_t);
     42  aubio_scale_set (s, ilow, ihig, olow, ohig);
     43  return s;
    4244}
    4345
    4446void del_aubio_scale(aubio_scale_t *s) {
    45         AUBIO_FREE(s);
     47  AUBIO_FREE(s);
    4648}
    4749
    48 void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig)
    49 {
    50         smpl_t inputrange = ihig - ilow;
    51         smpl_t outputrange= ohig - olow;
    52         s->ilow = ilow;
    53         s->ihig = ihig;
    54         s->olow = olow;
    55         s->ohig = ohig;
    56         if (inputrange == 0 )
    57                 s->scaler = 0.0f;
    58         else {
    59                 s->scaler = outputrange/inputrange;
    60                 if (inputrange < 0 )
    61                         inputrange = inputrange * -1.0f;
    62         }
     50void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig,
     51    smpl_t olow, smpl_t ohig) {
     52  smpl_t inputrange = ihig - ilow;
     53  smpl_t outputrange= ohig - olow;
     54  s->ilow = ilow;
     55  s->ihig = ihig;
     56  s->olow = olow;
     57  s->ohig = ohig;
     58  if (inputrange == 0) {
     59    s->scaler = 0.0f;
     60  } else {
     61    s->scaler = outputrange/inputrange;
     62    if (inputrange < 0) {
     63      inputrange = inputrange * -1.0f;
     64    }
     65  }
    6366}
    6467
    6568void aubio_scale_do (aubio_scale_t *s, fvec_t *input)
    6669{
    67         uint_t i, j;
    68         for (i=0; i < input->channels; i++){
    69                 for (j=0;  j < input->length; j++){
    70                         input->data[i][j] -= s->ilow;
    71                         input->data[i][j] *= s->scaler;
    72                         input->data[i][j] += s->olow;
    73                 }
    74         }
     70  uint_t i, j;
     71  for (i=0; i < input->channels; i++){
     72    for (j=0;  j < input->length; j++){
     73      input->data[i][j] -= s->ilow;
     74      input->data[i][j] *= s->scaler;
     75      input->data[i][j] += s->olow;
     76    }
     77  }
    7578}
    7679
Note: See TracChangeset for help on using the changeset viewer.