+ 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;
+}
+
+void
+Session::update_latency (bool playback)
+{
+ DEBUG_TRACE (DEBUG::Latency, string_compose ("JACK latency callback: %1\n", (playback ? "PLAYBACK" : "CAPTURE")));
+
+ if (_state_of_the_state & (InitialConnecting|Deletion)) {
+ return;
+ }
+
+ boost::shared_ptr<RouteList> r = routes.reader ();
+ framecnt_t max_latency = 0;
+
+ if (playback) {
+ /* reverse the list so that we work backwards from the last route to run to the first */
+ reverse (r->begin(), r->end());
+ }
+
+ /* compute actual latency values for the given direction and store them all in per-port
+ structures. this will also publish the same values (to JACK) so that computation of latency
+ for routes can consistently use public latency values.
+ */
+
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ max_latency = max (max_latency, (*i)->set_private_port_latencies (playback));
+ }
+
+ /* because we latency compensate playback, our published playback latencies should
+ be the same for all output ports - all material played back by ardour has
+ the same latency, whether its caused by plugins or by latency compensation. since
+ these may differ from the values computed above, reset all playback port latencies
+ to the same value.
+ */
+
+ DEBUG_TRACE (DEBUG::Latency, string_compose ("Set public port latencies to %1\n", max_latency));
+
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ (*i)->set_public_port_latencies (max_latency, playback);
+ }
+
+ if (playback) {
+
+ post_playback_latency ();
+