13
0

Update monitoring

This partially reverts 208c781248
in order to fix monitoring when using punch-in/out.

This also allows to revert to Ardour 5 style MIDI exclusive
Input or Disk monitoring when not using layered-recording.
This commit is contained in:
Robin Gareus 2020-06-17 23:51:13 +02:00
parent e34d940ab3
commit fbe8075117
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 96 additions and 78 deletions

View File

@ -38,7 +38,7 @@ class LIBARDOUR_API AudioTrack : public Track
AudioTrack (Session&, std::string name = "", TrackMode m = Normal); AudioTrack (Session&, std::string name = "", TrackMode m = Normal);
~AudioTrack (); ~AudioTrack ();
MonitorState get_auto_monitoring_state () const; MonitorState get_input_monitoring_state (bool recording, bool talkback) const;
void freeze_me (InterThreadInfo&); void freeze_me (InterThreadInfo&);
void unfreeze (); void unfreeze ();

View File

@ -128,7 +128,7 @@ public:
boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const; boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
MonitorState monitoring_state () const; MonitorState monitoring_state () const;
MonitorState get_auto_monitoring_state () const; MonitorState get_input_monitoring_state (bool recording, bool talkback) const;
MidiBuffer const& immediate_event_buffer () const { return _immediate_event_buffer; } MidiBuffer const& immediate_event_buffer () const { return _immediate_event_buffer; }
MidiRingBuffer<samplepos_t>& immediate_events () { return _immediate_events; } MidiRingBuffer<samplepos_t>& immediate_events () { return _immediate_events; }

View File

@ -139,7 +139,7 @@ public:
boost::shared_ptr<MonitorControl> monitoring_control() const { return _monitoring_control; } boost::shared_ptr<MonitorControl> monitoring_control() const { return _monitoring_control; }
MonitorState monitoring_state () const; MonitorState monitoring_state () const;
virtual MonitorState get_auto_monitoring_state () const { return MonitoringSilence; } virtual MonitorState get_input_monitoring_state (bool recording, bool talkback) const { return MonitoringSilence; }
/* these are the core of the API of a Route. see the protected sections as well */ /* these are the core of the API of a Route. see the protected sections as well */

View File

@ -70,72 +70,6 @@ AudioTrack::~AudioTrack ()
} }
} }
MonitorState
AudioTrack::get_auto_monitoring_state () const
{
/* This is an implementation of the truth table in doc/monitor_modes.pdf;
I don't think it's ever going to be too pretty too look at.
*/
bool const roll = _session.transport_rolling ();
bool const track_rec = _disk_writer->record_enabled ();
bool const auto_input = _session.config.get_auto_input ();
bool const software_monitor = Config->get_monitoring_model() == SoftwareMonitoring;
bool const auto_input_does_talkback = Config->get_auto_input_does_talkback ();
bool session_rec;
/* I suspect that just use actively_recording() is good enough all the
* time, but just to keep the semantics the same as they were before
* sept 26th 2012, we differentiate between the cases where punch is
* enabled and those where it is not.
*
* rg: sept 30 2017: Above is not the case: punch-in/out location is
* global session playhead position.
* When this method is called from process_output_buffers() we need
* to use delay-compensated route's process-position.
*
* NB. Disk reader/writer may also be offset by a same amount of time.
*
* Also keep in mind that _session.transport_rolling() is false during
* pre-roll but the disk already produces output.
*
* TODO: FIXME
*/
if (_session.config.get_punch_in() || _session.config.get_punch_out()) {
session_rec = _session.actively_recording ();
} else {
session_rec = _session.get_record_enabled();
}
if (track_rec) {
if (!session_rec && roll && auto_input) {
return MonitoringDisk;
} else {
return software_monitor ? MonitoringInput : MonitoringSilence;
}
} else {
if (auto_input_does_talkback) {
if (!roll && auto_input) {
return software_monitor ? MonitoringInput : MonitoringSilence;
} else {
return MonitoringDisk;
}
} else {
return MonitoringDisk;
}
}
abort(); /* NOTREACHED */
return MonitoringSilence;
}
int int
AudioTrack::set_state (const XMLNode& node, int version) AudioTrack::set_state (const XMLNode& node, int version)
{ {
@ -249,6 +183,16 @@ AudioTrack::set_state_part_two ()
} }
} }
MonitorState
AudioTrack::get_input_monitoring_state (bool recording, bool talkback) const
{
if (Config->get_monitoring_model() == SoftwareMonitoring && (recording || talkback)) {
return MonitoringInput;
} else {
return MonitoringSilence;
}
}
int int
AudioTrack::export_stuff (BufferSet& buffers, samplepos_t start, samplecnt_t nframes, AudioTrack::export_stuff (BufferSet& buffers, samplepos_t start, samplecnt_t nframes,
boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze,

View File

@ -138,6 +138,18 @@ MidiTrack::can_be_record_enabled ()
return Track::can_be_record_enabled (); return Track::can_be_record_enabled ();
} }
MonitorState
MidiTrack::get_input_monitoring_state (bool recording, bool talkback) const
{
if (!_session.config.get_layered_record_mode () && (recording || talkback)) {
return MonitoringCue;
} else if (!_session.config.get_layered_record_mode () || recording || talkback) {
return MonitoringInput;
} else {
return MonitoringSilence;
}
}
int int
MidiTrack::set_state (const XMLNode& node, int version) MidiTrack::set_state (const XMLNode& node, int version)
{ {
@ -859,18 +871,12 @@ MidiTrack::monitoring_state () const
{ {
MonitorState ms = Track::monitoring_state(); MonitorState ms = Track::monitoring_state();
if (ms == MonitoringSilence) { if (ms == MonitoringSilence) {
/* MIDI always monitor input as fallback */
return MonitoringInput; return MonitoringInput;
} }
return ms; return ms;
} }
MonitorState
MidiTrack::get_auto_monitoring_state () const
{
//if we are a midi track, we ignore auto_input, tape_mode, etc etc. "Auto" will monitor Disk+In
return MonitoringCue;
}
void void
MidiTrack::filter_input (BufferSet& bufs) MidiTrack::filter_input (BufferSet& bufs)
{ {

View File

@ -6132,10 +6132,15 @@ Route::set_loop (Location* l)
} }
} }
static inline MonitorState
operator| (const MonitorState& a, const MonitorState& b) {
return static_cast<MonitorState> (static_cast <int>(a) | static_cast<int> (b));
}
MonitorState MonitorState
Route::monitoring_state () const Route::monitoring_state () const
{ {
if (!_disk_reader) { if (!_disk_reader || !_monitoring_control) {
return MonitoringInput; return MonitoringInput;
} }
@ -6168,6 +6173,69 @@ Route::monitoring_state () const
break; break;
} }
return get_auto_monitoring_state(); /* This is an implementation of the truth table in doc/monitor_modes.pdf;
* I don't think it's ever going to be too pretty too look at.
*/
bool const roll = _session.transport_rolling ();
bool const auto_input = _session.config.get_auto_input ();
bool const track_rec = _disk_writer->record_enabled ();
bool session_rec;
bool const software_monitor = Config->get_monitoring_model() == SoftwareMonitoring;
bool const auto_input_does_talkback = Config->get_auto_input_does_talkback ();
/* I suspect that just use actively_recording() is good enough all the
* time, but just to keep the semantics the same as they were before
* sept 26th 2012, we differentiate between the cases where punch is
* enabled and those where it is not.
*
* rg: sept 30 2017: Above is not the case: punch-in/out location is
* global session playhead position.
* When this method is called from process_output_buffers() we need
* to use delay-compensated route's process-position.
*
* NB. Disk reader/writer may also be offset by a same amount of time.
*
* Also keep in mind that _session.transport_rolling() is false during
* pre-roll but the disk already produces output.
*
* TODO: FIXME
*/
if (_session.config.get_punch_in() || _session.config.get_punch_out()) {
session_rec = _session.actively_recording ();
} else {
session_rec = _session.get_record_enabled();
}
if (track_rec) {
if (!session_rec && roll && auto_input) {
return MonitoringDisk | get_input_monitoring_state (false, false);
} else {
/* recording */
return get_input_monitoring_state (true, false);
}
} else {
if (auto_input_does_talkback) {
if (!roll && auto_input) {
return get_input_monitoring_state (false, true);
} else {
return MonitoringDisk | get_input_monitoring_state (false, false);
}
} else {
/* tape-machine-mode */
return MonitoringDisk | get_input_monitoring_state (false, false);
}
}
abort(); /* NOTREACHED */
return MonitoringSilence;
} }