#include "pbd/stateful_diff_command.h"
#include "pbd/stacktrace.h"
-#include "ardour/ardour.h"
#include "ardour/audioengine.h"
#include "ardour/butler.h"
-#include "ardour/configuration.h"
-#include "ardour/cycle_timer.h"
#include "ardour/debug.h"
#include "ardour/io.h"
#include "ardour/midi_diskstream.h"
#include "ardour/midi_region.h"
#include "ardour/playlist_factory.h"
#include "ardour/region_factory.h"
-#include "ardour/route.h"
-#include "ardour/send.h"
#include "ardour/session.h"
#include "ardour/session_playlists.h"
#include "ardour/smf_source.h"
+#include "ardour/types.h"
#include "ardour/utils.h"
#include "midi++/types.h"
adjust_capture_position = 0;
if (nominally_recording || (re && was_recording && _session.get_record_enabled() && _session.config.get_punch_in())) {
- OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
+ Evoral::OverlapType ot = Evoral::coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
calculate_record_range(ot, transport_frame, nframes, rec_nframes, rec_offset);
uint32_t frames_read = g_atomic_int_get(&_frames_read_from_ringbuffer);
uint32_t frames_written = g_atomic_int_get(&_frames_written_to_ringbuffer);
- cerr << name() << " MDS written: " << frames_written << " - read: " << frames_read <<
- " = " << frames_written - frames_read
- << " + " << playback_distance << " < " << midi_readahead << " = " << need_butler << ")" << endl;
-
- assert (frames_read <= frames_written);
+ /*
+ cerr << name() << " MDS written: " << frames_written << " - read: " << frames_read <<
+ " = " << frames_written - frames_read
+ << " + " << playback_distance << " < " << midi_readahead << " = " << need_butler << ")" << endl;
+ */
- if ((frames_written - frames_read) + playback_distance < midi_readahead) {
- need_butler = true;
+ /* frames_read will generally be less than frames_written, but
+ * immediately after an overwrite, we can end up having read some data
+ * before we've written any. we don't need to trip an assert() on this,
+ * but we do need to check so that the decision on whether or not we
+ * need the butler is done correctly.
+ */
+
+ if (frames_read <= frames_written) {
+ if ((frames_written - frames_read) + playback_distance < midi_readahead) {
+ need_butler = true;
+ }
}
g_atomic_int_set (&_frames_read_from_ringbuffer, 0);
g_atomic_int_set (&_frames_written_to_ringbuffer, 0);
- cerr << name() << " FWTRB reset to zero for overwrite\n";
-
read (overwrite_frame, disk_io_chunk_frames, false);
file_frame = overwrite_frame; // it was adjusted by ::read()
overwrite_queued = false;
g_atomic_int_set(&_frames_read_from_ringbuffer, 0);
g_atomic_int_set(&_frames_written_to_ringbuffer, 0);
- cerr << name() << " FWTRB reset to zero for seek\n";
-
playback_sample = frame;
file_frame = frame;
}
g_atomic_int_add (&_frames_written_to_ringbuffer, this_read);
- cerr << "FWTRB added " << this_read << " now " << g_atomic_int_get (&_frames_written_to_ringbuffer) << endl;
if (reversed) {
#endif
g_atomic_int_add (&_frames_read_from_ringbuffer, nframes);
- cerr << name() << " FRFB advanced by " << nframes << " to " << g_atomic_int_get (&_frames_read_from_ringbuffer) << endl;
}
bool