Fixes to get legacy 2.x sends working.
[ardour.git] / libs / ardour / session_state.cc
index 70abd01a724dda19db0d8d2ac1bdcfc5f2e91654..c228f3c47b92ae1d27dbc9c9f4a9ee3d0705ecee 100644 (file)
@@ -168,7 +168,8 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        pending_locate_frame = 0;
        pending_locate_roll = false;
        pending_locate_flush = false;
-       dstream_buffer_size = 0;
+       audio_dstream_buffer_size = 0;
+       midi_dstream_buffer_size = 0;
        state_tree = 0;
        state_was_pending = false;
        set_next_event ();
@@ -296,9 +297,9 @@ Session::second_stage_init (bool new_session)
                return -1;
        }
 
-       /*if (start_midi_thread ()) {
+       if (start_midi_thread ()) {
                return -1;
-       }*/
+       }
 
        // set_state() will call setup_raid_path(), but if it's a new session we need
        // to call setup_raid_path() here.
@@ -352,7 +353,7 @@ Session::second_stage_init (bool new_session)
 
        BootMessage (_("Reset Remote Controls"));
 
-       //send_full_time_code ();
+       send_full_time_code (0);
        _engine.transport_locate (0);
        deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0);
        deliver_mmc (MIDI::MachineControl::cmdLocate, 0);
@@ -2989,8 +2990,16 @@ Session::restore_history (string snapshot_name)
                                    ut->add_command (c);
                            }
                            
+                   } else if (n->name() == "DeltaCommand") {
+                        PBD::ID  id(n->property("midi_source")->value());
+                        boost::shared_ptr<MidiSource> midi_source = 
+                                boost::dynamic_pointer_cast<MidiSource, Source>(source_by_id(id));
+                        if(midi_source) {
+                                ut->add_command(new MidiModel::DeltaCommand(midi_source->model(), *n));                                 
+                        } else {
+                                error << "FIXME: Failed to downcast MidiSource for DeltaCommand" << endmsg;
+                        }
                    } else {
-
                            error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg;
                    }
            }