Changeset a97eb17 for src


Ignore:
Timestamp:
Dec 13, 2018, 1:46:29 AM (12 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/timestretch, master
Children:
39c8d08
Parents:
2d64a24
Message:

[io] sink_wavwrite_do writes all to channels if more than one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_wavwrite.c

    r2d64a24 ra97eb17  
    234234
    235235void aubio_sink_wavwrite_do(aubio_sink_wavwrite_t *s, fvec_t * write_data, uint_t write){
    236   uint_t i = 0, written_frames = 0;
     236  uint_t c = 0, i = 0, written_frames = 0;
    237237
    238238  if (write > s->max_size) {
     
    242242  }
    243243
    244   for (i = 0; i < write; i++) {
    245     s->scratch_data[i] = HTOLES(FLOAT_TO_SHORT(write_data->data[i]));
    246   }
    247   written_frames = fwrite(s->scratch_data, 2, write, s->fid);
     244  for (c = 0; c < s->channels; c++) {
     245    for (i = 0; i < write; i++) {
     246      s->scratch_data[i * s->channels + c] = HTOLES(FLOAT_TO_SHORT(write_data->data[i]));
     247    }
     248  }
     249  written_frames = fwrite(s->scratch_data, 2, write * s->channels, s->fid);
    248250
    249251  if (written_frames != write) {
Note: See TracChangeset for help on using the changeset viewer.