From 070a905ba6e3e01a1a586957755b950a79cfaa72 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 7 Apr 2010 13:54:23 +0000 Subject: fix for wierd punch behaviour where non-rec-enabled tracks end up with regions (typically at zero on the timeline) after a punch/capture pass. needs careful and thorough testing git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6872 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audio_diskstream.cc | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'libs') diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 16cda7fdd3..8e987c4f54 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -410,7 +410,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram /* starting to record: compute first+last frames */ first_recordable_frame = transport_frame + _capture_offset; - // cerr << "set FRF = " << transport_frame << " + " << _capture_offset << " = " << first_recordable_frame << endl; + // cerr << _name << " set FRF = " << transport_frame << " + " << _capture_offset << " = " << first_recordable_frame << endl; last_recordable_frame = max_frames; capture_start_frame = transport_frame; @@ -419,10 +419,10 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram /* was stopped, now rolling (and recording) */ if (_alignment_style == ExistingMaterial) { - //cerr << "A FRF += " << _session.worst_output_latency () << endl; + // cerr << "\tA FRF += " << _session.worst_output_latency () << endl; first_recordable_frame += _session.worst_output_latency(); } else { - // cerr << "B FRF += " << _roll_delay<< endl; + // cerr << "\tB FRF += " << _roll_delay<< endl; first_recordable_frame += _roll_delay; } @@ -545,10 +545,21 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can (*chan)->current_playback_buffer = 0; } - if (nominally_recording || (_session.get_record_enabled() && 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() && Config->get_punch_out())) { OverlapType ot; - // Safeguard against situations where process() goes haywire when autopunching and last_recordable_frame < first_recordable_frame + // 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; @@ -1800,7 +1811,9 @@ void AudioDiskstream::finish_capture (bool rec_monitors_input, boost::shared_ptr c) { was_recording = false; - + first_recordable_frame = max_frames; + last_recordable_frame = max_frames; + if (capture_captured == 0) { return; } -- cgit v1.2.3