13
0

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
This commit is contained in:
Paul Davis 2010-04-07 14:39:34 +00:00
parent 298db6ef35
commit 5970212b87

View File

@ -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;