bool Session::_disable_all_loaded_plugins = false;
bool Session::_bypass_all_loaded_plugins = false;
+guint Session::_name_id_counter = 0;
PBD::Signal1<int,uint32_t> Session::AudioEngineSetupRequired;
PBD::Signal1<void,std::string> Session::Dialog;
PBD::Signal0<int> Session::AskAboutPendingState;
PBD::Signal2<int, framecnt_t, framecnt_t> Session::AskAboutSampleRateMismatch;
+PBD::Signal2<void, framecnt_t, framecnt_t> Session::NotifyAboutSampleRateMismatch;
PBD::Signal0<void> Session::SendFeedback;
PBD::Signal3<int,Session*,std::string,DataType> Session::MissingFile;
, _bounce_processing_active (false)
, waiting_for_sync_offset (false)
, _base_frame_rate (0)
- , _current_frame_rate (0)
, _nominal_frame_rate (0)
+ , _current_frame_rate (0)
, transport_sub_state (0)
, _record_status (Disabled)
, _transport_frame (0)
, post_export_sync (false)
, post_export_position (0)
, _exporting (false)
- , _export_started (false)
, _export_rolling (false)
+ , _export_preroll (0)
, _pre_export_mmc_enabled (false)
, _name (snapshot_name)
, _is_new (true)
, pending_auto_loop (false)
, _mempool ("Session", 1048576)
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
+ , _n_lua_scripts (0)
, _butler (new Butler (*this))
, _post_transport_work (0)
, cumulative_rf_motion (0)
pthread_mutex_init (&_rt_emit_mutex, 0);
pthread_cond_init (&_rt_emit_cond, 0);
+ init_name_id_counter (1); // reset for new sessions, start at 1
+
pre_engine_init (fullpath);
setup_lua ();
destroy ();
}
+unsigned int
+Session::next_name_id ()
+{
+ return g_atomic_int_add (&_name_id_counter, 1);
+}
+
+unsigned int
+Session::name_id_counter ()
+{
+ return g_atomic_int_get (&_name_id_counter);
+}
+
+void
+Session::init_name_id_counter (guint n)
+{
+ g_atomic_int_set (&_name_id_counter, n);
+}
+
int
Session::ensure_engine (uint32_t desired_sample_rate)
{
/* if monitor section is not connected, connect it to physical outs
*/
- if (Config->get_auto_connect_standard_busses() && !_monitor_out->output()->connected ()) {
+ if ((Config->get_auto_connect_standard_busses () || Profile->get_mixbus ()) && !_monitor_out->output()->connected ()) {
if (!Config->get_monitor_bus_preferred_bundle().empty()) {
here.
*/
- _base_frame_rate = frames_per_second;
+ if (_base_frame_rate == 0) {
+ _base_frame_rate = frames_per_second;
+ }
+ else if (_base_frame_rate != frames_per_second && frames_per_second != _nominal_frame_rate) {
+ NotifyAboutSampleRateMismatch (_base_frame_rate, frames_per_second);
+ }
_nominal_frame_rate = frames_per_second;
sync_time_vars();
goto failed;
}
+ if (Profile->get_mixbus ()) {
+ track->set_strict_io (true);
+ }
+
track->use_new_diskstream();
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
return ret;
}
+RouteList
+Session::new_midi_route (RouteGroup* route_group, uint32_t how_many, string name_template, boost::shared_ptr<PluginInfo> instrument)
+{
+ string bus_name;
+ uint32_t bus_id = 0;
+ string port;
+ RouteList ret;
+
+ bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("Midi Bus");
+
+ while (how_many) {
+ if (!find_route_name (name_template.empty () ? _("Midi Bus") : name_template, ++bus_id, bus_name, use_number)) {
+ error << "cannot find name for new midi bus" << endmsg;
+ goto failure;
+ }
+
+ try {
+ boost::shared_ptr<Route> bus (new Route (*this, bus_name, Route::Flag(0), DataType::AUDIO)); // XXX Editor::add_routes is not ready for ARDOUR::DataType::MIDI
+
+ if (bus->init ()) {
+ goto failure;
+ }
+
+ if (Profile->get_mixbus ()) {
+ bus->set_strict_io (true);
+ }
+
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+ // boost_debug_shared_ptr_mark_interesting (bus.get(), "Route");
+#endif
+ {
+ Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
+
+ if (bus->input()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) {
+ error << _("cannot configure new midi bus input") << endmsg;
+ goto failure;
+ }
+
+
+ if (bus->output()->ensure_io (ChanCount(DataType::MIDI, 1), false, this)) {
+ error << _("cannot configure new midi bus output") << endmsg;
+ goto failure;
+ }
+ }
+
+ if (route_group) {
+ route_group->add (bus);
+ }
+ if (Config->get_remote_model() == UserOrdered) {
+ bus->set_remote_control_id (next_control_id());
+ }
+
+ ret.push_back (bus);
+ RouteAddedOrRemoved (true); /* EMIT SIGNAL */
+ ARDOUR::GUIIdle ();
+ }
+
+ catch (failed_constructor &err) {
+ error << _("Session: could not create new audio route.") << endmsg;
+ goto failure;
+ }
+
+ catch (AudioEngine::PortRegistrationFailure& pfe) {
+ error << pfe.what() << endmsg;
+ goto failure;
+ }
+
+
+ --how_many;
+ }
+
+ failure:
+ if (!ret.empty()) {
+ StateProtector sp (this);
+ add_routes (ret, false, false, false);
+
+ if (instrument) {
+ for (RouteList::iterator r = ret.begin(); r != ret.end(); ++r) {
+ PluginPtr plugin = instrument->load (*this);
+ boost::shared_ptr<Processor> p (new PluginInsert (*this, plugin));
+ (*r)->add_processor (p, PreFader);
+ }
+ }
+ }
+
+ return ret;
+
+}
+
+
void
Session::midi_output_change_handler (IOChange change, void * /*src*/, boost::weak_ptr<Route> wmt)
{
goto failed;
}
+ if (Profile->get_mixbus ()) {
+ track->set_strict_io (true);
+ }
+
+
if (ARDOUR::Profile->get_trx ()) {
// TRACKS considers it's not a USE CASE, it's
// a piece of behavior of the session model:
goto failure;
}
+ if (Profile->get_mixbus ()) {
+ bus->set_strict_io (true);
+ }
+
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
// boost_debug_shared_ptr_mark_interesting (bus.get(), "Route");
#endif
*/
RouteGroup* rg = route->route_group ();
- const bool group_already_accounted_for = route->use_group (group_override, &RouteGroup::is_solo);
+ const bool group_already_accounted_for = (group_override == Controllable::ForGroup);
if (delta == 1 && Config->get_exclusive_solo()) {
void
Session::unmark_return_id (uint32_t id)
{
+ if (_state_of_the_state & Deletion) { return; }
if (id < return_bitset.size()) {
return_bitset[id] = false;
}
}
unblock_processing ();
+ itt.done = true;
return result;
}
return ProcessThread::get_scratch_buffers (count, silence);
}
+BufferSet&
+Session::get_noinplace_buffers (ChanCount count)
+{
+ return ProcessThread::get_noinplace_buffers (count);
+}
+
BufferSet&
Session::get_route_buffers (ChanCount count, bool silence)
{