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
This commit is contained in:
Paul Davis 2011-03-03 03:54:28 +00:00
parent 36f764167b
commit 3225b24854

View File

@ -221,11 +221,6 @@ SMFSource::read_unlocked (Evoral::EventSink<framepos_t>& destination, framepos_t
framecnt_t
SMFSource::write_unlocked (MidiRingBuffer<framepos_t>& 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;