mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-27 23:48:22 +01:00
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
This commit is contained in:
parent
d092815d68
commit
2f55c7aa2a
4 changed files with 20 additions and 23 deletions
|
|
@ -129,6 +129,7 @@
|
|||
<menuitem action='toggle-follow-playhead'/>
|
||||
<menuitem action='toggle-stationary-playhead'/>
|
||||
<separator/>
|
||||
|
||||
</menu>
|
||||
|
||||
<menu name='Edit' action='Edit'>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
spec.total_frames = _length;
|
||||
/* 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 ...
|
||||
*/
|
||||
|
||||
while (spec.pos < _length && !spec.stop) {
|
||||
|
||||
spec.pos = _position;
|
||||
spec.total_frames = _length;
|
||||
nread = 0;
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue