#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"
, _disk_io_point (DiskIOPreFader)
, _pending_process_reorder (0)
, _pending_signals (0)
- , _pending_declick (true)
, _meter_point (MeterPostFader)
, _pending_meter_point (MeterPostFader)
, _meter_type (MeterPeak)
, _denormal_protection (false)
, _recordable (true)
- , _declickable (false)
, _have_internal_generator (false)
, _default_type (default_type)
, _loop_location (NULL)
}
string
-Route::ensure_track_or_route_name(string name, Session &session)
+Route::ensure_track_or_route_name (string newname) const
{
- string newname = name;
-
- while (!session.io_name_is_legal (newname)) {
+ while (!_session.io_name_is_legal (newname)) {
newname = bump_name_once (newname, ' ');
+ if (newname == name()) {
+ break;
+ }
}
-
return newname;
}
// _trim_control->route_set_value (val);
}
-void
-Route::maybe_declick (BufferSet&, samplecnt_t, int)
-{
- /* this is the "bus" implementation and they never declick.
- */
- return;
-}
-
/** Process this route for one (sub) cycle (process thread)
*
* @param bufs Scratch buffers to use for the signal path
void
Route::process_output_buffers (BufferSet& bufs,
samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes,
- int declick, bool gain_automation_ok, bool run_disk_reader)
+ bool gain_automation_ok, bool run_disk_reader)
{
/* Caller must hold process lock */
assert (!AudioEngine::instance()->process_lock().trylock());
_main_outs->no_outs_cuz_we_no_monitor (silence);
- /* -------------------------------------------------------------------------------------------
- GLOBAL DECLICK (for transport changes etc.)
- ----------------------------------------------------------------------------------------- */
-
- // XXX not latency compensated. calls Amp::declick, but there may be
- // plugins between disk and Fader.
- maybe_declick (bufs, nframes, declick);
- _pending_declick = 0;
-
/* -------------------------------------------------------------------------------------------
DENORMAL CONTROL
----------------------------------------------------------------------------------------- */
}
void
-Route::monitor_run (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick)
+Route::monitor_run (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes)
{
assert (is_monitor());
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
- run_route (start_sample, end_sample, nframes, declick, true, false);
+ run_route (start_sample, end_sample, nframes, true, false);
}
void
-Route::run_route (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok, bool run_disk_reader)
+Route::run_route (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, bool gain_automation_ok, bool run_disk_reader)
{
BufferSet& bufs (_session.get_route_buffers (n_process_buffers()));
/* run processor chain */
- process_output_buffers (bufs, start_sample, end_sample, nframes, declick, gain_automation_ok, run_disk_reader);
+ process_output_buffers (bufs, start_sample, end_sample, nframes, gain_automation_ok, run_disk_reader);
/* map events (e.g. MIDI-CC) back to control-parameters */
update_controls (bufs);
}
}
+void
+Route::realtime_handle_transport_stopped ()
+{
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
+
+ /* currently only by Plugin, queue note-off events */
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ (*i)->realtime_handle_transport_stopped ();
+ }
+}
+
+
void
Route::input_change_handler (IOChange change, void * /*src*/)
{
}
int
-Route::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler)
+Route::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler)
{
Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
return 0;
}
- run_route (start_sample, end_sample, nframes, declick, (!_disk_writer || !_disk_writer->record_enabled()) && _session.transport_rolling(), true);
+ run_route (start_sample, end_sample, nframes, (!_disk_writer || !_disk_writer->record_enabled()) && _session.transport_rolling(), true);
if ((_disk_reader && _disk_reader->need_butler()) || (_disk_writer && _disk_writer->need_butler())) {
need_butler = true;
*/
}
- run_route (start_sample, end_sample, nframes, 0, false, false);
+ run_route (start_sample, end_sample, nframes, false, false);
return 0;
}
(*i)->protect_automation();
}
-/** @param declick 1 to set a pending declick fade-in,
- * -1 to set a pending declick fade-out
- */
-void
-Route::set_pending_declick (int declick)
-{
- if (_declickable) {
- /* this call is not allowed to turn off a pending declick */
- if (declick) {
- _pending_declick = declick;
- }
- } else {
- _pending_declick = 0;
- }
-}
-
/** Shift automation forwards from a particular place, thereby inserting time.
* Adds undo commands for any shifts that are performed.
*
return true;
}
- string name = Route::ensure_track_or_route_name (str, _session);
- SessionObject::set_name (name);
+ string newname = Route::ensure_track_or_route_name (str);
+
+ if (newname == name()) {
+ return true;
+ }
+
+ SessionObject::set_name (newname);
- bool ret = (_input->set_name(name) && _output->set_name(name));
+ bool ret = (_input->set_name(newname) && _output->set_name(newname));
if (ret) {
/* rename the main outs. Leave other IO processors
*/
if (_main_outs) {
- if (_main_outs->set_name (name)) {
+ if (_main_outs->set_name (newname)) {
/* XXX returning false here is stupid because
we already changed the route name.
*/
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