mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
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
5 changed files with 977 additions and 932 deletions
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue