#include "pbd/localtime_r.h"
#include "ardour/amp.h"
+#include "ardour/async_midi_port.h"
#include "ardour/audio_diskstream.h"
#include "ardour/audio_track.h"
#include "ardour/audioengine.h"
#include "ardour/midi_model.h"
#include "ardour/midi_patch_manager.h"
#include "ardour/midi_region.h"
+#include "ardour/midi_scene_changer.h"
#include "ardour/midi_source.h"
#include "ardour/midi_track.h"
#include "ardour/pannable.h"
/* discover canonical fullpath */
_path = canonical_path(fullpath);
-
+
/* we require _path to end with a dir separator */
if (_path[_path.length()-1] != G_DIR_SEPARATOR) {
BootMessage (_("Using configuration"));
_midi_ports = new MidiPortManager;
+
+ MIDISceneChanger* msc;
+
+ _scene_changer = msc = new MIDISceneChanger (*this);
+ msc->set_input_port (scene_input_port());
+ msc->set_output_port (scene_out());
+
+ boost::function<framecnt_t(void)> timer_func (boost::bind (&Session::audible_frame, this));
+ boost::dynamic_pointer_cast<AsyncMIDIPort>(scene_in())->set_timer (timer_func);
+
setup_midi_machine_control ();
if (_butler->start_thread()) {
set_dirty();
- _writable = exists_and_writable (xmlpath);
+ _writable = exists_and_writable (xmlpath) && exists_and_writable(Glib::path_get_dirname(xmlpath));
if (!state_tree->read (xmlpath)) {
error << string_compose(_("Could not understand session file %1"), xmlpath) << endmsg;
p += (*i).path;
if (next != session_dirs.end()) {
- p += ':';
+ p += G_SEARCHPATH_SEPARATOR;
} else {
break;
}
audio_path += sdir.sound_path();
if (nexti != session_dirs.end()) {
- audio_path += ':';
+ audio_path += G_SEARCHPATH_SEPARATOR;
}
i = nexti;
midi_path += sdir.midi_path();
if (nexti != session_dirs.end()) {
- midi_path += ':';
+ midi_path += G_SEARCHPATH_SEPARATOR;
}
i = nexti;
++tmp;
if ((fs = boost::dynamic_pointer_cast<FileSource> (i->second)) != 0) {
- 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.
- */
+ if (!fs->is_stub()) {
- 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);
+ }
+ }
}
i = tmp;
string const old_sources_root = _session_dir->sources_root();
-#define RENAME ::rename
-
/* Rename:
* session directory
cerr << "Rename " << oldstr << " => " << newstr << endl;
- if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+ if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+ error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
return 1;
}
cerr << "Rename " << oldstr << " => " << newstr << endl;
- if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+ if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+ error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
return 1;
}
}
cerr << "Rename " << oldstr << " => " << newstr << endl;
- if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+ if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+ error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
return 1;
}
cerr << "Rename " << oldstr << " => " << newstr << endl;
- if (RENAME (oldstr.c_str(), newstr.c_str()) != 0) {
+ if (::g_rename (oldstr.c_str(), newstr.c_str()) != 0) {
+ error << string_compose (_("renaming %s as %2 failed (%3)"), oldstr, newstr, g_strerror (errno)) << endmsg;
return 1;
}
}
_current_snapshot_name = new_name;
_name = new_name;
+ /* re-add directory separator - reverse hack to oldstr above */
+ if (_path[_path.length()-1] != G_DIR_SEPARATOR) {
+ _path += G_DIR_SEPARATOR;
+ }
+
set_dirty ();
/* save state again to get everything just right */
store_recent_sessions (new_name, _path);
return 0;
-
-#undef RENAME
}
int