summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Chappell <jesse@essej.net>2007-03-10 01:23:37 +0000
committerJesse Chappell <jesse@essej.net>2007-03-10 01:23:37 +0000
commit45e61c210d0efb0bc72bc3061e2b8b886547161d (patch)
tree5122052aedc4a585083e7b126b22b4316e22a296
parent4fbdc0484237775b8eafd301f72e19973efc288d (diff)
fixed some frame count issues with importing.
git-svn-id: svn://localhost/ardour2/trunk@1570 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/import.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index 25c2d4b560..b81f438490 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -210,19 +210,20 @@ Session::import_audiofile (import_status& status)
while (!status.cancel) {
- nframes_t nread;
+ nframes_t nread, nfread;
long x;
long chn;
if ((nread = importable->read (data, nframes)) == 0) {
break;
}
+ nfread = nread / info.channels;
/* de-interleave */
for (chn = 0; chn < info.channels; ++chn) {
- for (x = chn, n = 0; n < nframes; x += info.channels, ++n) {
+ for (x = chn, n = 0; n < nfread; x += info.channels, ++n) {
channel_data[chn][n] = (Sample) data[x];
}
}
@@ -230,7 +231,7 @@ Session::import_audiofile (import_status& status)
/* flush to disk */
for (chn = 0; chn < info.channels; ++chn) {
- newfiles[chn]->write (channel_data[chn], nread / info.channels);
+ newfiles[chn]->write (channel_data[chn], nfread);
}
so_far += nread;
@@ -364,7 +365,7 @@ ResampledImportableSource::read (Sample* output, nframes_t nframes)
if ((err = src_process (src_state, &src_data))) {
error << string_compose(_("Import: %1"), src_strerror (err)) << endmsg ;
- return false ;
+ return 0 ;
}
/* Terminate if at end */
@@ -376,6 +377,6 @@ ResampledImportableSource::read (Sample* output, nframes_t nframes)
src_data.data_in += src_data.input_frames_used * sf_info->channels ;
src_data.input_frames -= src_data.input_frames_used ;
- return nframes;
+ return src_data.output_frames_gen * sf_info->channels;
}