#endif
#include <glibmm.h>
+#include <glibmm/thread.h>
#include <midi++/mmc.h>
#include <midi++/port.h>
-#include <pbd/error.h>
-#include <glibmm/thread.h>
+#include <pbd/error.h>
#include <pbd/pathscanner.h>
#include <pbd/pthread_utils.h>
#include <pbd/search_path.h>
#include <ardour/session_directory.h>
#include <ardour/session_utils.h>
#include <ardour/session_state_utils.h>
+#include <ardour/session_metadata.h>
#include <ardour/buffer.h>
#include <ardour/audio_diskstream.h>
#include <ardour/midi_diskstream.h>
#include <ardour/midi_source.h>
#include <ardour/sndfile_helpers.h>
#include <ardour/auditioner.h>
-#include <ardour/export.h>
#include <ardour/io_processor.h>
#include <ardour/send.h>
#include <ardour/processor.h>
#include <ardour/tempo.h>
#include <ardour/audio_track.h>
#include <ardour/midi_track.h>
+#include <ardour/midi_patch_manager.h>
#include <ardour/cycle_timer.h>
#include <ardour/utils.h>
#include <ardour/named_selection.h>
#include <ardour/filename_extensions.h>
#include <ardour/directory_names.h>
#include <ardour/template_utils.h>
+#include <ardour/ticker.h>
#include <control_protocol/control_protocol.h>
set_history_depth (Config->get_history_depth());
_current_frame_rate = _engine.frame_rate ();
+ _nominal_frame_rate = _current_frame_rate;
+ _base_frame_rate = _current_frame_rate;
+
_tempo_map = new TempoMap (_current_frame_rate);
_tempo_map->StateChanged.connect (mem_fun (*this, &Session::tempo_map_changed));
g_atomic_int_set (&_record_status, Disabled);
loop_changing = false;
play_loop = false;
+ have_looped = false;
_last_roll_location = 0;
_last_record_location = 0;
pending_locate_frame = 0;
pending_locate_roll = false;
pending_locate_flush = false;
- dstream_buffer_size = 0;
- state_tree = 0;
+ audio_dstream_buffer_size = 0;
+ midi_dstream_buffer_size = 0;
state_was_pending = false;
set_next_event ();
outbound_mtc_smpte_frame = 0;
_worst_output_latency = 0;
_worst_input_latency = 0;
_worst_track_latency = 0;
- _state_of_the_state = StateOfTheState(CannotSave|InitialConnecting|Loading|Deletion);
+ _state_of_the_state = StateOfTheState(CannotSave|InitialConnecting|Loading);
+
_slave = 0;
- butler_mixdown_buffer = 0;
- butler_gain_buffer = 0;
- mmc = 0;
session_send_mmc = false;
session_send_mtc = false;
post_transport_work = PostTransportWork (0);
g_atomic_int_set (&butler_should_do_transport_work, 0);
- g_atomic_int_set (&butler_active, 0);
g_atomic_int_set (&_playback_load, 100);
g_atomic_int_set (&_capture_load, 100);
g_atomic_int_set (&_playback_load_min, 100);
g_atomic_int_set (&_capture_load_min, 100);
_play_range = false;
- waiting_to_start = false;
_exporting = false;
+ _exporting_realtime = false;
_gain_automation_buffer = 0;
_pan_automation_buffer = 0;
_npan_buffers = 0;
waveforms for clicks.
*/
- click_data = 0;
- click_emphasis_data = 0;
click_length = 0;
click_emphasis_length = 0;
_clicking = false;
waiting_for_sync_offset = false;
}
- _current_frame_rate = 48000;
- _base_frame_rate = 48000;
-
last_smpte_when = 0;
_smpte_offset = 0;
_smpte_offset_negative = true;
/* slave stuff */
- average_slave_delta = 1800;
+ average_slave_delta = 1800; // !!! why 1800 ????
have_first_delta_accumulator = false;
delta_accumulator_cnt = 0;
slave_state = Stopped;
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.
+
if (state_tree) {
if (set_state (*state_tree->root())) {
return -1;
_state_of_the_state = StateOfTheState (_state_of_the_state|CannotSave|Loading);
- // set_auto_input (true);
+
_locations.changed.connect (mem_fun (this, &Session::locations_changed));
_locations.added.connect (mem_fun (this, &Session::locations_added));
setup_click_sounds (0);
return -1;
}
- //send_full_time_code ();
+ BootMessage (_("Reset Remote Controls"));
+
+ send_full_time_code (0);
_engine.transport_locate (0);
deliver_mmc (MIDI::MachineControl::cmdMmcReset, 0);
deliver_mmc (MIDI::MachineControl::cmdLocate, 0);
+
+ MidiClockTicker::instance().set_session(*this);
+ MIDI::Name::MidiPatchManager::instance().set_session(*this);
+
+ /* initial program change will be delivered later; see ::config_changed() */
+
+ BootMessage (_("Reset Control Protocols"));
ControlProtocolManager::instance().set_session (*this);
} else {
_end_location_is_free = false;
}
+
+ _state_of_the_state = Clean;
+
+ DirtyChanged (); /* EMIT SIGNAL */
+
+ if (state_was_pending) {
+ save_state (_current_snapshot_name);
+ remove_pending_capture_state ();
+ state_was_pending = false;
+ }
+ BootMessage (_("Session loading complete"));
+
return 0;
}
AudioFileSource::set_search_path (sound_search_path.to_string ());
SMFSource::set_search_path (midi_search_path.to_string ());
+
// reset the round-robin soundfile path thingie
-
+
last_rr_session_dir = session_dirs.begin();
}
-void
-Session::initialize_start_and_end_locations (nframes_t start, nframes_t end)
+int
+Session::ensure_subdirs ()
{
- start_location->set_end (start);
- _locations.add (start_location);
+ string dir;
- end_location->set_end (end);
- _locations.add (end_location);
-}
+ dir = session_directory().peak_path().to_string();
-bool
-Session::create_session_file ()
-{
- _state_of_the_state = Clean;
+ if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session peakfile folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
+ return -1;
+ }
+
+ dir = session_directory().sound_path().to_string();
- if (save_state (_current_snapshot_name)) {
- error << "Could not create new session file" << endmsg;
- return false;
+ if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session sounds dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
+ return -1;
+ }
+
+ dir = session_directory().midi_path().to_string();
+
+ if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session midi dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
+ return -1;
}
- return true;
+
+ dir = session_directory().dead_sound_path().to_string();
+
+ if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session dead sounds folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
+ return -1;
+ }
+
+ dir = session_directory().export_path().to_string();
+
+ if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session export folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
+ return -1;
+ }
+
+ dir = analysis_dir ();
+
+ if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session analysis folder \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
+ return -1;
+ }
+
+ return 0;
}
-bool
-Session::create_session_file_from_template (const string& template_path)
+int
+Session::create (bool& new_session, const string& mix_template, nframes_t initial_length)
{
- sys::path session_file_path(_session_dir->root_path());
- session_file_path /= _name + statefile_suffix;
+ if (g_mkdir_with_parents (_path.c_str(), 0755) < 0) {
+ error << string_compose(_("Session: cannot create session folder \"%1\" (%2)"), _path, strerror (errno)) << endmsg;
+ return -1;
+ }
- try
- {
- sys::copy_file (template_path, session_file_path);
+ if (ensure_subdirs ()) {
+ return -1;
}
- catch(sys::filesystem_error& ex)
- {
- error << string_compose (_("Could not use session template %1 to create new session (%2)."),
- template_path, ex.what())
- << endmsg;
- return false;
+
+ /* check new_session so we don't overwrite an existing one */
+
+ if (!mix_template.empty()) {
+ std::string in_path = mix_template;
+
+ ifstream in(in_path.c_str());
+
+ if (in){
+ string out_path = _path;
+ out_path += _name;
+ out_path += statefile_suffix;
+
+ ofstream out(out_path.c_str());
+
+ if (out){
+ out << in.rdbuf();
+
+ // okay, session is set up. Treat like normal saved
+ // session from now on.
+
+ new_session = false;
+ return 0;
+
+ } else {
+ error << string_compose (_("Could not open %1 for writing mix template"), out_path)
+ << endmsg;
+ return -1;
+ }
+
+ } else {
+ error << string_compose (_("Could not open mix template %1 for reading"), in_path)
+ << endmsg;
+ return -1;
+ }
+
}
- return true;
+
+ /* Instantiate metadata */
+
+ _metadata = new SessionMetadata ();
+
+ /* set initial start + end point */
+
+ start_location->set_end (0);
+ _locations.add (start_location);
+
+ end_location->set_end (initial_length);
+ _locations.add (end_location);
+
+ _state_of_the_state = Clean;
+
+ save_state ("");
+
+ return 0;
}
+
int
Session::load_diskstreams (const XMLNode& node)
{
bool was_dirty = dirty();
_state_of_the_state = StateOfTheState (_state_of_the_state & ~Dirty);
-
+
if (was_dirty) {
DirtyChanged (); /* EMIT SIGNAL */
}
int
Session::load_state (string snapshot_name)
{
- if (state_tree) {
- delete state_tree;
- state_tree = 0;
- }
+ delete state_tree;
+ state_tree = 0;
state_was_pending = false;
}
const XMLProperty* prop;
- bool is_old = false;
+ bool is_old = false; // session is _very_ old (pre-2.0)
if ((prop = root.property ("version")) == 0) {
/* no version implies very old version of Ardour */
Config->set_variables (node, ConfigVariableBase::Session);
+ /* now reset MIDI ports because the session can have its own
+ MIDI configuration.
+ */
+
+ setup_midi ();
+
if ((child = find_named_node (node, "end-marker-is-free")) != 0) {
if ((prop = child->property ("val")) != 0) {
_end_location_is_free = (prop->value() == "yes");
// store libardour version, just in case
char buf[16];
- snprintf(buf, sizeof(buf)-1, "%d.%d.%d",
- libardour_major_version, libardour_minor_version, libardour_micro_version);
+ snprintf(buf, sizeof(buf), "%d.%d.%d", libardour3_major_version, libardour3_minor_version, libardour3_micro_version);
node->add_property("version", string(buf));
/* store configuration settings */
if (full_state) {
- /* store the name */
node->add_property ("name", _name);
+ snprintf (buf, sizeof (buf), "%" PRId32, _nominal_frame_rate);
+ node->add_property ("sample-rate", buf);
if (session_dirs.size() > 1) {
node->add_child_nocopy (get_options());
+ node->add_child_nocopy (_metadata->get_state());
+
child = node->add_child ("Sources");
if (full_state) {
node->add_child_nocopy (loc.get_state());
}
- child = node->add_child ("Connections");
+ child = node->add_child ("Bundles");
{
Glib::Mutex::Lock lm (bundle_lock);
for (BundleList::iterator i = _bundles.begin(); i != _bundles.end(); ++i) {
- if (!(*i)->dynamic()) {
- child->add_child_nocopy ((*i)->get_state());
+ boost::shared_ptr<UserBundle> b = boost::dynamic_pointer_cast<UserBundle> (*i);
+ if (b) {
+ child->add_child_nocopy (b->get_state());
}
}
}
_name = prop->value ();
}
+ if ((prop = node.property (X_("sample-rate"))) != 0) {
+
+ _nominal_frame_rate = atoi (prop->value());
+
+ if (_nominal_frame_rate != _current_frame_rate) {
+ if (AskAboutSampleRateMismatch (_nominal_frame_rate, _current_frame_rate)) {
+ return -1;
+ }
+ }
+ }
+
setup_raid_path(_session_dir->root_path().to_string());
if ((prop = node.property (X_("id-counter"))) != 0) {
/* Object loading order:
- MIDI Control
Path
extra
Options/Config
+ MIDI Control // relies on data from Options/Config
+ Metadata
Locations
Sources
AudioRegions
ControlProtocols
*/
- if (use_config_midi_ports ()) {
- }
-
if ((child = find_named_node (node, "extra")) != 0) {
_extra_xml = new XMLNode (*child);
}
error << _("Session: XML state has no options section") << endmsg;
}
+ if (use_config_midi_ports ()) {
+ }
+
+ if ((child = find_named_node (node, "Metadata")) == 0) {
+ warning << _("Session: XML state has no metadata section (2.0 session?)") << endmsg;
+ } else if (_metadata->set_state (*child)) {
+ goto out;
+ }
+
if ((child = find_named_node (node, "Locations")) == 0) {
error << _("Session: XML state has no locations section") << endmsg;
goto out;
goto out;
}
- if ((child = find_named_node (node, "Connections")) == 0) {
- error << _("Session: XML state has no connections section") << endmsg;
- goto out;
- } else if (load_bundles (*child)) {
- goto out;
+ if ((child = find_named_node (node, "Bundles")) == 0) {
+ warning << _("Session: XML state has no bundles section (2.0 session?)") << endmsg;
+ //goto out;
+ } else {
+ /* We can't load Bundles yet as they need to be able
+ to convert from port names to Port objects, which can't happen until
+ later */
+ _bundle_xml_node = new XMLNode (*child);
}
-
+
if ((child = find_named_node (node, "EditGroups")) == 0) {
error << _("Session: XML state has no edit groups section") << endmsg;
goto out;
} else if (_click_io) {
_click_io->set_state (*child);
}
-
+
if ((child = find_named_node (node, "ControlProtocols")) != 0) {
ControlProtocolManager::instance().set_protocol_states (*child);
}
StateReady (); /* EMIT SIGNAL */
- _state_of_the_state = Clean;
-
- if (state_was_pending) {
- save_state (_current_snapshot_name);
- remove_pending_capture_state ();
- state_was_pending = false;
- }
-
return 0;
out:
return -1;
}
+ BootMessage (string_compose (_("Loaded track/bus %1"), route->name()));
+
new_routes.push_back (route);
}
- add_routes (new_routes);
+ add_routes (new_routes, false);
return 0;
}
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((region = XMLRegionFactory (**niter, false)) == 0) {
- error << _("Session: cannot create Region from XML description.") << endmsg;
+ error << _("Session: cannot create Region from XML description.");
+ const XMLProperty *name = (**niter).property("name");
+
+ if (name) {
+ error << " " << string_compose (_("Can not load state for region '%1'"), name->value());
+ }
+
+ error << endmsg;
}
}
boost::shared_ptr<Source> source;
boost::shared_ptr<AudioSource> as;
SourceList sources;
+ SourceList master_sources;
uint32_t nchans = 1;
char buf[128];
sources.push_back (as);
}
}
-
+
+ for (uint32_t n=1; n < nchans; ++n) {
+ snprintf (buf, sizeof(buf), X_("master-source-%d"), n);
+ if ((prop = node.property (buf)) != 0) {
+
+ PBD::ID id2 (prop->value());
+
+ if ((source = source_by_id (id2)) == 0) {
+ error << string_compose(_("Session: XMLNode describing a AudioRegion references an unknown source id =%1"), id2) << endmsg;
+ return boost::shared_ptr<AudioRegion>();
+ }
+
+ as = boost::dynamic_pointer_cast<AudioSource>(source);
+ if (!as) {
+ error << string_compose(_("Session: XMLNode describing a AudioRegion references a non-audio source id =%1"), id2) << endmsg;
+ return boost::shared_ptr<AudioRegion>();
+ }
+ master_sources.push_back (as);
+ }
+ }
+
try {
boost::shared_ptr<AudioRegion> region (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, node)));
}
}
+ if (!master_sources.empty()) {
+ if (master_sources.size() == nchans) {
+ error << _("Session: XMLNode describing an AudioRegion is missing some master sources; ignored") << endmsg;
+ } else {
+ region->set_master_sources (master_sources);
+ }
+ }
+
return region;
}
char buf[PATH_MAX+1];
uint32_t n;
SessionDirectory sdir(get_best_session_directory_for_new_source());
- string sound_dir = ((type == DataType::AUDIO)
- ? sdir.sound_path().to_string()
- : sdir.midi_path().to_string());
+ sys::path source_dir = ((type == DataType::AUDIO)
+ ? sdir.sound_path() : sdir.midi_path());
string ext = ((type == DataType::AUDIO) ? ".wav" : ".mid");
for (n = 0; n < 999999; ++n) {
if (identifier.length()) {
- snprintf (buf, sizeof(buf), "%s/%s%s%" PRIu32 "%s", sound_dir.c_str(), name.c_str(),
+ snprintf (buf, sizeof(buf), "%s%s%" PRIu32 "%s", name.c_str(),
identifier.c_str(), n, ext.c_str());
} else {
- snprintf (buf, sizeof(buf), "%s/%s-%" PRIu32 "%s", sound_dir.c_str(), name.c_str(),
+ snprintf (buf, sizeof(buf), "%s-%" PRIu32 "%s", name.c_str(),
n, ext.c_str());
}
- if (!Glib::file_test (buf, Glib::FILE_TEST_EXISTS)) {
- return buf;
+ sys::path source_path = source_dir / buf;
+
+ if (!sys::exists (source_path)) {
+ return source_path.to_string();
}
}
}
try {
- return SourceFactory::create (*this, node);
+ /* note: do peak building in another thread when loading session state */
+ return SourceFactory::create (*this, node, true);
}
catch (failed_constructor& err) {
return 0;
}
+int
+Session::rename_template (string old_name, string new_name)
+{
+ sys::path old_path (user_template_directory());
+ old_path /= old_name + template_suffix;
+
+ sys::path new_path(user_template_directory());
+ new_path /= new_name + template_suffix;
+
+ if (sys::exists (new_path)) {
+ warning << string_compose(_("Template \"%1\" already exists - template not renamed"),
+ new_path.to_string()) << endmsg;
+ return -1;
+ }
+
+ try {
+ sys::rename (old_path, new_path);
+ return 0;
+ } catch (...) {
+ return -1;
+ }
+}
+
+int
+Session::delete_template (string name)
+{
+ sys::path path = user_template_directory();
+ path /= name + template_suffix;
+
+ try {
+ sys::remove (path);
+ return 0;
+ } catch (...) {
+ return -1;
+ }
+}
+
void
Session::refresh_disk_space ()
{
string
Session::automation_dir () const
{
- string res = _path;
- res += "automation/";
- return res;
+ return Glib::build_filename (_path, "automation");
}
-int
-Session::load_bundles (const XMLNode& node)
+string
+Session::analysis_dir () const
{
- XMLNodeList nlist = node.children();
- XMLNodeConstIterator niter;
-
- set_dirty();
+ return Glib::build_filename (_path, "analysis");
+}
- for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
- if ((*niter)->name() == "InputConnection") {
- add_bundle (boost::shared_ptr<Bundle> (new InputBundle (**niter)));
- } else if ((*niter)->name() == "OutputConnection") {
- add_bundle (boost::shared_ptr<Bundle> (new OutputBundle (**niter)));
- } else {
- error << string_compose(_("Unknown node \"%1\" found in Connections list from state file"), (*niter)->name()) << endmsg;
- return -1;
- }
- }
+int
+Session::load_bundles (XMLNode const & node)
+{
+ XMLNodeList nlist = node.children();
+ XMLNodeConstIterator niter;
+
+ set_dirty();
+
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
+ if ((*niter)->name() == "InputBundle") {
+ add_bundle (boost::shared_ptr<UserBundle> (new UserBundle (**niter, true)));
+ } else if ((*niter)->name() == "OutputBundle") {
+ add_bundle (boost::shared_ptr<UserBundle> (new UserBundle (**niter, false)));
+ } else {
+ error << string_compose(_("Unknown node \"%1\" found in Bundles list from state file"), (*niter)->name()) << endmsg;
+ return -1;
+ }
+ }
return 0;
}
save_state (_current_snapshot_name);
}
+static bool
+state_file_filter (const string &str, void *arg)
+{
+ return (str.length() > strlen(statefile_suffix) &&
+ str.find (statefile_suffix) == (str.length() - strlen (statefile_suffix)));
+}
+
+struct string_cmp {
+ bool operator()(const string* a, const string* b) {
+ return *a < *b;
+ }
+};
+
+static string*
+remove_end(string* state)
+{
+ string statename(*state);
+
+ string::size_type start,end;
+ if ((start = statename.find_last_of ('/')) != string::npos) {
+ statename = statename.substr (start+1);
+ }
+
+ if ((end = statename.rfind(".ardour")) == string::npos) {
+ end = statename.length();
+ }
+
+ return new string(statename.substr (0, end));
+}
+
+vector<string *> *
+Session::possible_states (string path)
+{
+ PathScanner scanner;
+ vector<string*>* states = scanner (path, state_file_filter, 0, false, false);
+
+ transform(states->begin(), states->end(), states->begin(), remove_end);
+
+ string_cmp cmp;
+ sort (states->begin(), states->end(), cmp);
+
+ return states;
+}
+
+vector<string *> *
+Session::possible_states () const
+{
+ return possible_states(_path);
+}
+
RouteGroup *
Session::add_edit_group (string name)
{
current_trans->add_command (cmd);
}
+ if (current_trans->empty()) {
+ return;
+ }
+
gettimeofday (&now, 0);
current_trans->set_timestamp (now);
int ret = -1;
_state_of_the_state = (StateOfTheState) (_state_of_the_state | InCleanup);
+
/* step 1: consider deleting all unused playlists */
newpath += dead_sound_dir_name;
if (g_mkdir_with_parents (newpath.c_str(), 0755) < 0) {
- error << string_compose(_("Session: cannot create session peakfile dir \"%1\" (%2)"), newpath, strerror (errno)) << endmsg;
+ error << string_compose(_("Session: cannot create session peakfile folder \"%1\" (%2)"), newpath, strerror (errno)) << endmsg;
return -1;
}
out:
_state_of_the_state = (StateOfTheState) (_state_of_the_state & ~InCleanup);
+
return ret;
}
_state_of_the_state = StateOfTheState (_state_of_the_state | Dirty);
+
if (!was_dirty) {
DirtyChanged(); /* EMIT SIGNAL */
}
_state_of_the_state = Clean;
+
if (was_dirty) {
DirtyChanged(); /* EMIT SIGNAL */
}
Session::set_deletion_in_progress ()
{
_state_of_the_state = StateOfTheState (_state_of_the_state | Deletion);
+
}
void
}
void
-Session::add_instant_xml (XMLNode& node)
+Session::add_instant_xml (XMLNode& node, bool write_to_config)
{
Stateful::add_instant_xml (node, _path);
- Config->add_instant_xml (node);
+ if (write_to_config) {
+ Config->add_instant_xml (node);
+ }
}
XMLNode*
const string xml_filename = snapshot_name + history_suffix;
const sys::path xml_path = _session_dir->root_path() / xml_filename;
- info << string_compose(_("Loading history from '%1'."), xml_path.to_string()) << endmsg;
+ cerr << "Loading history from " << xml_path.to_string() << endmsg;
if (!sys::exists (xml_path)) {
info << string_compose (_("%1: no history file \"%2\" for this session."),
struct timeval tv;
ut->set_name(t->property("name")->value());
- stringstream ss(t->property("tv_sec")->value());
+ stringstream ss(t->property("tv-sec")->value());
ss >> tv.tv_sec;
- ss.str(t->property("tv_usec")->value());
+ ss.str(t->property("tv-usec")->value());
ss >> tv.tv_usec;
ut->set_timestamp(tv);
for (XMLNodeConstIterator child_it = t->children().begin();
- child_it != t->children().end();
- child_it++)
+ child_it != t->children().end(); child_it++)
{
XMLNode *n = *child_it;
Command *c;
if (n->name() == "MementoCommand" ||
- n->name() == "MementoUndoCommand" ||
- n->name() == "MementoRedoCommand") {
+ n->name() == "MementoUndoCommand" ||
+ n->name() == "MementoRedoCommand") {
if ((c = memento_command_factory(n))) {
ut->add_command(c);
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;
}
}
} else if (PARAM_IS ("history-depth")) {
set_history_depth (Config->get_history_depth());
} else if (PARAM_IS ("sync-all-route-ordering")) {
- sync_order_keys ();
+ sync_order_keys ("session");
+ } else if (PARAM_IS ("initial-program-change")) {
+
+ if (_mmc_port && Config->get_initial_program_change() >= 0) {
+ MIDI::byte buf[2];
+
+ buf[0] = MIDI::program; // channel zero by default
+ buf[1] = (Config->get_initial_program_change() & 0x7f);
+
+ _mmc_port->midimsg (buf, sizeof (buf), 0);
+ }
+ } else if (PARAM_IS ("initial-program-change")) {
+
+ if (_mmc_port && Config->get_initial_program_change() >= 0) {
+ MIDI::byte* buf = new MIDI::byte[2];
+
+ buf[0] = MIDI::program; // channel zero by default
+ buf[1] = (Config->get_initial_program_change() & 0x7f);
+ // deliver_midi (_mmc_port, buf, 2);
+ }
+ } else if (PARAM_IS ("solo-mute-override")) {
+ catch_up_on_solo_mute_override ();
}
set_dirty ();