Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_sndfile.c

    rebfa80d r7dea72f  
    174174      s->hop_size, read_data->length);
    175175  sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data,
    176       s->scratch_size);
    177 
    178   uint_t read_length = read_samples / s->input_channels;
     176      s->input_channels * length);
     177
     178  length = MIN(read_samples / s->input_channels, length);
    179179
    180180  /* where to store de-interleaved data */
     
    186186#endif /* HAVE_SAMPLERATE */
    187187  {
    188     read_length = MIN(length, read_length);
    189188    ptr_data = read_data->data;
    190189  }
    191190
    192191  /* de-interleaving and down-mixing data  */
    193   for (j = 0; j < read_length; j++) {
     192  for (j = 0; j < length; j++) {
    194193    ptr_data[j] = 0;
    195194    for (i = 0; i < input_channels; i++) {
     
    205204#endif /* HAVE_SAMPLERATE */
    206205
    207   *read = MIN(length, (uint_t)FLOOR(s->ratio * read_length + .5));
     206  *read = (int)FLOOR(s->ratio * length + .5);
    208207
    209208  aubio_source_pad_output (read_data, *read);
     
    219218      s->path, s->input_channels, read_data->height);
    220219  sf_count_t read_samples = aubio_sf_read_smpl (s->handle, s->scratch_data,
    221       s->scratch_size);
    222 
    223   uint_t read_length = read_samples / s->input_channels;
     220      length * s->input_channels);
     221
     222  length = MIN(read_samples / s->input_channels, length);
    224223
    225224  /* where to store de-interleaved data */
     
    231230#endif /* HAVE_SAMPLERATE */
    232231  {
    233     read_length = MIN(read_length, length);
    234232    ptr_data = read_data->data;
    235233  }
    236234
    237   for (j = 0; j < read_length; j++) {
     235  for (j = 0; j < length; j++) {
    238236    for (i = 0; i < channels; i++) {
    239237      ptr_data[i][j] = s->scratch_data[j * input_channels + i];
     
    254252#endif /* HAVE_SAMPLERATE */
    255253
    256   *read = MIN(length, (uint_t)FLOOR(s->ratio * read_length + .5));
     254  *read = (int)FLOOR(s->ratio * length + .5);
    257255
    258256  aubio_source_pad_multi_output(read_data, input_channels, *read);
Note: See TracChangeset for help on using the changeset viewer.