diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-17 19:38:42 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-17 19:38:42 +0000 |
commit | 2f55c7aa2aa5ba6d46ee7d7719a505351dbe6053 (patch) | |
tree | a620c525ba4c00bf90daacc4643328db09602e65 | |
parent | d092815d68b9131a0423cd583d8a3a766eeef1f7 (diff) |
region export/bounce should use ::read_at() methods, not read directly from the source (thus providing fade outs, automation, etc; minor code cleanups
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@7113 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 1 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 34 |
4 files changed, 19 insertions, 22 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index e4dbfa52dd..9200c0b453 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -129,6 +129,7 @@ <menuitem action='toggle-follow-playhead'/> <menuitem action='toggle-stationary-playhead'/> <separator/> + </menu> <menu name='Edit' action='Edit'> diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 979dc1237c..cd0504f7df 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1667,10 +1667,7 @@ ARDOUR_UI::toggle_record_enable (uint32_t dstream) if ((t = dynamic_cast<Track*>(r.get())) != 0) { t->diskstream()->set_record_enabled (!t->diskstream()->record_enabled()); } - } - if (session == 0) { - return; - } + } } void diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 2174fb9228..fa103085c9 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -98,7 +98,6 @@ class AudioRegion : public Region }; virtual nframes64_t read (Sample*, nframes64_t pos, nframes64_t cnt, int channel) const; - virtual nframes64_t read_with_ops (Sample*, nframes64_t pos, nframes64_t cnt, int channel, ReadOps rops) const; virtual nframes64_t readable_length() const { return length(); } virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf, diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 0eff9a2e3d..7130e52d43 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -498,12 +498,6 @@ AudioRegion::read (Sample* buf, nframes64_t timeline_position, nframes64_t cnt, return _read_at (sources, _length, buf, 0, 0, _position + timeline_position, cnt, channel, 0, 0, ReadOps (0)); } -nframes64_t -AudioRegion::read_with_ops (Sample* buf, nframes64_t file_position, nframes64_t cnt, int channel, ReadOps rops) const -{ - return _read_at (sources, _length, buf, 0, 0, file_position, cnt, channel, 0, 0, rops); -} - nframes_t AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t file_position, nframes_t cnt, @@ -693,7 +687,7 @@ AudioRegion::_read_at (const SourceList& srcs, nframes_t limit, Session::apply_gain_to_buffer (mixdown_buffer, to_read, _scale_amplitude); } - if (!opaque()) { + if (!opaque() && (buf != mixdown_buffer)) { /* gack. the things we do for users. */ @@ -1311,7 +1305,9 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec) { const nframes_t blocksize = 4096; nframes_t to_read; + nframes_t nread; int status = -1; + boost::scoped_array<Sample> gain_buffer (new Sample[blocksize]); spec.channels = sources.size(); @@ -1319,19 +1315,23 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec) goto out; } - spec.pos = 0; + /* the ::read_at() methods expect a starting position that is absolute, not relative + to our bounds. So we begin at our _position on the timeline ... + */ + + spec.pos = _position; spec.total_frames = _length; + nread = 0; - while (spec.pos < _length && !spec.stop) { - + while (spec.pos < last_frame() && !spec.stop) { /* step 1: interleave */ - to_read = min (_length - spec.pos, blocksize); - + to_read = min (_length - nread, blocksize); + if (spec.channels == 1) { - - if (sources.front()->read (spec.dataF, _start + spec.pos, to_read) != to_read) { + + if (read_at (spec.dataF, spec.dataF, gain_buffer.get(), spec.pos, to_read) != to_read) { goto out; } @@ -1341,7 +1341,7 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec) for (uint32_t chan = 0; chan < spec.channels; ++chan) { - if (sources[chan]->read (buf.get(), _start + spec.pos, to_read) != to_read) { + if (read_at (buf.get(), buf.get(), gain_buffer.get(), spec.pos, to_read, chan) != to_read) { goto out; } @@ -1356,8 +1356,8 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec) } spec.pos += to_read; - spec.progress = (double) spec.pos /_length; - + nread += to_read; + spec.progress = (double) nread /_length; } status = 0; |