using namespace ARDOUR;
using namespace PBD;
+
void
Session::first_stage_init (string fullpath, string snapshot_name)
{
_path += G_DIR_SEPARATOR;
}
- if (Glib::file_test (_path, Glib::FILE_TEST_EXISTS) && ::access (_path.c_str(), W_OK)) {
- _writable = false;
- } else {
- _writable = true;
- }
-
/* these two are just provisional settings. set_state()
will likely override them.
*/
return -1;
}
- dir = session_directory().sound_stub_path().to_string();
-
- if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
- error << string_compose(_("Session: cannot create session stub 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) {
return -1;
}
- dir = session_directory().midi_stub_path().to_string();
-
- if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
- error << string_compose(_("Session: cannot create session stub midi dir \"%1\" (%2)"), dir, strerror (errno)) << endmsg;
- return -1;
- }
-
dir = session_directory().dead_path().to_string();
if (g_mkdir_with_parents (dir.c_str(), 0755) < 0) {
return -1;
}
+ _writable = exists_and_writable (sys::path (_path));
+
if (!mix_template.empty()) {
std::string in_path = mix_template;
}
if (!rl.empty()) {
- add_routes (rl, false);
+ add_routes (rl, false, false);
}
/* this allows the user to override settings with an environment variable.
set_dirty();
- /* writable() really reflects the whole folder, but if for any
- reason the session state file can't be written to, still
- make us unwritable.
- */
-
- if (::access (xmlpath.to_string().c_str(), W_OK) != 0) {
- _writable = false;
- }
+ _writable = exists_and_writable (xmlpath);
if (!state_tree->read (xmlpath.to_string())) {
error << string_compose(_("Could not understand ardour file %1"), xmlpath.to_string()) << endmsg;
setup_raid_path(_session_dir->root_path().to_string());
- cleanup_stubfiles ();
-
if ((prop = node.property (X_("id-counter"))) != 0) {
uint64_t x;
sscanf (prop->value().c_str(), "%" PRIu64, &x);
new_routes.push_back (route);
}
- add_routes (new_routes, false);
+ add_routes (new_routes, false, false);
return 0;
}
route_group_removed (); /* EMIT SIGNAL */
}
+}
+
+/** Set a new order for our route groups, without adding or removing any.
+ * @param groups Route group list in the new order.
+ */
+void
+Session::reorder_route_groups (list<RouteGroup*> groups)
+{
+ _route_groups = groups;
+ route_groups_reordered (); /* EMIT SIGNAL */
+ set_dirty ();
}
+
RouteGroup *
Session::route_group_by_name (string name)
{
}
static bool
-accept_all_non_stub_audio_files (const string& path, void */*arg*/)
+accept_all_audio_files (const string& path, void */*arg*/)
{
if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) {
return false;
}
- if (FileSource::is_stub_path (path)) {
- return false;
- }
-
if (!AudioFileSource::safe_audio_file_extension (path)) {
return false;
}
}
static bool
-accept_all_non_stub_midi_files (const string& path, void */*arg*/)
+accept_all_midi_files (const string& path, void */*arg*/)
{
if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) {
return false;
}
- if (FileSource::is_stub_path (path)) {
- return false;
- }
-
return ((path.length() > 4 && path.find (".mid") != (path.length() - 4)) ||
(path.length() > 4 && path.find (".smf") != (path.length() - 4)) ||
(path.length() > 5 && path.find (".midi") != (path.length() - 5)));
i = nexti;
}
- candidates = scanner (audio_path, accept_all_non_stub_audio_files, (void *) 0, true, true);
- candidates2 = scanner (midi_path, accept_all_non_stub_midi_files, (void *) 0, true, true);
+ candidates = scanner (audio_path, accept_all_audio_files, (void *) 0, true, true);
+ candidates2 = scanner (midi_path, accept_all_midi_files, (void *) 0, true, true);
/* merge them */
++tmp;
if ((fs = boost::dynamic_pointer_cast<FileSource> (i->second)) != 0) {
- if (!fs->is_stub()) {
- if (playlists->source_use_count (fs) != 0) {
- all_sources.insert (fs->path());
- } else {
-
- /* we might not remove this source from disk, because it may be used
- by other snapshots, but its not being used in this version
- so lets get rid of it now, along with any representative regions
- in the region list.
- */
-
- cerr << "Source " << i->second->name() << "ID " << i->second->id() << " not used, remove from source list and also all regions\n";
-
- RegionFactory::remove_regions_using_source (i->second);
- sources.erase (i);
- }
+ if (playlists->source_use_count (fs) != 0) {
+ all_sources.insert (fs->path());
+ } else {
+
+ /* we might not remove this source from disk, because it may be used
+ by other snapshots, but its not being used in this version
+ so lets get rid of it now, along with any representative regions
+ in the region list.
+ */
+
+ RegionFactory::remove_regions_using_source (i->second);
+ sources.erase (i);
}
}
for (i = session_dirs.begin(); i != session_dirs.end(); ++i) {
- dead_dir = (*i).path;
- dead_dir += dead_dir_name;
+ dead_dir = Glib::build_filename ((*i).path, dead_dir_name);
clear_directory (dead_dir, &rep.space, &rep.paths);
}
return 0;
}
-void
-Session::cleanup_stubfiles ()
-{
- vector<space_and_path>::iterator i;
-
- for (i = session_dirs.begin(); i != session_dirs.end(); ++i) {
-
- string dir;
- string lname = legalize_for_path (_name);
-
- vector<string> v;
-
- /* XXX this is a hack caused by semantic conflicts
- between space_and_path and the SessionDirectory concept.
- */
-
- v.push_back ((*i).path);
- v.push_back ("interchange");
- v.push_back (lname);
- v.push_back ("audiofiles");
- v.push_back (stub_dir_name);
-
- dir = Glib::build_filename (v);
-
- clear_directory (dir);
-
- v.clear ();
- v.push_back ((*i).path);
- v.push_back ("interchange");
- v.push_back (lname);
- v.push_back ("midifiles");
- v.push_back (stub_dir_name);
-
- dir = Glib::build_filename (v);
-
- clear_directory (dir);
- }
-}
-
void
Session::set_dirty ()
{
if (Config->get_monitoring_model() == HardwareMonitoring && transport_rolling()) {
/* auto-input only makes a difference if we're rolling */
-
- boost::shared_ptr<RouteList> rl = routes.reader ();
- for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
- boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
- if (tr && tr->record_enabled ()) {
- tr->monitor_input (!config.get_auto_input());
- }
- }
+ set_track_monitor_input_status (!config.get_auto_input());
}
} else if (p == "punch-in") {