diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-04-07 14:39:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-04-07 14:39:34 +0000 |
commit | 5970212b876efa658857c4f1e7014bf89e358e53 (patch) | |
tree | e56e64930b90bcdd09406e8c908790711e3d6c16 /libs/ardour/audio_diskstream.cc | |
parent | 298db6ef3510fdc06c31f5425afe423a67f2113b (diff) |
similar fix for punch recording as applied to 2.X, with additional tweak that when we fetch the audio port buffer, we must use the full nframes() for the current ::roll() call and not rec_nframes. otherwise, we get back an AudioBuffer that thinks it is smaller than it really is. there may be other issues with this distinction lurking somewhere
git-svn-id: svn://localhost/ardour2/branches/3.0@6873 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_diskstream.cc')
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 8f8725163b..450bf5d789 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -459,7 +459,16 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can (*chan)->current_playback_buffer = 0; } - if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) { + /* two conditions to test for here: + + A: this track is rec-enabled, and the session has confirmed that we can record + B: this track is rec-enabled, has been recording, and we are set up for auto-punch-in + + The second test is necessary to capture the extra material that arrives AFTER the transport + frame has left the punch range (which will cause the "can_record" argument to be false). + */ + + if (nominally_recording || (re && was_recording && _session.get_record_enabled() && _session.config.get_punch_out())) { // Safeguard against situations where process() goes haywire when autopunching and last_recordable_frame < first_recordable_frame if (last_recordable_frame < first_recordable_frame) { last_recordable_frame = max_frames; @@ -467,7 +476,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes); - calculate_record_range(ot, transport_frame, nframes, rec_nframes, rec_offset); + calculate_record_range (ot, transport_frame, nframes, rec_nframes, rec_offset); if (rec_nframes && !was_recording) { capture_captured = 0; @@ -507,7 +516,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can AudioPort* const ap = _io->audio (n); assert(ap); assert(rec_nframes <= ap->get_audio_buffer(nframes).capacity()); - memcpy (chaninfo->current_capture_buffer, ap->get_audio_buffer (rec_nframes).data(rec_offset), sizeof (Sample) * rec_nframes); + memcpy (chaninfo->current_capture_buffer, ap->get_audio_buffer (nframes).data(rec_offset), sizeof (Sample) * rec_nframes); } else { @@ -1574,6 +1583,8 @@ void AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<ChannelList> c) { was_recording = false; + first_recordable_frame = max_frames; + last_recordable_frame = max_frames; if (capture_captured == 0) { return; |