+ if (l->end() == old) {
+ l->set_end (s->end(), true);
+ }
+}
+
+string
+Session::source_search_path (DataType type) const
+{
+ string search_path;
+
+ if (session_dirs.size() == 1) {
+ switch (type) {
+ case DataType::AUDIO:
+ search_path = _session_dir->sound_path().to_string();
+ break;
+ case DataType::MIDI:
+ search_path = _session_dir->midi_path().to_string();
+ break;
+ }
+ } else {
+ for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
+ SessionDirectory sdir (i->path);
+ if (!search_path.empty()) {
+ search_path += ':';
+ }
+ switch (type) {
+ case DataType::AUDIO:
+ search_path += sdir.sound_path().to_string();
+ break;
+ case DataType::MIDI:
+ search_path += sdir.midi_path().to_string();
+ break;
+ }
+ }
+ }
+
+ /* now add user-specified locations
+ */
+
+ vector<string> dirs;
+
+ switch (type) {
+ case DataType::AUDIO:
+ split (config.get_audio_search_path (), dirs, ':');
+ break;
+ case DataType::MIDI:
+ split (config.get_midi_search_path (), dirs, ':');
+ break;
+ }
+
+ for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
+ search_path += ':';
+ search_path += *i;
+
+ }
+
+ return search_path;
+}
+
+void
+Session::ensure_search_path_includes (const string& path, DataType type)
+{
+ string search_path;
+ vector<string> dirs;
+
+ if (path == ".") {
+ return;
+ }
+
+ switch (type) {
+ case DataType::AUDIO:
+ search_path = config.get_audio_search_path ();
+ break;
+ case DataType::MIDI:
+ search_path = config.get_midi_search_path ();
+ break;
+ }
+
+ split (search_path, dirs, ':');
+
+ for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
+ if (*i == path) {
+ return;
+ }
+ }
+
+ if (!search_path.empty()) {
+ search_path += ':';
+ }
+
+ search_path += path;
+
+ switch (type) {
+ case DataType::AUDIO:
+ config.set_audio_search_path (search_path);
+ break;
+ case DataType::MIDI:
+ config.set_midi_search_path (search_path);
+ break;
+ }
+}
+
+boost::shared_ptr<Speakers>
+Session::get_speakers()
+{
+ return _speakers;
+}
+
+list<string>
+Session::unknown_processors () const
+{
+ list<string> p;
+
+ boost::shared_ptr<RouteList> r = routes.reader ();
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ list<string> t = (*i)->unknown_processors ();
+ copy (t.begin(), t.end(), back_inserter (p));
+ }
+
+ p.sort ();
+ p.unique ();
+
+ return p;
+}
+
+#ifdef HAVE_JACK_NEW_LATENCY
+void
+Session::update_latency (bool playback)
+{
+ DEBUG_TRACE (DEBUG::Latency, "JACK latency callback\n");
+
+ boost::shared_ptr<RouteList> r = routes.reader ();
+
+ if (playback) {
+ /* reverse the list so that we work backwards from the last route to run to the first */
+ reverse (r->begin(), r->end());