#include "pbd/stacktrace.h"
#include "pbd/file_utils.h"
#include "pbd/convert.h"
-#include "pbd/strsplit.h"
#include "pbd/unwind.h"
+#include "pbd/search_path.h"
#include "ardour/amp.h"
#include "ardour/analyser.h"
PBD::Signal0<void> Session::Quit;
PBD::Signal0<void> Session::FeedbackDetected;
PBD::Signal0<void> Session::SuccessfulGraphSort;
+PBD::Signal2<void,std::string,std::string> Session::VersionMismatch;
static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
: _engine (eng)
, _target_transport_speed (0.0)
, _requested_return_frame (-1)
+ , _under_nsm_control (false)
, _session_dir (new SessionDirectory(fullpath))
, state_tree (0)
, _state_of_the_state (Clean)
, _butler (new Butler (*this))
, _post_transport_work (0)
, _send_timecode_update (false)
+ , ltc_enc_buf(0)
, _all_route_group (new RouteGroup (*this, "all"))
, routes (new RouteList)
, _total_free_4k_blocks (0)
}
if (location->end() <= location->start()) {
- error << _("Session: you can't use a mark for auto loop") << endmsg;
+ error << _("You cannot use this location for auto-loop because it has zero or negative length") << endmsg;
return;
}
}
++id;
-
+
} while (id < (UINT_MAX-1));
return false;
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
- if (tr && !tr->is_hidden()) {
+ if (tr && !tr->is_auditioner()) {
in += tr->n_inputs();
out += tr->n_outputs();
}
RouteList new_routes;
list<boost::shared_ptr<MidiTrack> > ret;
- cerr << "Adding MIDI track with in = " << input << " out = " << output << endl;
-
bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("MIDI");
while (how_many) {
catch (AudioEngine::PortRegistrationFailure& pfe) {
- error << string_compose (_("No more JACK ports are available. You will need to stop %1 and restart JACK with ports if you need this many tracks."), PROGRAM_NAME) << endmsg;
+ error << string_compose (_("No more JACK ports are available. You will need to stop %1 and restart JACK with more ports if you need this many tracks."), PROGRAM_NAME) << endmsg;
goto failed;
}
}
RouteList
-Session::new_route_from_template (uint32_t how_many, const std::string& template_path)
+Session::new_route_from_template (uint32_t how_many, const std::string& template_path, const std::string& name_base)
{
RouteList ret;
uint32_t control_id;
XMLTree tree;
uint32_t number = 0;
+ const uint32_t being_added = how_many;
if (!tree.read (template_path.c_str())) {
return ret;
node_copy.remove_property_recursively (X_("id"));
try {
- string const route_name = node_copy.property(X_("name"))->value ();
-
- /* generate a new name by adding a number to the end of the template name */
char name[32];
- if (!find_route_name (route_name.c_str(), ++number, name, sizeof(name), true)) {
- fatal << _("Session: UINT_MAX routes? impossible!") << endmsg;
- /*NOTREACHED*/
+
+ if (!name_base.empty()) {
+
+ /* if we're adding more than one routes, force
+ * all the names of the new routes to be
+ * numbered, via the final parameter.
+ */
+
+ if (!find_route_name (name_base.c_str(), ++number, name, sizeof(name), (being_added > 1))) {
+ fatal << _("Session: UINT_MAX routes? impossible!") << endmsg;
+ /*NOTREACHDE*/
+ }
+
+ } else {
+
+ string const route_name = node_copy.property(X_("name"))->value ();
+
+ /* generate a new name by adding a number to the end of the template name */
+ if (!find_route_name (route_name.c_str(), ++number, name, sizeof(name), true)) {
+ fatal << _("Session: UINT_MAX routes? impossible!") << endmsg;
+ /*NOTREACHED*/
+ }
}
/* set this name in the XML description that we are about to use */
*/
if (!r->has_order_key (EditorSort)) {
- if (r->is_hidden()) {
+ if (r->is_auditioner()) {
/* use an arbitrarily high value */
r->set_order_key (EditorSort, UINT_MAX);
r->set_order_key (MixerSort, UINT_MAX);
/* new listen: disable all other listen */
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_hidden()) {
+ if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_auditioner()) {
continue;
}
(*i)->set_listen (false, this);
/* new solo: disable all other solos, but not the group if its solo-enabled */
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_hidden() ||
+ if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_auditioner() ||
(leave_group_alone && ((*i)->route_group() == rg))) {
continue;
}
bool via_sends_only;
bool in_signal_flow;
- if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_hidden() ||
+ if ((*i) == route || (*i)->solo_isolated() || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_auditioner() ||
(leave_group_alone && ((*i)->route_group() == rg))) {
continue;
}
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden() && (*i)->self_soloed()) {
+ if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_auditioner() && (*i)->self_soloed()) {
something_soloed = true;
}
- if (!(*i)->is_hidden() && (*i)->listening_via_monitor()) {
+ if (!(*i)->is_auditioner() && (*i)->listening_via_monitor()) {
if (Config->get_solo_control_is_listen_control()) {
listeners++;
} else {
const string path = new_source_path_from_name(DataType::AUDIO, name);
return boost::dynamic_pointer_cast<AudioFileSource> (
- SourceFactory::createWritable (DataType::AUDIO, *this, path, string(), destructive, frame_rate()));
+ SourceFactory::createWritable (DataType::AUDIO, *this, path, destructive, frame_rate()));
}
/** Return a unique name based on \a base for a new internal MIDI source */
return boost::dynamic_pointer_cast<SMFSource> (
SourceFactory::createWritable (
- DataType::MIDI, *this, path, string(), false, frame_rate()));
+ DataType::MIDI, *this, path, false, frame_rate()));
}
try {
fsource = boost::dynamic_pointer_cast<AudioFileSource> (
- SourceFactory::createWritable (DataType::AUDIO, *this, buf, string(), false, frame_rate()));
+ SourceFactory::createWritable (DataType::AUDIO, *this, buf, false, frame_rate()));
}
catch (failed_constructor& err) {
}
BufferSet&
-Session::get_scratch_buffers (ChanCount count)
+Session::get_scratch_buffers (ChanCount count, bool silence)
{
- return ProcessThread::get_scratch_buffers (count);
+ return ProcessThread::get_scratch_buffers (count, silence);
}
+BufferSet&
+Session::get_route_buffers (ChanCount count, bool silence)
+{
+ return ProcessThread::get_route_buffers (count, silence);
+}
+
+
BufferSet&
Session::get_mix_buffers (ChanCount count)
{
bool
Session::have_rec_enabled_track () const
{
- return g_atomic_int_get (&_have_rec_enabled_track) == 1;
+ return g_atomic_int_get (const_cast<gint*>(&_have_rec_enabled_track)) == 1;
}
/** Update the state of our rec-enabled tracks flag */
}
}
-string
+std::vector<std::string>
Session::source_search_path (DataType type) const
{
- vector<string> s;
+ Searchpath sp;
if (session_dirs.size() == 1) {
switch (type) {
case DataType::AUDIO:
- s.push_back (_session_dir->sound_path());
+ sp.push_back (_session_dir->sound_path());
break;
case DataType::MIDI:
- s.push_back (_session_dir->midi_path());
+ sp.push_back (_session_dir->midi_path());
break;
}
} else {
SessionDirectory sdir (i->path);
switch (type) {
case DataType::AUDIO:
- s.push_back (sdir.sound_path());
+ sp.push_back (sdir.sound_path());
break;
case DataType::MIDI:
- s.push_back (sdir.midi_path());
+ sp.push_back (sdir.midi_path());
break;
}
}
if (type == DataType::AUDIO) {
const string sound_path_2X = _session_dir->sound_path_2X();
if (Glib::file_test (sound_path_2X, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) {
- if (find (s.begin(), s.end(), sound_path_2X) == s.end()) {
- s.push_back (sound_path_2X);
+ if (find (sp.begin(), sp.end(), sound_path_2X) == sp.end()) {
+ sp.push_back (sound_path_2X);
}
}
}
- /* now check the explicit (possibly user-specified) search path
- */
-
- vector<string> dirs;
+ // now check the explicit (possibly user-specified) search path
switch (type) {
case DataType::AUDIO:
- split (config.get_audio_search_path (), dirs, ':');
+ sp += Searchpath(config.get_audio_search_path ());
break;
case DataType::MIDI:
- split (config.get_midi_search_path (), dirs, ':');
+ sp += Searchpath(config.get_midi_search_path ());
break;
}
- for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
- if (find (s.begin(), s.end(), *i) == s.end()) {
- s.push_back (*i);
- }
- }
-
- string search_path;
-
- for (vector<string>::iterator si = s.begin(); si != s.end(); ++si) {
- if (!search_path.empty()) {
- search_path += ':';
- }
- search_path += *si;
- }
-
- return search_path;
+ return sp;
}
void
Session::ensure_search_path_includes (const string& path, DataType type)
{
- string search_path;
- vector<string> dirs;
+ Searchpath sp;
if (path == ".") {
return;
switch (type) {
case DataType::AUDIO:
- search_path = config.get_audio_search_path ();
+ sp += Searchpath(config.get_audio_search_path ());
break;
case DataType::MIDI:
- search_path = config.get_midi_search_path ();
+ sp += Searchpath (config.get_midi_search_path ());
break;
}
- split (search_path, dirs, ':');
-
- for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
+ for (vector<std::string>::iterator i = sp.begin(); i != sp.end(); ++i) {
/* No need to add this new directory if it has the same inode as
an existing one; checking inode rather than name prevents duplicated
directories when we are using symlinks.
}
}
- if (!search_path.empty()) {
- search_path += ':';
- }
-
- search_path += path;
+ sp += path;
switch (type) {
case DataType::AUDIO:
- config.set_audio_search_path (search_path);
+ config.set_audio_search_path (sp.to_string());
break;
case DataType::MIDI:
- config.set_midi_search_path (search_path);
+ config.set_midi_search_path (sp.to_string());
break;
}
}
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if (!(*i)->is_hidden() && ((*i)->active())) {
+ if (!(*i)->is_auditioner() && ((*i)->active())) {
_worst_track_latency = max (_worst_track_latency, (*i)->update_signal_latency ());
}
}
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if (!(*i)->is_hidden() && ((*i)->active())) {
+ if (!(*i)->is_auditioner() && ((*i)->active())) {
framecnt_t tl;
if ((*i)->signal_latency () != (tl = (*i)->update_signal_latency ())) {
some_track_latency_changed = true;