diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2018-02-14 18:04:57 -0600 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2018-02-14 18:04:57 -0600 |
commit | 208c781248335dda963f032fcb7e9427bb070244 (patch) | |
tree | b6d0253486929af2c5a91572a6c6bac222ca89b6 /libs/ardour/audio_track.cc | |
parent | 58002d82eaed7b0c4d388eccc93a5f638a3ff409 (diff) |
Auto-monitor == Cue for MIDI tracks.
Diffstat (limited to 'libs/ardour/audio_track.cc')
-rw-r--r-- | libs/ardour/audio_track.cc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 12c2f1975b..46aff98122 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -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) { |