Ignore:
Timestamp:
Dec 20, 2018, 8:30:18 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/crepe, fix/ffmpeg5, master
Children:
b8fa393, e2f1e6d
Parents:
5e9bdca (diff), 49ac58e0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/sink_vorbis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_wavread.c

    r5e9bdca ra2019c4  
    2525#include "fvec.h"
    2626#include "fmat.h"
     27#include "ioutils.h"
    2728#include "source_wavread.h"
    2829
     
    348349  uint_t end = 0;
    349350  uint_t total_wrote = 0;
     351  uint_t length = aubio_source_validate_input_length("source_wavread", s->path,
     352      s->hop_size, read_data->length);
    350353  if (s->fid == NULL) {
    351354    AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n",
     
    353356    return;
    354357  }
    355   while (total_wrote < s->hop_size) {
    356     end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
     358  while (total_wrote < length) {
     359    end = MIN(s->read_samples - s->read_index, length - total_wrote);
    357360    for (i = 0; i < end; i++) {
    358361      read_data->data[i + total_wrote] = 0;
     
    363366    }
    364367    total_wrote += end;
    365     if (total_wrote < s->hop_size) {
     368    if (total_wrote < length) {
    366369      uint_t wavread_read = 0;
    367370      aubio_source_wavread_readframe(s, &wavread_read);
     
    375378    }
    376379  }
    377   if (total_wrote < s->hop_size) {
    378     for (i = end; i < s->hop_size; i++) {
    379       read_data->data[i] = 0.;
    380     }
    381   }
     380
     381  aubio_source_pad_output (read_data, total_wrote);
     382
    382383  *read = total_wrote;
    383384}
     
    387388  uint_t end = 0;
    388389  uint_t total_wrote = 0;
     390  uint_t length = aubio_source_validate_input_length("source_wavread", s->path,
     391      s->hop_size, read_data->length);
     392  uint_t channels = aubio_source_validate_input_channels("source_wavread",
     393      s->path, s->input_channels, read_data->height);
    389394  if (s->fid == NULL) {
    390395    AUBIO_ERR("source_wavread: could not read from %s (file not opened)\n",
     
    392397    return;
    393398  }
    394   while (total_wrote < s->hop_size) {
    395     end = MIN(s->read_samples - s->read_index, s->hop_size - total_wrote);
    396     for (j = 0; j < read_data->height; j++) {
     399  while (total_wrote < length) {
     400    end = MIN(s->read_samples - s->read_index, length - total_wrote);
     401    for (j = 0; j < channels; j++) {
    397402      for (i = 0; i < end; i++) {
    398403        read_data->data[j][i + total_wrote] = s->output->data[j][i];
     
    400405    }
    401406    total_wrote += end;
    402     if (total_wrote < s->hop_size) {
     407    if (total_wrote < length) {
    403408      uint_t wavread_read = 0;
    404409      aubio_source_wavread_readframe(s, &wavread_read);
     
    412417    }
    413418  }
    414   if (total_wrote < s->hop_size) {
    415     for (j = 0; j < read_data->height; j++) {
    416       for (i = end; i < s->hop_size; i++) {
    417         read_data->data[j][i] = 0.;
    418       }
    419     }
    420   }
     419
     420  aubio_source_pad_multi_output(read_data, s->input_channels, total_wrote);
     421
    421422  *read = total_wrote;
    422423}
Note: See TracChangeset for help on using the changeset viewer.