diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/audio_diskstream.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_diskstream.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/rc_configuration_vars.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/track.h | 9 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 24 | ||||
-rw-r--r-- | libs/ardour/diskstream.cc | 13 | ||||
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 20 | ||||
-rw-r--r-- | libs/ardour/route.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_rtevents.cc | 19 | ||||
-rw-r--r-- | libs/ardour/track.cc | 116 |
11 files changed, 110 insertions, 112 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index be43142f21..455e89392b 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -242,9 +242,9 @@ class AudioDiskstream : public Diskstream void adjust_playback_buffering (); void adjust_capture_buffering (); - void engage_record_enable (); - void disengage_record_enable (); - + bool prep_record_enable (); + bool prep_record_disable (); + // Working buffers for do_refill (butler thread) static void allocate_working_buffers(); static void free_working_buffers(); diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 5d3693052d..81eb588d1a 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -243,6 +243,12 @@ class Diskstream : public SessionObject, public PublicDiskstream virtual void use_destructive_playlist () {} virtual void prepare_to_stop (framepos_t pos); + void engage_record_enable (); + void disengage_record_enable (); + + virtual bool prep_record_enable () = 0; + virtual bool prep_record_disable () = 0; + void calculate_record_range ( Evoral::OverlapType ot, framepos_t transport_frame, framecnt_t nframes, framecnt_t& rec_nframes, framecnt_t& rec_offset diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 0823a5f8ac..ae86660c03 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -184,9 +184,9 @@ class MidiDiskstream : public Diskstream void adjust_playback_buffering () {} void adjust_capture_buffering () {} - void engage_record_enable (); - void disengage_record_enable (); - + bool prep_record_enable (); + bool prep_record_disable (); + MidiRingBuffer<framepos_t>* _playback_buf; MidiRingBuffer<framepos_t>* _capture_buf; boost::weak_ptr<MidiPort> _source_port; diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index bfa546c9ef..b4325e3778 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -126,7 +126,6 @@ CONFIG_VARIABLE (gain_t, click_gain, "click-gain", 1.0) * Note that processors are still run when the transport is not moving. */ CONFIG_VARIABLE (bool, plugins_stop_with_transport, "plugins-stop-with-transport", false) -CONFIG_VARIABLE (bool, do_not_record_plugins, "do-not-record-plugins", false) CONFIG_VARIABLE (bool, stop_recording_on_xrun, "stop-recording-on-xrun", false) CONFIG_VARIABLE (bool, create_xrun_marker, "create-xrun-marker", true) CONFIG_VARIABLE (bool, stop_at_session_end, "stop-at-session-end", false) diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 6d2d73519c..da3b3b24ee 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -106,6 +106,7 @@ class Track : public Route, public PublicDiskstream bool record_enabled() const; void set_record_enabled (bool yn, void *src); + void prep_record_enabled (bool yn, void *src); bool using_diskstream_id (PBD::ID) const; @@ -170,10 +171,6 @@ class Track : public Route, public PublicDiskstream boost::shared_ptr<Diskstream> _diskstream; MeterPoint _saved_meter_point; - /** used to keep track of processors that we are deactivating during record, - if `do-not-record-plugins' is enabled. - */ - std::list<boost::weak_ptr<Processor> > _deactivated_processors; TrackMode _mode; bool _needs_butler; MonitorChoice _monitoring; @@ -230,10 +227,6 @@ private: void diskstream_record_enable_changed (); void diskstream_speed_changed (); void diskstream_alignment_style_changed (); - - void parameter_changed (std::string); - void deactivate_visible_processors (); - void activate_deactivated_processors (); }; }; /* namespace ARDOUR*/ diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 2d2d3d252f..8378fa210c 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1664,13 +1664,22 @@ AudioDiskstream::set_record_enabled (bool yn) } } -void -AudioDiskstream::engage_record_enable () +bool +AudioDiskstream::prep_record_enable () { + if (!recordable() || !_session.record_enabling_legal() || _io->n_ports().n_audio() == 0) { + return false; + } + + /* can't rec-enable in destructive mode if transport is before start */ + + if (destructive() && _session.transport_frame() < _session.current_start_frame()) { + return false; + } + bool rolling = _session.transport_speed() != 0.0f; boost::shared_ptr<ChannelList> c = channels.reader(); - g_atomic_int_set (&_record_enabled, 1); capturing_sources.clear (); if (Config->get_monitoring_model() == HardwareMonitoring) { @@ -1689,12 +1698,13 @@ AudioDiskstream::engage_record_enable () } RecordEnableChanged (); /* EMIT SIGNAL */ + + return true; } -void -AudioDiskstream::disengage_record_enable () +bool +AudioDiskstream::prep_record_disable () { - g_atomic_int_set (&_record_enabled, 0); boost::shared_ptr<ChannelList> c = channels.reader(); if (Config->get_monitoring_model() == HardwareMonitoring) { for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { @@ -1703,6 +1713,8 @@ AudioDiskstream::disengage_record_enable () } capturing_sources.clear (); RecordEnableChanged (); /* EMIT SIGNAL */ + + return true; } XMLNode& diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 553e29244f..f938c09ef3 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -727,3 +727,16 @@ Diskstream::prepare_to_stop (framepos_t pos) { last_recordable_frame = pos + _capture_offset; } + +void +Diskstream::engage_record_enable () +{ + g_atomic_int_set (&_record_enabled, 1); +} + +void +Diskstream::disengage_record_enable () +{ + g_atomic_int_set (&_record_enabled, 0); +} + diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 64f02b0ad9..84a209cd33 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1021,7 +1021,7 @@ MidiDiskstream::finish_capture () void MidiDiskstream::set_record_enabled (bool yn) { - if (!recordable() || !_session.record_enabling_legal()) { + if (!recordable() || !_session.record_enabling_legal() || _io->n_ports().n_midi() == 0) { return; } @@ -1040,12 +1040,14 @@ MidiDiskstream::set_record_enabled (bool yn) } } -void -MidiDiskstream::engage_record_enable () +bool +MidiDiskstream::prep_record_enable () { - bool const rolling = _session.transport_speed() != 0.0f; + if (!recordable() || !_session.record_enabling_legal() || _io->n_ports().n_midi() == 0) { + return false; + } - g_atomic_int_set (&_record_enabled, 1); + bool const rolling = _session.transport_speed() != 0.0f; boost::shared_ptr<MidiPort> sp = _source_port.lock (); @@ -1054,13 +1056,17 @@ MidiDiskstream::engage_record_enable () } RecordEnableChanged (); /* EMIT SIGNAL */ + + return true; } -void -MidiDiskstream::disengage_record_enable () +bool +MidiDiskstream::prep_record_disable () { g_atomic_int_set (&_record_enabled, 0); RecordEnableChanged (); /* EMIT SIGNAL */ + + return true; } XMLNode& diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 749552b0d2..e086bb8b4b 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -3072,8 +3072,6 @@ Route::flush_processors () void Route::set_meter_point (MeterPoint p, bool force) { - /* CAN BE CALLED FROM PROCESS CONTEXT */ - if (_meter_point == p && !force) { return; } diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc index b5328a1548..4af06fa9a8 100644 --- a/libs/ardour/session_rtevents.cc +++ b/libs/ardour/session_rtevents.cc @@ -183,6 +183,25 @@ Session::set_record_enabled (boost::shared_ptr<RouteList> rl, bool yn, SessionEv return; } + /* do the non-RT part of rec-enabling first - the RT part will be done + * on the next process cycle. This does mean that theoretically we are + * doing things provisionally on the assumption that the rec-enable + * change will work, but this had better be a solid assumption for + * other reasons. + */ + + for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { + if ((*i)->is_hidden()) { + continue; + } + + boost::shared_ptr<Track> t; + + if ((t = boost::dynamic_pointer_cast<Track>(*i)) != 0) { + t->prep_record_enabled (yn, (group_override ? (void*) t->route_group() : (void *) this)); + } + } + queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_record_enabled)); } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 24f486fa61..22edb52dcb 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -46,8 +46,6 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data { _freeze_record.state = NoFreeze; _declickable = true; - - Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Track::parameter_changed, this, _1)); } Track::~Track () @@ -100,19 +98,6 @@ Track::state (bool full) root.add_property (X_("saved-meter-point"), enum_2_string (_saved_meter_point)); root.add_child_nocopy (_rec_enable_control->get_state()); root.add_child_nocopy (_diskstream->get_state ()); - - if (!_deactivated_processors.empty ()) { - XMLNode* node = new XMLNode (X_("DeactivatedProcessors")); - for (list<boost::weak_ptr<Processor> >::iterator i = _deactivated_processors.begin(); i != _deactivated_processors.end(); ++i) { - boost::shared_ptr<Processor> p = i->lock (); - if (p) { - XMLNode* c = new XMLNode (X_("Processor")); - c->add_property (X_("id"), p->id().to_s()); - node->add_child_nocopy (*c); - } - } - root.add_child_nocopy (*node); - } return root; } @@ -152,18 +137,6 @@ Track::set_state (const XMLNode& node, int version) _rec_enable_control->set_state (*child, version); } } - - if (child->name() == X_("DeactivatedProcessors")) { - XMLNodeList dp = child->children (); - for (XMLNodeConstIterator i = dp.begin(); i != dp.end(); ++i) { - assert ((*i)->name() == X_("Processor")); - XMLProperty* prop = (*i)->property (X_("id")); - boost::shared_ptr<Processor> p = processor_by_id (PBD::ID (prop->value ())); - if (p) { - _deactivated_processors.push_back (p); - } - } - } } const XMLProperty* prop; @@ -250,35 +223,8 @@ Track::can_record() return will_record; } -/* Turn off visible processors (except Fader), keeping track of the old states */ void -Track::deactivate_visible_processors () -{ - _deactivated_processors.clear (); - Glib::Threads::RWLock::ReaderLock lm (_processor_lock); - - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) { - if ((*i)->active() && (*i)->display_to_user() && boost::dynamic_pointer_cast<Amp> (*i) == 0) { - (*i)->deactivate (); - _deactivated_processors.push_back (*i); - } - } -} - -/* Turn deactivated processors back on again */ -void -Track::activate_deactivated_processors () -{ - for (list<boost::weak_ptr<Processor> >::iterator i = _deactivated_processors.begin(); i != _deactivated_processors.end(); ++i) { - boost::shared_ptr<Processor> p = i->lock (); - if (p) { - p->activate (); - } - } -} - -void -Track::set_record_enabled (bool yn, void *src) +Track::prep_record_enabled (bool yn, void *src) { if (!_session.writable()) { return; @@ -289,7 +235,7 @@ Track::set_record_enabled (bool yn, void *src) } if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_recenable()) { - _route_group->apply (&Track::set_record_enabled, yn, _route_group); + _route_group->apply (&Track::prep_record_enabled, yn, _route_group); return; } @@ -298,28 +244,50 @@ Track::set_record_enabled (bool yn, void *src) _saved_meter_point = _meter_point; } - if (Config->get_do_not_record_plugins ()) { + bool will_follow; + + if (yn) { + will_follow = _diskstream->prep_record_enable (); + } else { + will_follow = _diskstream->prep_record_disable (); + } + + if (will_follow) { if (yn) { - deactivate_visible_processors (); + if (_meter_point != MeterCustom) { + set_meter_point (MeterInput); + } } else { - activate_deactivated_processors (); + set_meter_point (_saved_meter_point); } } +} + +void +Track::set_record_enabled (bool yn, void *src) +{ + if (!_session.writable()) { + return; + } - _diskstream->set_record_enabled (yn); + if (_freeze_record.state == Frozen) { + return; + } - if (_diskstream->record_enabled()) { - if (_meter_point != MeterCustom) { - set_meter_point (MeterInput); - } + if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_recenable()) { + _route_group->apply (&Track::set_record_enabled, yn, _route_group); + return; + } + + if (yn) { + _diskstream->engage_record_enable(); } else { - set_meter_point (_saved_meter_point); + _diskstream->disengage_record_enable(); } _rec_enable_control->Changed (); } - bool Track::set_name (const string& str) { @@ -950,22 +918,6 @@ Track::set_monitoring (MonitorChoice mc) } } -void -Track::parameter_changed (string p) -{ - if (p != "do-not-record-plugins") { - return; - } - - if (record_enabled ()) { - if (Config->get_do_not_record_plugins ()) { - deactivate_visible_processors (); - } else { - activate_deactivated_processors (); - } - } -} - MeterState Track::metering_state () const { |