Changeset 2722dc7 for src/io


Ignore:
Timestamp:
Aug 26, 2014, 5:24:09 AM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
79b54ea
Parents:
28c066e
Message:

src/io/source_sndfile.c: clarify some variables names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_sndfile.c

    r28c066e r2722dc7  
    152152void aubio_source_sndfile_do(aubio_source_sndfile_t * s, fvec_t * read_data, uint_t * read){
    153153  uint_t i,j, input_channels = s->input_channels;
    154   /* do actual reading */
     154  /* read from file into scratch_data */
    155155  sf_count_t read_samples = sf_read_float (s->handle, s->scratch_data, s->scratch_size);
    156156
    157   smpl_t *data;
    158 
    159 #ifdef HAVE_SAMPLERATE
    160   if (s->ratio != 1) {
    161     data = s->input_data->data;
     157  /* where to store de-interleaved data */
     158  smpl_t *ptr_data;
     159#ifdef HAVE_SAMPLERATE
     160  if (s->ratio != 1) {
     161    ptr_data = s->input_data->data;
    162162  } else
    163163#endif /* HAVE_SAMPLERATE */
    164164  {
    165     data = read_data->data;
     165    ptr_data = read_data->data;
    166166  }
    167167
    168168  /* de-interleaving and down-mixing data  */
    169169  for (j = 0; j < read_samples / input_channels; j++) {
    170     data[j] = 0;
     170    ptr_data[j] = 0;
    171171    for (i = 0; i < input_channels; i++) {
    172       data[j] += s->scratch_data[input_channels*j+i];
    173     }
    174     data[j] /= (smpl_t)input_channels;
     172      ptr_data[j] += s->scratch_data[input_channels*j+i];
     173    }
     174    ptr_data[j] /= (smpl_t)input_channels;
    175175  }
    176176
     
    196196  sf_count_t read_samples = sf_read_float (s->handle, s->scratch_data, s->scratch_size);
    197197
    198   smpl_t **data;
    199 
     198  /* where to store de-interleaved data */
     199  smpl_t **ptr_data;
    200200#ifdef HAVE_SAMPLERATE
    201201  if (s->ratio != 1) {
    202202    AUBIO_ERR("source_sndfile: no multi channel resampling yet");
    203203    return;
    204     //data = s->input_data->data;
     204    //ptr_data = s->input_data->data;
    205205  } else
    206206#endif /* HAVE_SAMPLERATE */
    207207  {
    208     data = read_data->data;
     208    ptr_data = read_data->data;
    209209  }
    210210
     
    214214    for (j = 0; j < read_samples / input_channels; j++) {
    215215      for (i = 0; i < read_data->height; i++) {
    216         data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];
     216        ptr_data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];
    217217      }
    218218    }
     
    222222    for (j = 0; j < read_samples / input_channels; j++) {
    223223      for (i = 0; i < input_channels; i++) {
    224         data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];
     224        ptr_data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];
    225225      }
    226226    }
     
    232232    for (j = 0; j < read_samples / input_channels; j++) {
    233233      for (i = input_channels; i < read_data->height; i++) {
    234         data[i][j] = (smpl_t)s->scratch_data[j * input_channels + (input_channels - 1)];
     234        ptr_data[i][j] = (smpl_t)s->scratch_data[j * input_channels + (input_channels - 1)];
    235235      }
    236236    }
Note: See TracChangeset for help on using the changeset viewer.