add MidiModel::sync_to_source() to push model state into its existing source; mark SMFSource as non-removable after its called SMF::end_write(); some indentation fixes
git-svn-id: svn://localhost/ardour2/branches/3.0@7350 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
601dc846da
commit
082b4a2019
@ -128,9 +128,10 @@ public:
|
||||
void apply_command(Session& session, Command* cmd);
|
||||
void apply_command_as_subcommand(Session& session, Command* cmd);
|
||||
|
||||
bool sync_to_source ();
|
||||
bool write_to(boost::shared_ptr<MidiSource> source);
|
||||
bool write_section_to(boost::shared_ptr<MidiSource> source, Evoral::MusicalTime begin = Evoral::MinMusicalTime,
|
||||
Evoral::MusicalTime end = Evoral::MaxMusicalTime);
|
||||
bool write_section_to (boost::shared_ptr<MidiSource> source, Evoral::MusicalTime begin = Evoral::MinMusicalTime,
|
||||
Evoral::MusicalTime end = Evoral::MaxMusicalTime);
|
||||
|
||||
// MidiModel doesn't use the normal AutomationList serialisation code
|
||||
// since controller data is stored in the .mid
|
||||
|
@ -869,9 +869,9 @@ MidiDiskstream::do_flush (RunContext /*context*/, bool force_flush)
|
||||
|
||||
assert(!destructive());
|
||||
|
||||
if (record_enabled()
|
||||
&& ( (_session.transport_frame() - _last_flush_frame > disk_io_chunk_frames)
|
||||
|| force_flush)) {
|
||||
if (record_enabled() &&
|
||||
((_session.transport_frame() - _last_flush_frame > disk_io_chunk_frames) ||
|
||||
force_flush)) {
|
||||
if ((!_write_source) || _write_source->midi_write (*_capture_buf, capture_start_frame, to_write) != to_write) {
|
||||
error << string_compose(_("MidiDiskstream %1: cannot write to disk"), _id) << endmsg;
|
||||
return -1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -293,22 +293,34 @@ MidiSource::session_saved()
|
||||
*/
|
||||
|
||||
flush_midi();
|
||||
cerr << name() << " @ " << this << " length at save = " << _length_beats << endl;
|
||||
|
||||
#if 0 // old style: clone the source if necessary on every session save
|
||||
// and switch to the new source
|
||||
|
||||
if (_model && _model->edited()) {
|
||||
cerr << "Model exists and is edited\n";
|
||||
|
||||
#if 0 // old style: clone the source if necessary on every session save
|
||||
// and switch to the new source
|
||||
boost::shared_ptr<MidiSource> newsrc = clone ();
|
||||
|
||||
if (newsrc) {
|
||||
_model->set_midi_source (newsrc.get());
|
||||
_model->set_midi_source (newsrc);
|
||||
Switched (newsrc); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
#else
|
||||
// new style: if the model is edited, write its contents into
|
||||
// the current source file (overwiting previous contents.
|
||||
|
||||
/* temporarily drop our reference to the model so that
|
||||
as the model pushes its current state to us, we don't
|
||||
try to update it.
|
||||
*/
|
||||
|
||||
boost::shared_ptr<MidiModel> mm = _model ;
|
||||
_model.reset ();
|
||||
mm->sync_to_source ();
|
||||
_model = mm;
|
||||
/* data is in the file now, its not removable */
|
||||
#endif
|
||||
}
|
||||
|
||||
cerr << name() << " @ " << this << " length at save = " << _length_beats << endl;
|
||||
}
|
||||
|
||||
void
|
||||
@ -322,7 +334,6 @@ MidiSource::set_note_mode(NoteMode mode)
|
||||
void
|
||||
MidiSource::drop_model ()
|
||||
{
|
||||
cerr << name() << " drop model\n";
|
||||
_model.reset();
|
||||
ModelChanged (); /* EMIT SIGNAL */
|
||||
}
|
||||
|
@ -392,6 +392,10 @@ SMFSource::mark_streaming_write_completed ()
|
||||
}
|
||||
|
||||
Evoral::SMF::end_write ();
|
||||
|
||||
/* data in the file now, not removable */
|
||||
|
||||
mark_nonremovable ();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -500,10 +504,11 @@ void
|
||||
SMFSource::flush_midi ()
|
||||
{
|
||||
if (!writable()) {
|
||||
cerr << "\n\n\n\n " << name() << " CANNOT FLUSH - not writable\n\n\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
Evoral::SMF::end_write();
|
||||
/* data in the file means its no longer removable */
|
||||
mark_nonremovable ();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user