Auto-monitor == Cue for MIDI tracks.

This commit is contained in:
Ben Loftis 2018-02-14 18:04:57 -06:00
parent 58002d82ea
commit 208c781248
7 changed files with 82 additions and 62 deletions

View File

@ -36,6 +36,8 @@ class LIBARDOUR_API AudioTrack : public Track
AudioTrack (Session&, std::string name, TrackMode m = Normal);
~AudioTrack ();
MonitorState get_auto_monitoring_state () const;
void freeze_me (InterThreadInfo&);
void unfreeze ();

View File

@ -125,6 +125,7 @@ public:
boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const;
MonitorState monitoring_state () const;
MonitorState get_auto_monitoring_state () const;
MidiBuffer const& immediate_event_buffer () const { return _immediate_event_buffer; }

View File

@ -134,6 +134,8 @@ public:
boost::shared_ptr<MonitorControl> monitoring_control() const { return _monitoring_control; }
MonitorState monitoring_state () const;
virtual MonitorState get_auto_monitoring_state () const { return MonitoringSilence; }
virtual MeterState metering_state () const;
/* these are the core of the API of a Route. see the protected sections as well */

View File

@ -432,6 +432,7 @@ namespace ARDOUR {
MonitoringSilence = 0x1,
MonitoringInput = 0x2,
MonitoringDisk = 0x4,
MonitoringCue = 0x6,
};
enum MeterState {

View File

@ -64,6 +64,73 @@ 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 tape_machine_mode = Config->get_tape_machine_mode ();
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 (tape_machine_mode) {
return MonitoringDisk;
} else {
if (!roll && auto_input) {
return software_monitor ? MonitoringInput : MonitoringSilence;
} else {
return MonitoringDisk;
}
}
}
abort(); /* NOTREACHED */
return MonitoringSilence;
}
int
AudioTrack::set_state (const XMLNode& node, int version)
{

View File

@ -826,6 +826,13 @@ MidiTrack::monitoring_state () const
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
MidiTrack::filter_input (BufferSet& bufs)
{

View File

@ -57,6 +57,7 @@
#include "ardour/delayline.h"
#include "ardour/midi_buffer.h"
#include "ardour/midi_port.h"
#include "ardour/midi_track.h"
#include "ardour/monitor_control.h"
#include "ardour/monitor_processor.h"
#include "ardour/pannable.h"
@ -6007,67 +6008,6 @@ Route::monitoring_state () const
break;
}
/* 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 tape_machine_mode = Config->get_tape_machine_mode ();
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 (tape_machine_mode) {
return MonitoringDisk;
} else {
if (!roll && auto_input) {
return software_monitor ? MonitoringInput : MonitoringSilence;
} else {
return MonitoringDisk;
}
}
}
abort(); /* NOTREACHED */
return MonitoringSilence;
return get_auto_monitoring_state();
}
#endif