From 3225b24854e0810cf62c55a8ce179ff3e659bce4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 3 Mar 2011 03:54:28 +0000 Subject: [PATCH] move open-on-write call for MIDI into mark_streaming_midi_write_started() so that it works for the fork operation (or any other op that writes a new file) git-svn-id: svn://localhost/ardour2/branches/3.0@9052 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/smf_source.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index c686ae3d27..5ad5c2b745 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -221,11 +221,6 @@ SMFSource::read_unlocked (Evoral::EventSink& destination, framepos_t framecnt_t SMFSource::write_unlocked (MidiRingBuffer& source, framepos_t position, framecnt_t duration) { - if (!_open && open_for_write()) { - error << string_compose (_("cannot open MIDI file %1 for write"), _path) << endmsg; - return 0; - } - if (!_writing) { mark_streaming_write_started (); } @@ -415,6 +410,12 @@ SMFSource::mark_streaming_midi_write_started (NoteMode mode) { /* CALLER MUST HOLD LOCK */ + if (!_open && open_for_write()) { + error << string_compose (_("cannot open MIDI file %1 for write"), _path) << endmsg; + /* XXX should probably throw or return something */ + return; + } + MidiSource::mark_streaming_midi_write_started (mode); Evoral::SMF::begin_write (); _last_ev_time_beats = 0.0;