From 9a1f83923d637d4bc88c7ed2af09a89d4ae58050 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 12 Dec 2010 21:36:40 +0000 Subject: [PATCH] Clear existing data before reading new to make overwrite_existing_buffers() work correctly. Should fix #3481. git-svn-id: svn://localhost/ardour2/branches/3.0@8256 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/midi_diskstream.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 29217d9e5e..1e28186fb0 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -629,6 +629,12 @@ MidiDiskstream::set_pending_overwrite (bool yn) int MidiDiskstream::overwrite_existing_buffers () { + /* This is safe as long as the butler thread is suspended, which it should be */ + _playback_buf->reset (); + + g_atomic_int_set (&_frames_read_from_ringbuffer, 0); + g_atomic_int_set (&_frames_written_to_ringbuffer, 0); + read (overwrite_frame, disk_io_chunk_frames, false); overwrite_queued = false; _pending_overwrite = false;