delete state_tree;
- /* remove all stubfiles that might still be lurking */
-
- cleanup_stubfiles ();
-
/* reset dynamic state version back to default */
Stateful::loading_state_version = 0;
}
routes.flush ();
- boost::shared_ptr<RouteList> r = routes.reader ();
-
DEBUG_TRACE (DEBUG::Destruction, "delete sources\n");
for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for source %1 ; pre-ref = %2\n", i->second->path(), i->second.use_count()));
void
Session::set_worst_io_latencies ()
{
+ if (_state_of_the_state & InitialConnecting) {
+ return;
+ }
+
_worst_output_latency = 0;
_worst_input_latency = 0;
_worst_output_latency = max (_worst_output_latency, (*i)->output()->latency());
_worst_input_latency = max (_worst_input_latency, (*i)->input()->latency());
}
+
+ DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst output latency: %1 Worst input latency: %2\n",
+ _worst_output_latency, _worst_input_latency));
}
void
BootMessage (_("Compute I/O Latencies"));
- set_worst_io_latencies ();
-
if (_clicking) {
// XXX HOW TO ALERT UI TO THIS ? DO WE NEED TO?
}
}
}
- /* catch up on send+insert cnts */
+ set_worst_io_latencies ();
_state_of_the_state = StateOfTheState (_state_of_the_state & ~(CannotSave|Dirty));
if ((playlist = track->playlist()) != 0) {
playlist->RegionAdded.connect_same_thread (*this, boost::bind (&Session::playlist_region_added, this, _1));
playlist->RangesMoved.connect_same_thread (*this, boost::bind (&Session::playlist_ranges_moved, this, _1));
+ playlist->RegionsExtended.connect_same_thread (*this, boost::bind (&Session::playlist_regions_extended, this, _1));
}
}
return true;
}
+void
+Session::set_track_monitor_input_status (bool yn)
+{
+ boost::shared_ptr<RouteList> rl = routes.reader ();
+ for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+ boost::shared_ptr<AudioTrack> tr = boost::dynamic_pointer_cast<AudioTrack> (*i);
+ if (tr && tr->record_enabled ()) {
+ //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
+ tr->monitor_input (yn);
+ }
+ }
+}
+
void
Session::reset_input_monitor_state ()
{
if (transport_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 ()) {
- //cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
- tr->monitor_input (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
- }
- }
-
+ set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
} else {
-
- 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 ()) {
- //cerr << "switching to input = " << !Config->get_auto_input() << __FILE__ << __LINE__ << endl << endl;
- tr->monitor_input (Config->get_monitoring_model() == HardwareMonitoring);
- }
- }
+ set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring);
}
}
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordStrobe));
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
-
- 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 (true);
- }
- }
+ set_track_monitor_input_status (true);
}
RecordStateChanged ();
}
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
-
- 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 (false);
- }
- }
+ set_track_monitor_input_status (false);
}
RecordStateChanged (); /* emit signal */
if (g_atomic_int_compare_and_exchange (&_record_status, Recording, Enabled)) {
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
- 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 ()) {
- //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
- tr->monitor_input (false);
- }
- }
+ set_track_monitor_input_status (false);
}
}
}
control_id = ntracks() + nbusses();
+ bool const use_number = (how_many != 1);
+
while (how_many) {
- bool const use_number = (how_many != 1);
if (!find_route_name (name_template.empty() ? _("Midi") : name_template, ++track_id, track_name, sizeof(track_name), use_number)) {
error << "cannot find name for new midi track" << endmsg;
goto failed;
control_id = ntracks() + nbusses() + 1;
+ bool const use_number = (how_many != 1);
+
while (how_many) {
- bool const use_number = (how_many != 1);
if (!find_route_name (name_template.empty() ? _("Audio") : name_template, ++track_id, track_name, sizeof(track_name), use_number)) {
error << "cannot find name for new audio track" << endmsg;
goto failed;
control_id = ntracks() + nbusses() + 1;
+ bool const use_number = (how_many != 1);
while (how_many) {
- bool const use_number = (how_many != 1);
if (!find_route_name (name_template.empty () ? _("Bus") : name_template, ++bus_id, bus_name, sizeof(bus_name), use_number)) {
error << "cannot find name for new audio bus" << endmsg;
goto failure;
}
}
+void
+Session::playlist_regions_extended (list<Evoral::Range<framepos_t> > const & ranges)
+{
+ for (list<Evoral::Range<framepos_t> >::const_iterator i = ranges.begin(); i != ranges.end(); ++i) {
+ maybe_update_session_range (i->from, i->to);
+ }
+}
+
/* Region management */
boost::shared_ptr<Region>
Analyser::queue_source_for_analysis (source, false);
}
}
+
+ source->DropReferences.connect_same_thread (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
}
}
void
Session::remove_source (boost::weak_ptr<Source> src)
{
+ if (_state_of_the_state & Deletion) {
+ return;
+ }
+
SourceMap::iterator i;
boost::shared_ptr<Source> source = src.lock();
Glib::Mutex::Lock lm (source_lock);
if ((i = sources.find (source->id())) != sources.end()) {
- cerr << "Removing source " << source->name() << endl;
sources.erase (i);
}
}
* (e.g. as returned by new_*_source_name)
*/
string
-Session::new_source_path_from_name (DataType type, const string& name, bool as_stub)
+Session::new_source_path_from_name (DataType type, const string& name)
{
assert(name.find("/") == string::npos);
sys::path p;
if (type == DataType::AUDIO) {
- p = (as_stub ? sdir.sound_stub_path() : sdir.sound_path());
+ p = sdir.sound_path();
} else if (type == DataType::MIDI) {
- p = (as_stub ? sdir.midi_stub_path() : sdir.midi_path());
+ p = sdir.midi_path();
} else {
error << "Unknown source type, unable to create file path" << endmsg;
return "";
SessionDirectory sdir((*i).path);
string spath = sdir.sound_path().to_string();
- string spath_stubs = sdir.sound_stub_path().to_string();
/* note that we search *without* the extension so that
we don't end up both "Audio 1-1.wav" and "Audio 1-1.caf"
a file format change.
*/
- if (matching_unsuffixed_filename_exists_in (spath, buf) ||
- matching_unsuffixed_filename_exists_in (spath_stubs, buf)) {
+ if (matching_unsuffixed_filename_exists_in (spath, buf)) {
existing++;
break;
}
/** Create a new within-session audio source */
boost::shared_ptr<AudioFileSource>
-Session::create_audio_source_for_session (size_t n_chans, string const & n, uint32_t chan, bool destructive, bool as_stub)
+Session::create_audio_source_for_session (size_t n_chans, string const & n, uint32_t chan, bool destructive)
{
const string name = new_audio_source_name (n, n_chans, chan, destructive);
- const string path = new_source_path_from_name(DataType::AUDIO, name, as_stub);
+ 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()));
/** Create a new within-session MIDI source */
boost::shared_ptr<MidiSource>
-Session::create_midi_source_for_session (Track* track, string const & n, bool as_stub)
+Session::create_midi_source_for_session (Track* track, string const & n)
{
/* try to use the existing write source for the track, to keep numbering sane
*/
}
const string name = new_midi_source_name (n);
- const string path = new_source_path_from_name (DataType::MIDI, name, as_stub);
+ const string path = new_source_path_from_name (DataType::MIDI, name);
return boost::dynamic_pointer_cast<SMFSource> (
SourceFactory::createWritable (
Session::get_silent_buffers (ChanCount count)
{
return ProcessThread::get_silent_buffers (count);
-#if 0
- assert(_silent_buffers->available() >= count);
- _silent_buffers->set_count(count);
-
- for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
- for (size_t i= 0; i < count.get(*t); ++i) {
- _silent_buffers->get(*t, i).clear();
- }
- }
-
- return *_silent_buffers;
-#endif
}
BufferSet&
Session::get_scratch_buffers (ChanCount count)
{
return ProcessThread::get_scratch_buffers (count);
-#if 0
- if (count != ChanCount::ZERO) {
- assert(_scratch_buffers->available() >= count);
- _scratch_buffers->set_count(count);
- } else {
- _scratch_buffers->set_count (_scratch_buffers->available());
- }
-
- return *_scratch_buffers;
-#endif
}
BufferSet&
Session::get_mix_buffers (ChanCount count)
{
return ProcessThread::get_mix_buffers (count);
-#if 0
- assert(_mix_buffers->available() >= count);
- _mix_buffers->set_count(count);
- return *_mix_buffers;
-#endif
}
uint32_t