summaryrefslogtreecommitdiff
path: root/libs/ardour/destructive_filesource.cc
diff options
context:
space:
mode:
authorJesse Chappell <jesse@essej.net>2006-02-13 04:44:42 +0000
committerJesse Chappell <jesse@essej.net>2006-02-13 04:44:42 +0000
commite603d9583088068b25b55886b812d1ddbae9bfdb (patch)
treee4468406cdd1d773728cf77bf7aa8385de8ac391 /libs/ardour/destructive_filesource.cc
parentd61ce0ab492a537b24b046d7cf1b76e5e2f5263f (diff)
minor tweaks to make destructive tracks sorta work again (EAGAIN issues)
git-svn-id: svn://localhost/trunk/ardour2@322 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/destructive_filesource.cc')
-rw-r--r--libs/ardour/destructive_filesource.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc
index 6e3ca0ef78..bce8d5fb42 100644
--- a/libs/ardour/destructive_filesource.cc
+++ b/libs/ardour/destructive_filesource.cc
@@ -158,13 +158,14 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in,
}
if ((retval = file_read (xfade_buf, fade_position, xfade, workbuf)) != (ssize_t) xfade) {
- if (retval < 0 && errno == EAGAIN) {
- /* no data there, so no xfade */
+ if (retval >= 0 && errno == EAGAIN) {
+ /* XXX - can we really trust that errno is meaningful here? yes POSIX, i'm talking to you.
+ /* short or no data there */
- xfade = 0;
- nofade = cnt;
+ xfade = retval;
+ nofade = cnt - xfade;
} else {
- error << string_compose(_("FileSource: \"%1\" bad read (%2: %3)"), _path, errno, strerror (errno)) << endmsg;
+ error << string_compose(_("DestructiveFileSource: \"%1\" bad read retval: %2 of %5 (%3: %4)"), _path, retval, errno, strerror (errno), xfade) << endmsg;
return 0;
}
}
@@ -172,7 +173,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in,
if (nofade && !fade_in) {
cerr << "write " << nofade << " frames of prefade OUT data to " << file_pos << " .. " << file_pos + nofade << endl;
if (file_write (data, file_pos, nofade, workbuf) != (ssize_t) nofade) {
- error << string_compose(_("FileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
+ error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
return 0;
}
}
@@ -216,7 +217,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in,
cerr << "write " << xfade << " frames of xfade data to " << fade_position << " .. " << fade_position + xfade << endl;
if (file_write (xfade_buf, fade_position, xfade, workbuf) != (ssize_t) xfade) {
- error << string_compose(_("FileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
+ error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
return 0;
}
}
@@ -225,7 +226,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in,
cerr << "write " << nofade << " frames of postfade IN data to " << file_pos + xfade << " .. "
<< file_pos + xfade + nofade << endl;
if (file_write (data + xfade, file_pos + xfade, nofade, workbuf) != (ssize_t) nofade) {
- error << string_compose(_("FileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
+ error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg;
return 0;
}
}