Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_sndfile.c

    r50e10a9 r69440b8  
    5959  // some temporary memory for sndfile to write at
    6060  uint_t scratch_size;
    61   float *scratch_data;
     61  smpl_t *scratch_data;
    6262};
    6363
     
    199199  }
    200200
    201   if (read_data->height < input_channels) {
    202     // destination matrix has less channels than the file; copy only first
    203     // channels of the file, de-interleaving data
    204     for (j = 0; j < read_samples / input_channels; j++) {
    205       for (i = 0; i < read_data->height; i++) {
    206         data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];
    207       }
    208     }
    209   } else {
    210     // destination matrix has as many or more channels than the file; copy each
    211     // channel from the file to the destination matrix, de-interleaving data
    212     for (j = 0; j < read_samples / input_channels; j++) {
    213       for (i = 0; i < input_channels; i++) {
    214         data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];
    215       }
    216     }
    217   }
    218 
     201  /* de-interleaving data */
     202  for (j = 0; j < read_samples / input_channels; j++) {
     203    for (i = 0; i < input_channels; i++) {
     204      data[i][j] = (smpl_t)s->scratch_data[input_channels*j+i];
     205    }
     206  }
     207  // if read_data has more channels than the file
    219208  if (read_data->height > input_channels) {
    220     // destination matrix has more channels than the file; copy last channel
    221     // of the file to each additional channels, de-interleaving data
     209    // copy last channel to all additional channels
    222210    for (j = 0; j < read_samples / input_channels; j++) {
    223211      for (i = input_channels; i < read_data->height; i++) {
    224         data[i][j] = (smpl_t)s->scratch_data[j * input_channels + (input_channels - 1)];
     212        data[i][j] = s->scratch_data[ j * input_channels + (input_channels - 1)];
    225213      }
    226214    }
Note: See TracChangeset for help on using the changeset viewer.