From 8ff34fde9d5bffb2f205a10a160c3a7f15c25141 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 21 Oct 2011 15:05:33 +0000 Subject: [PATCH] correctly track monitoring changes in libardour and the GUI; required removing propagation of session rec-enabled status through process chain and replacing it with call to Session::actively_recording() where necessary (may require a new RT event) git-svn-id: svn://localhost/ardour2/branches/3.0@10265 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour3_styles.rc.in | 8 ++-- gtk2_ardour/route_ui.cc | 37 +++++++++++++---- libs/ardour/ardour/audio_diskstream.h | 2 +- libs/ardour/ardour/audio_track.h | 2 +- libs/ardour/ardour/diskstream.h | 2 +- libs/ardour/ardour/graph.h | 6 +-- libs/ardour/ardour/midi_diskstream.h | 2 +- libs/ardour/ardour/midi_track.h | 6 +-- libs/ardour/ardour/route.h | 6 +-- libs/ardour/ardour/track.h | 9 ++-- libs/ardour/ardour/types.h | 6 +++ libs/ardour/audio_diskstream.cc | 7 ++-- libs/ardour/audio_track.cc | 17 +++----- libs/ardour/auditioner.cc | 2 +- libs/ardour/graph.cc | 17 +++----- libs/ardour/midi_diskstream.cc | 3 +- libs/ardour/midi_track.cc | 14 +++---- libs/ardour/route.cc | 9 ++-- libs/ardour/session_process.cc | 17 +++----- libs/ardour/track.cc | 59 +++++++++++++++++++++------ 20 files changed, 136 insertions(+), 95 deletions(-) diff --git a/gtk2_ardour/ardour3_styles.rc.in b/gtk2_ardour/ardour3_styles.rc.in index 237b62f07b..5a06479a11 100644 --- a/gtk2_ardour/ardour3_styles.rc.in +++ b/gtk2_ardour/ardour3_styles.rc.in @@ -168,8 +168,8 @@ style "monitor_input_button_alternate" = "small_button" { fg[NORMAL] = @@COLPREFIX@_fg fg[PRELIGHT] = @@COLPREFIX@_fg - bg[NORMAL] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) - bg[PRELIGHT] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) + bg[NORMAL] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) + bg[PRELIGHT] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) } style "monitor_disk_button" = "small_button" @@ -192,8 +192,8 @@ style "monitor_disk_button_alternate" = "small_button" { fg[NORMAL] = @@COLPREFIX@_fg fg[PRELIGHT] = @@COLPREFIX@_fg - bg[NORMAL] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) - bg[PRELIGHT] = mix(0.3,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) + bg[NORMAL] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) + bg[PRELIGHT] = mix(0.5,@@COLPREFIX@_bright_indicator,darker(@@COLPREFIX@_bg)) } style "solo_button" = "small_button" diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 9dd2f81599..ee978a4bd6 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -157,6 +157,7 @@ RouteUI::init () _session->TransportStateChange.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::check_rec_enable_sensitivity, this), gui_context()); _session->RecordStateChanged.connect (_session_connections, invalidator (*this), boost::bind (&RouteUI::session_rec_enable_changed, this), gui_context()); + _session->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context()); Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind (&RouteUI::parameter_changed, this, _1), gui_context()); rec_enable_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_press), false); @@ -593,22 +594,34 @@ RouteUI::monitoring_changed () void RouteUI::update_monitoring_display () { + if (!_route) { + return; + } + boost::shared_ptr t = boost::dynamic_pointer_cast(_route); if (!t) { return; } - MonitorChoice mc = t->monitoring(); + MonitorState ms = t->monitoring_state(); - if (mc & MonitorInput) { - monitor_input_button->set_visual_state (1); + if (ms & MonitoringInput) { + if (t->monitoring_choice() & MonitorInput) { + monitor_input_button->set_visual_state (1); + } else { + monitor_input_button->set_visual_state (2); + } } else { monitor_input_button->set_visual_state (0); } - if (mc & MonitorDisk) { - monitor_disk_button->set_visual_state (1); + if (ms & MonitoringDisk) { + if (t->monitoring_choice() & MonitorDisk) { + monitor_disk_button->set_visual_state (1); + } else { + monitor_disk_button->set_visual_state (2); + } } else { monitor_disk_button->set_visual_state (0); } @@ -659,11 +672,11 @@ RouteUI::monitor_release (GdkEventButton* ev, MonitorChoice monitor_choice) signal together, which requires yet more buffers. */ - if (t->monitoring() & monitor_choice) { - mc = MonitorChoice (t->monitoring() & ~monitor_choice); + if (t->monitoring_choice() & monitor_choice) { + mc = MonitorChoice (t->monitoring_choice() & ~monitor_choice); } else { /* this line will change when the options are non-orthogonal */ - // mc = MonitorChoice (t->monitoring() | monitor_choice); + // mc = MonitorChoice (t->monitoring_choice() | monitor_choice); mc = monitor_choice; } @@ -1129,12 +1142,14 @@ void RouteUI::route_rec_enable_changed () { update_rec_display (); + update_monitoring_display (); } void RouteUI::session_rec_enable_changed () { update_rec_display (); + update_monitoring_display (); } void @@ -1722,15 +1737,21 @@ RouteUI::check_rec_enable_sensitivity () } else { rec_enable_button->set_sensitive (true); } + + update_monitoring_display (); } void RouteUI::parameter_changed (string const & p) { + /* this handles RC and per-session parameter changes */ + if (p == "disable-disarm-during-roll") { check_rec_enable_sensitivity (); } else if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") { set_button_names (); + } else if (p == "auto-input") { + update_monitoring_display (); } } diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index f233e21112..94c843971b 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -171,7 +171,7 @@ class AudioDiskstream : public Diskstream protected: friend class AudioTrack; - int process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler); + int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler); bool commit (framecnt_t nframes); private: diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 445558ccdd..c39c7f5640 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -40,7 +40,7 @@ class AudioTrack : public Track bool can_use_mode (TrackMode m, bool& bounce_required); int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - int declick, bool can_record, bool& need_butler); + int declick, bool& need_butler); void use_new_diskstream (); void set_diskstream (boost::shared_ptr); diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index dad9501c8e..975c8d45da 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -185,7 +185,7 @@ class Diskstream : public SessionObject, public PublicDiskstream protected: friend class Track; - virtual int process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler) = 0; + virtual int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) = 0; virtual bool commit (framecnt_t nframes) = 0; //private: diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index 0279fe8fd9..0fa5b2f6c8 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -74,13 +74,13 @@ public: void main_thread(); int silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool can_record, bool& need_butler); + bool& need_butler); int process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, - bool can_record, bool& need_butler); + bool& need_butler); int routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool non_rt_pending, bool can_record, int declick); + bool non_rt_pending, int declick); void process_one_route (Route * route); diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index d10640b51b..0454b55e01 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -142,7 +142,7 @@ class MidiDiskstream : public Diskstream protected: friend class MidiTrack; - int process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler); + int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler); bool commit (framecnt_t nframes); static framecnt_t midi_readahead; diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 407a317433..a2cc2e7d9d 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -41,8 +41,7 @@ public: int init (); - int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - int declick, bool can_record, bool& need_butler); + int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler); void realtime_handle_transport_stopped (); void realtime_locate (); @@ -133,8 +132,7 @@ protected: bool _midi_thru; bool _input_active; - int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool state_changing, bool can_record); + int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing); void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes); void diskstream_data_recorded (boost::shared_ptr, boost::weak_ptr); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 91b95d33e7..e6e6a7e087 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -109,13 +109,13 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, /* these are the core of the API of a Route. see the protected sections as well */ virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - int declick, bool can_record, bool& need_butler); + int declick, bool& need_butler); virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool state_changing, bool can_record); + bool state_changing); virtual int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool can_record, bool& need_butler); + bool& need_butler); virtual void toggle_monitor_input (); virtual bool can_record() { return false; } diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index b467ffb316..01b084641d 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -49,17 +49,18 @@ class Track : public Route, public PublicDiskstream PBD::Signal0 TrackModeChanged; virtual void set_monitoring (MonitorChoice); - MonitorChoice monitoring() const { return _monitoring; } + MonitorChoice monitoring_choice() const { return _monitoring; } + MonitorState monitoring_state(); PBD::Signal0 MonitoringChanged; virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool state_changing, bool can_record); + bool state_changing); int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool can_record, bool& need_butler); + bool& need_butler); virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - int declick, bool can_record, bool& need_butler) = 0; + int declick, bool& need_butler) = 0; bool needs_butler() const { return _needs_butler; } void toggle_monitor_input (); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index e2daf1a76c..417a9ed54d 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -365,6 +365,12 @@ namespace ARDOUR { MonitorCue = 0x4, }; + enum MonitorState { + MonitoringSilence = 0x1, + MonitoringInput = 0x2, + MonitoringDisk = 0x4, + }; + enum PFLPosition { /** PFL signals come from before pre-fader processors */ PFLFromBeforeProcessors, diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index f5733cd6a4..7b0e466ae0 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -406,7 +406,7 @@ AudioDiskstream::prepare_record_status(framepos_t capture_start_frame) } int -AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler) +AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) { uint32_t n; boost::shared_ptr c = channels.reader(); @@ -415,6 +415,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca framecnt_t rec_offset = 0; framecnt_t rec_nframes = 0; bool collect_playback = false; + bool can_record = _session.actively_recording (); playback_distance = 0; @@ -567,8 +568,8 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca collect_playback = true; } - if ((_track->monitoring() & MonitorDisk) || collect_playback) { - + if ((_track->monitoring_state () & MonitoringDisk) || collect_playback) { + /* we're doing playback */ framecnt_t necessary_samples; diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 99217cfc0e..a4049b28a7 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -353,10 +353,10 @@ AudioTrack::set_state_part_two () } int -AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, - bool can_record, bool& need_butler) +AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); + if (!lm.locked()) { return 0; } @@ -386,13 +386,13 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram playback distance to zero, thus causing diskstream::commit to do nothing. */ - return diskstream->process (transport_frame, 0, can_record, need_butler); + return diskstream->process (transport_frame, 0, need_butler); } _silent = false; _amp->apply_gain_automation(false); - if ((dret = diskstream->process (transport_frame, nframes, can_record, need_butler)) != 0) { + if ((dret = diskstream->process (transport_frame, nframes, need_butler)) != 0) { silence (nframes); return dret; } @@ -403,14 +403,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram _input->process_input (_meter, start_frame, end_frame, nframes); } - if ((_monitoring & MonitorInput) || (!(_monitoring & MonitorDisk) && - (diskstream->record_enabled() && - !can_record && - !_session.config.get_auto_input()))) { - - /* not actually recording, but we want to hear the input material anyway, - at least potentially (depending on monitoring options) - */ + if (monitoring_state() == MonitoringInput) { passthru (start_frame, end_frame, nframes, false); diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index b6544bbae6..7ba5e966fc 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -223,7 +223,7 @@ Auditioner::play_audition (framecnt_t nframes) this_nframes = min (nframes, length - current_frame); - if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, false, need_butler)) != 0) { + if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, need_butler)) != 0) { silence (nframes); return ret; } diff --git a/libs/ardour/graph.cc b/libs/ardour/graph.cc index f0d3075b30..cb5ac65f11 100644 --- a/libs/ardour/graph.cc +++ b/libs/ardour/graph.cc @@ -512,13 +512,11 @@ Graph::dump (int chain) } int -Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool can_record, bool& need_butler) +Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool& need_butler) { _process_nframes = nframes; _process_start_frame = start_frame; _process_end_frame = end_frame; - _process_can_record = can_record; _process_silent = true; _process_noroll = false; @@ -537,15 +535,13 @@ Graph::silent_process_routes (pframes_t nframes, framepos_t start_frame, framepo } int -Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, - bool can_record, bool& need_butler) +Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler) { DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("graph execution from %1 to %2 = %3\n", start_frame, end_frame, nframes)); _process_nframes = nframes; _process_start_frame = start_frame; _process_end_frame = end_frame; - _process_can_record = can_record; _process_declick = declick; _process_silent = false; @@ -566,14 +562,13 @@ Graph::process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end int Graph::routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool non_rt_pending, bool can_record, int declick) + bool non_rt_pending, int declick) { DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("no-roll graph execution from %1 to %2 = %3\n", start_frame, end_frame, nframes)); _process_nframes = nframes; _process_start_frame = start_frame; _process_end_frame = end_frame; - _process_can_record = can_record; _process_declick = declick; _process_non_rt_pending = non_rt_pending; @@ -599,13 +594,13 @@ Graph::process_one_route (Route* route) DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_self(), route->name())); if (_process_silent) { - retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_can_record, need_butler); + retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, need_butler); } else if (_process_noroll) { route->set_pending_declick (_process_declick); - retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending, _process_can_record); + retval = route->no_roll (_process_nframes, _process_start_frame, _process_end_frame, _process_non_rt_pending); } else { route->set_pending_declick (_process_declick); - retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, _process_can_record, need_butler); + retval = route->roll (_process_nframes, _process_start_frame, _process_end_frame, _process_declick, need_butler); } if (retval) { diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index d13f638fa4..f252c8741e 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -477,13 +477,14 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) #endif int -MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool can_record, bool& need_butler) +MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) { int ret = -1; framecnt_t rec_offset = 0; framecnt_t rec_nframes = 0; bool nominally_recording; bool re = record_enabled (); + bool can_record = _session.actively_recording (); playback_distance = 0; diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index fb323e12dc..9145cad7f3 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -312,8 +312,7 @@ MidiTrack::set_state_part_two () } int -MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, - bool can_record, bool& needs_butler) +MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& needs_butler) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (!lm.locked()) { @@ -341,12 +340,12 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame playback distance to zero, thus causing diskstream::commit to do nothing. */ - return diskstream->process (transport_frame, 0, can_record, needs_butler); + return diskstream->process (transport_frame, 0, needs_butler); } _silent = false; - if ((dret = diskstream->process (transport_frame, nframes, can_record, needs_butler)) != 0) { + if ((dret = diskstream->process (transport_frame, nframes, needs_butler)) != 0) { silence (nframes); return dret; } @@ -357,7 +356,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame _input->process_input (_meter, start_frame, end_frame, nframes); } - if (should_monitor_input ()) { + if (monitoring_state() == MonitoringInput) { /* not actually recording, but we want to hear the input material anyway, at least potentially (depending on monitoring options) @@ -411,10 +410,9 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame } int -MidiTrack::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool state_changing, bool can_record) +MidiTrack::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing) { - int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing, can_record); + int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing); if (ret == 0 && _step_editing) { push_midi_input_to_step_edit_ringbuffer (nframes); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 97a6e200ba..dcb85c9156 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2782,8 +2782,7 @@ Route::pans_required () const } int -Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool session_state_changing, bool /*can_record*/) +Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (!lm.locked()) { @@ -2820,8 +2819,7 @@ Route::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, } int -Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, - bool /*can_record*/, bool& /* need_butler */) +Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& /* need_butler */) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (!lm.locked()) { @@ -2853,8 +2851,7 @@ Route::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, in } int -Route::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, - bool /*can_record*/, bool& /* need_butler */) +Route::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool& /* need_butler */) { silence (nframes); return 0; diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 4d974d4830..2384dd5fb3 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -109,7 +109,7 @@ Session::no_roll (pframes_t nframes) if (route_graph->threads_in_use() > 0) { DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/no-roll\n"); - route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), actively_recording(), declick); + route_graph->routes_no_roll( nframes, _transport_frame, end_frame, non_realtime_work_pending(), declick); } else { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { @@ -119,8 +119,7 @@ Session::no_roll (pframes_t nframes) (*i)->set_pending_declick (declick); - if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(), - actively_recording())) { + if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending())) { error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg; ret = -1; break; @@ -134,7 +133,6 @@ Session::no_roll (pframes_t nframes) int Session::process_routes (pframes_t nframes, bool& need_butler) { - bool record_active; int declick = get_transport_declick_required(); boost::shared_ptr r = routes.reader (); @@ -143,8 +141,6 @@ Session::process_routes (pframes_t nframes, bool& need_butler) declick = -1; } - record_active = actively_recording(); // || (get_record_enabled() && get_punch_in()); - const framepos_t start_frame = _transport_frame; const framepos_t end_frame = _transport_frame + floor (nframes * _transport_speed); @@ -154,7 +150,7 @@ Session::process_routes (pframes_t nframes, bool& need_butler) */ if (1 || route_graph->threads_in_use() > 0) { DEBUG_TRACE(DEBUG::ProcessThreads,"calling graph/process-routes\n"); - route_graph->process_routes (nframes, start_frame, end_frame, declick, record_active, need_butler); + route_graph->process_routes (nframes, start_frame, end_frame, declick, need_butler); } else { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { @@ -167,7 +163,7 @@ Session::process_routes (pframes_t nframes, bool& need_butler) (*i)->set_pending_declick (declick); - if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, need_butler)) < 0) { + if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, need_butler)) < 0) { stop_transport (); return -1; } @@ -180,7 +176,6 @@ Session::process_routes (pframes_t nframes, bool& need_butler) int Session::silent_process_routes (pframes_t nframes, bool& need_butler) { - bool record_active = actively_recording(); boost::shared_ptr r = routes.reader (); const framepos_t start_frame = _transport_frame; @@ -191,7 +186,7 @@ Session::silent_process_routes (pframes_t nframes, bool& need_butler) tracks, the graph never gets updated. */ if (1 || route_graph->threads_in_use() > 0) { - route_graph->silent_process_routes (nframes, start_frame, end_frame, record_active, need_butler); + route_graph->silent_process_routes (nframes, start_frame, end_frame, need_butler); } else { for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { @@ -201,7 +196,7 @@ Session::silent_process_routes (pframes_t nframes, bool& need_butler) continue; } - if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, need_butler)) < 0) { + if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, need_butler)) < 0) { stop_transport (); return -1; } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index fdb1665a31..5693b86c42 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -241,14 +241,15 @@ Track::zero_diskstream_id_in_xml (XMLNode& node) } int -Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, - bool session_state_changing, bool can_record) +Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (!lm.locked()) { return 0; } + bool can_record = _session.actively_recording (); + if (n_outputs().n_total() == 0) { return 0; } @@ -323,8 +324,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, } int -Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, - bool can_record, bool& need_butler) +Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool& need_butler) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (!lm.locked()) { @@ -345,7 +345,7 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /* silence (nframes); - return _diskstream->process (_session.transport_frame(), nframes, can_record, need_butler); + return _diskstream->process (_session.transport_frame(), nframes, need_butler); } void @@ -774,12 +774,47 @@ Track::set_monitoring (MonitorChoice mc) } } -bool -Track::should_monitor_input () +MonitorState +Track::monitoring_state () { - return (_monitoring & MonitorInput) || - (!(_monitoring & MonitorDisk) && - (diskstream->record_enabled() && - !can_record && - !_session.config.get_auto_input())); + MonitorState ms = MonitoringSilence; + + if (_session.transport_rolling()) { + + /* roll case */ + + if ((_monitoring & MonitorInput) || // explicitly requested input monitoring + (!(_monitoring & MonitorDisk) && // disk monitoring not requested + (_diskstream->record_enabled() && // record-enabled BUT + !_session.actively_recording() && // session NOT rec-armed + !_session.config.get_auto_input()))) { // and auto-input is off + + ms = MonitoringInput; + + } else { + + ms = MonitorState (0); + } + + if ((_monitoring & MonitorDisk) || // explicitly requested disk monitoring + (!(_monitoring & MonitorInput) && // input monitoring not requested + (_diskstream->record_enabled() && // record-enabled BUT + (_session.actively_recording() || // session rec-armed OR + _session.config.get_auto_input())))) { // auto-input is ON (mon-input while rec-rolling + + ms = MonitorState (ms | MonitoringDisk); + } + + } else { + + /* no-roll case */ + + if (send_silence()) { + ms = MonitoringSilence; + } else { + ms = MonitoringInput; + } + } + + return ms; }