diff options
author | Robin Gareus <robin@gareus.org> | 2016-06-17 22:17:19 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-06-17 22:17:58 +0200 |
commit | 425c40ff08f56f9a719e1ee6ba0f1b5897974447 (patch) | |
tree | 075f13615022737e258cb1e44a54f0b75995ce82 /libs/ardour/import.cc | |
parent | f4047b9a2656cbdc3e5cb3e943c6bdb421dccbfa (diff) |
fix upsampling import of X-channel files where buffersize % X != 0
Diffstat (limited to 'libs/ardour/import.cc')
-rw-r--r-- | libs/ardour/import.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index dbb3db6285..fd5d3bf98a 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -265,14 +265,14 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status, uint32_t read_count = 0; while (!status.cancel) { - framecnt_t const nread = source->read (data.get(), nframes); + framecnt_t const nread = source->read (data.get(), nframes * channels); if (nread == 0) { break; } - peak = compute_peak (data.get(), nread, peak); + peak = compute_peak (data.get(), nread * channels, peak); - read_count += nread; + read_count += nread / channels; status.progress = 0.5 * read_count / (source->ratio() * source->length() * channels); } @@ -294,7 +294,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status, uint32_t x; uint32_t chn; - if ((nread = source->read (data.get(), nframes)) == 0) { + if ((nread = source->read (data.get(), nframes * channels)) == 0) { #ifdef PLATFORM_WINDOWS /* Flush the data once we've finished importing the file. Windows can */ /* cache the data for very long periods of time (perhaps not writing */ |