#include <ardour/region_factory.h>
#include <ardour/source_factory.h>
+#include <control_protocol/control_protocol.h>
+
#include "i18n.h"
#include <locale.h>
mmc = 0;
session_send_mmc = false;
session_send_mtc = false;
- session_midi_feedback = false;
post_transport_work = PostTransportWork (0);
g_atomic_int_set (&butler_should_do_transport_work, 0);
g_atomic_int_set (&butler_active, 0);
pending_abort = false;
destructive_index = 0;
current_trans = 0;
-
+ first_file_data_format_reset = true;
+ first_file_header_format_reset = true;
+
AudioDiskstream::allocate_working_buffers();
/* default short fade = 15ms */
Curve::CurveCreated.connect (mem_fun (*this, &Session::add_curve));
AutomationList::AutomationListCreated.connect (mem_fun (*this, &Session::add_automation_list));
- Controllable::Created.connect (mem_fun (*this, &Session::add_controllable));
- Controllable::GoingAway.connect (mem_fun (*this, &Session::remove_controllable));
+ Controllable::Destroyed.connect (mem_fun (*this, &Session::remove_controllable));
IO::MoreOutputs.connect (mem_fun (*this, &Session::ensure_passthru_buffers));
child = option_root.add_child ("end-marker-is-free");
child->add_property ("val", _end_location_is_free ? "yes" : "no");
- child = option_root.add_child ("full-xfades-unmuted");
-
return option_root;
}
node->add_child_nocopy (_tempo_map->get_state());
+ node->add_child_nocopy (get_control_protocol_state());
+
if (_extra_xml) {
node->add_child_copy (*_extra_xml);
}
return *node;
}
+XMLNode&
+Session::get_control_protocol_state ()
+{
+ ControlProtocolManager& cpm (ControlProtocolManager::instance());
+ XMLNode* node = new XMLNode (X_("ControlProtocols"));
+
+ cpm.foreach_known_protocol (bind (mem_fun (*this, &Session::add_control_protocol), node));
+
+ return *node;
+}
+
+void
+Session::add_control_protocol (const ControlProtocolInfo* const cpi, XMLNode* node)
+{
+ if (cpi->protocol) {
+ node->add_child_nocopy (cpi->protocol->get_state());
+ }
+}
+
int
Session::set_state (const XMLNode& node)
{
return -1;
}
- StateManager::prohibit_save ();
-
if ((prop = node.property ("name")) != 0) {
_name = prop->value ();
}
EditGroups
MixGroups
Click
+ ControlProtocols
*/
if (use_config_midi_ports ()) {
start_location = location;
}
- _locations.save_state (_("initial state"));
-
if ((child = find_named_node (node, "EditGroups")) == 0) {
error << _("Session: XML state has no edit groups section") << endmsg;
goto out;
_click_io->set_state (*child);
}
+ if ((child = find_named_node (node, "ControlProtocols")) != 0) {
+ ControlProtocolManager::instance().set_protocol_states (*child);
+ }
+
/* here beginneth the second phase ... */
StateReady (); /* EMIT SIGNAL */
_state_of_the_state = Clean;
- StateManager::allow_save (_("initial state"), true);
-
if (state_was_pending) {
save_state (_current_snapshot_name);
remove_pending_capture_state ();
return 0;
out:
- /* we failed, re-enable state saving but don't actually save internal state */
- StateManager::allow_save (X_("ignored"), false);
return ret;
}
nchans = atoi (prop->value().c_str());
}
+
+ if ((prop = node.property ("name")) == 0) {
+ cerr << "no name for this region\n";
+ abort ();
+ }
if ((prop = node.property (X_("source-0"))) == 0) {
if ((prop = node.property ("source")) == 0) {
delete *x;
}
- /* step 2: clear the undo/redo history for all playlists */
-
- for (PlaylistList::iterator x = playlists.begin(); x != playlists.end(); ++x) {
- (*x)->drop_all_states ();
- }
-
- /* step 3: find all un-referenced sources */
+ /* step 2: find all un-referenced sources */
rep.paths.clear ();
rep.space = 0;
i = tmp;
}
- /* Step 4: get rid of all regions in the region list that use any dead sources
+ /* Step 3: get rid of all regions in the region list that use any dead sources
in case the sources themselves don't go away (they might be referenced in
other snapshots).
*/
Session::add_controllable (Controllable* c)
{
Glib::Mutex::Lock lm (controllables_lock);
- controllables.push_back (c);
+ controllables.insert (c);
}
void
}
Glib::Mutex::Lock lm (controllables_lock);
- controllables.remove (c);
+
+ Controllables::iterator x = controllables.find (c);
+
+ if (x != controllables.end()) {
+ controllables.erase (x);
+ }
}
Controllable*
/* replace history */
history.clear();
- for (XMLNodeConstIterator it = tree.root()->children().begin();
- it != tree.root()->children().end();
- it++)
- {
- XMLNode *t = *it;
- UndoTransaction* ut = new UndoTransaction ();
- struct timeval tv;
-
- ut->set_name(t->property("name")->value());
- stringstream ss(t->property("tv_sec")->value());
- ss >> tv.tv_sec;
- 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++)
- {
- XMLNode *n = *child_it;
- Command *c;
- if (n->name() == "MementoCommand" ||
- n->name() == "MementoUndoCommand" ||
- n->name() == "MementoRedoCommand")
- {
- c = memento_command_factory(n);
- if (c)
- ut->add_command(c);
- }
- else
- {
- error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg;
- }
- }
- history.add(ut);
+
+ for (XMLNodeConstIterator it = tree.root()->children().begin(); it != tree.root()->children().end(); it++) {
+
+ XMLNode *t = *it;
+ UndoTransaction* ut = new UndoTransaction ();
+ struct timeval tv;
+
+ ut->set_name(t->property("name")->value());
+ stringstream ss(t->property("tv_sec")->value());
+ ss >> tv.tv_sec;
+ 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++)
+ {
+ XMLNode *n = *child_it;
+ Command *c;
+
+ if (n->name() == "MementoCommand" ||
+ n->name() == "MementoUndoCommand" ||
+ n->name() == "MementoRedoCommand") {
+ if ((c = memento_command_factory(n))) {
+ ut->add_command(c);
+ }
+ } else {
+ error << string_compose(_("Couldn't figure out how to make a Command out of a %1 XMLNode."), n->name()) << endmsg;
+ }
+ }
+
+ history.add (ut);
}
return 0;
} else if (PARAM_IS ("auto-input")) {
- if (Config->get_use_hardware_monitoring() && transport_rolling()) {
+ if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) {
/* auto-input only makes a difference if we're rolling */
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader();
session_midi_feedback = Config->get_midi_feedback();
}
+ } else if (PARAM_IS ("jack-time-master")) {
+
+ engine().reset_timebase ();
+
+ } else if (PARAM_IS ("native-file-header-format")) {
+
+ if (!first_file_header_format_reset) {
+ reset_native_file_format ();
+ }
+
+ first_file_header_format_reset = false;
+
+ } else if (PARAM_IS ("native-file-data-format")) {
+
+ if (!first_file_data_format_reset) {
+ reset_native_file_format ();
+ }
+
+ first_file_data_format_reset = false;
}
set_dirty ();