21 #include "libardour-config.h"
30 #include <boost/algorithm/string.hpp>
47 #include "ardour/debug.h"
68 #include "ardour/utils.h"
76 PBD::Signal0<void> Route::SyncOrderKeys;
77 PBD::Signal0<void> Route::RemoteControlIDChange;
85 , _signal_latency_at_amp_position (0)
86 , _signal_latency_at_trim_position (0)
89 , _pending_process_reorder (0)
91 , _pending_declick (true)
96 , _soloed_by_others_upstream (0)
97 , _soloed_by_others_downstream (0)
99 , _denormal_protection (false)
102 , _declickable (false)
104 , _have_internal_generator (false)
106 , _default_type (default_type)
108 , _has_order_key (false)
109 , _remote_control_id (0)
111 , _in_configure_processors (false)
112 , _initial_io_setup (false)
113 , _custom_meter_position_noted (false)
118 processor_max_streams.reset();
152 #if 0 // not used - just yet
166 _trim->set_display_to_user (
false);
168 if (dynamic_cast<AudioTrack*>(
this)) {
185 _meter->set_display_to_user (
false);
232 (*i)->drop_references ();
279 if (notify_class_listeners) {
355 string newname =
name;
367 _amp->inc_gain (fraction, src);
378 if (usable_gain < 0.000001
f) {
379 usable_gain = 0.000001f;
383 if (delta < 0.000001
f) {
387 delta -= usable_gain;
392 gain_t factor = delta / usable_gain;
396 if (factor == 0.0
f) {
397 _amp->gain_control()->Changed();
402 if (factor == 0.0
f) {
403 _amp->gain_control()->Changed();
418 if (val ==
_amp->gain()) {
422 _amp->set_gain (val, src);
428 _trim->inc_gain (fraction, src);
435 _trim->set_gain (val, 0);
459 int declick,
bool gain_automation_ok)
464 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
473 if (gain_automation_ok) {
475 _amp->setup_gain_automation (
481 _trim->setup_gain_automation (
486 _amp->apply_gain_automation (
false);
487 _trim->apply_gain_automation (
false);
500 _main_outs->no_outs_cuz_we_no_monitor (silence);
520 Sample*
const sp = i->data();
523 for (
pframes_t nx = 0; nx < nframes; ++nx) {
528 for (
pframes_t nx = 0; nx < nframes; ++nx) {
537 Sample*
const sp = i->data();
540 for (
pframes_t nx = 0; nx < nframes; ++nx) {
552 Sample*
const sp = i->data();
553 for (
pframes_t nx = 0; nx < nframes; ++nx) {
572 if (meter_already_run && boost::dynamic_pointer_cast<PeakMeter> (*i)) {
579 if (boost::dynamic_pointer_cast<UnknownProcessor> (*i) == 0 && (*i)->input_streams() !=
ChanCount::ZERO) {
580 if (bufs.
count() != (*i)->input_streams()) {
583 "input port mismatch %1 bufs = %2 input for %3 = %4\n",
584 _name, bufs.
count(), (*i)->name(), (*i)->input_streams()
595 if (boost::dynamic_pointer_cast<Send>(*i) != 0) {
599 (*i)->run (bufs, start_frame - latency, end_frame - latency, nframes, *i !=
_processors.back());
602 if ((*i)->active ()) {
603 latency += (*i)->signal_latency ();
611 bool include_endpoint,
bool for_export,
bool for_freeze)
614 if (!endpoint && !include_endpoint) {
620 _amp->setup_gain_automation (start - latency, start - latency + nframes, nframes);
624 _trim->setup_gain_automation (start, start + nframes, nframes);
629 if (!include_endpoint && (*i) == endpoint) {
634 if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) {
637 if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) {
645 (*i)->run (buffers, start - latency, start - latency + nframes, nframes,
true);
646 buffers.
set_count ((*i)->output_streams());
647 latency += (*i)->signal_latency ();
650 if ((*i) == endpoint) {
658 bool include_endpoint,
bool for_export,
bool for_freeze)
const
661 if (!endpoint && !include_endpoint) {
666 if (!include_endpoint && (*i) == endpoint) {
669 if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) {
672 if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) {
676 latency += (*i)->signal_latency ();
678 if ((*i) == endpoint) {
687 bool include_endpoint,
bool for_export,
bool for_freeze)
const
689 if (!endpoint && !include_endpoint) {
694 if (!include_endpoint && (*i) == endpoint) {
697 if (!for_export && boost::dynamic_pointer_cast<PortInsert>(*i)) {
700 if (!for_export && for_freeze && (*i)->does_routing() && (*i)->active()) {
704 cc = (*i)->output_streams();
706 if ((*i) == endpoint) {
725 passthru (bufs, start_frame, end_frame, nframes, declick);
869 "%1 SbU delta %2 = %3 old = %4 sbd %5 ss %6 exclusive %7\n",
890 if (delta > 0 || !
Config->get_exclusive_solo()) {
892 for (FedBy::iterator i =
_fed_by.begin(); i !=
_fed_by.end(); ++i) {
953 for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
955 if ((*i).get() ==
this || (*i)->is_master() || (*i)->is_monitor() || (*i)->is_auditioner()) {
962 if (does_feed && !sends_only) {
963 (*i)->set_solo_isolated (yn, (*i)->route_group());
1018 if (
muted() != yn) {
1040 cerr << name <<
" {" << endl;
1042 p != procs.end(); ++p) {
1043 cerr <<
"\t" << (*p)->name() <<
" ID = " << (*p)->id() <<
" @ " << (*p) << endl;
1045 cerr <<
"}" << endl;
1057 ProcessorList::iterator loc;
1085 if ((*i)->display_to_user()) {
1122 assert (processor !=
_meter);
1126 "%1 adding processor %2\n",
name(), processor->
name()));
1140 if (processor ==
_amp) {
1144 if (before ==
_amp) {
1155 ProcessorList::iterator loc;
1182 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(processor)) != 0) {
1197 _output->set_user_latency (0);
1220 XMLNodeList::const_iterator i = children.begin ();
1222 while (i != children.end() && (*i)->name() !=
X_(
"Redirect")) {
1228 if (i != children.end()) {
1229 if ((prop = (*i)->property (
X_(
"placement"))) != 0) {
1234 if (node.
name() ==
"Insert") {
1236 if ((prop = node.
property (
"type")) != 0) {
1238 if (prop->
value() ==
"ladspa" || prop->
value() ==
"Ladspa" ||
1239 prop->
value() ==
"lv2" ||
1240 prop->
value() ==
"windows-vst" ||
1241 prop->
value() ==
"lxvst" ||
1242 prop->
value() ==
"audiounit") {
1253 }
else if (node.
name() ==
"Send") {
1264 if (processor->
set_state (node, version)) {
1269 if (i != children.end()) {
1270 if ((prop = (*i)->property (
X_(
"active"))) != 0) {
1278 return (
add_processor (processor, placement, 0,
false) == 0);
1282 warning <<
_(
"processor could not be created. Ignored.") <<
endmsg;
1295 ProcessorList::iterator loc;
1308 if (others.empty()) {
1317 for (ProcessorList::const_iterator i = others.begin(); i != others.end(); ++i) {
1325 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
1330 (*i)->set_owner (
this);
1332 if ((*i)->active()) {
1351 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
1359 _output->set_user_latency (0);
1390 ProcessorList::iterator
start, end;
1393 for (ProcessorList::iterator i = start; i != end; ++i) {
1394 (*i)->deactivate ();
1408 (*i)->deactivate ();
1422 ProcessorList::iterator
start, end;
1425 for (ProcessorList::iterator i = start; i != end; ++i) {
1426 if (boost::dynamic_pointer_cast<PluginInsert> (*i)) {
1427 (*i)->deactivate ();
1442 if (boost::dynamic_pointer_cast<PluginInsert> (*i)) {
1443 (*i)->deactivate ();
1463 if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) {
1467 if ((*i)->active()) {
1468 (*i)->deactivate ();
1469 (*i)->set_next_ab_is_active (
true);
1471 (*i)->set_next_ab_is_active (
false);
1481 if (!boost::dynamic_pointer_cast<PluginInsert> (*i)) {
1485 if ((*i)->get_next_ab_is_active()) {
1488 (*i)->deactivate ();
1508 if (!already_deleting) {
1517 bool seen_amp =
false;
1529 new_list.push_back (*i);
1536 new_list.push_back (*i);
1539 (*i)->drop_references ();
1547 (*i)->drop_references ();
1550 new_list.push_back (*i);
1568 if (!already_deleting) {
1579 if (need_process_lock) {
1585 if (need_process_lock) {
1604 if (need_process_lock) {
1615 ProcessorList::iterator i;
1616 bool removed =
false;
1619 if (*i == processor) {
1632 if ((iop = boost::dynamic_pointer_cast<IOProcessor> (*i)) != 0) {
1644 _output->set_user_latency (0);
1664 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
1671 if (need_process_lock) {
1700 ProcessorList::iterator i;
1716 if (find (to_be_deleted.begin(), to_be_deleted.end(), processor) == to_be_deleted.end()) {
1728 if ((iop = boost::dynamic_pointer_cast<IOProcessor> (processor)) != 0) {
1732 deleted.push_back (processor);
1736 if (deleted.empty()) {
1741 _output->set_user_latency (0);
1756 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
1767 for (ProcessorList::iterator i = deleted.begin(); i != deleted.end(); ++i) {
1768 (*i)->drop_references ();
1791 #ifndef PLATFORM_WINDOWS
1806 return _input->n_ports ();
1809 list<pair<ChanCount, ChanCount> >
1817 list<pair<ChanCount, ChanCount> >
1822 list<pair<ChanCount, ChanCount> > configuration;
1830 if (boost::dynamic_pointer_cast<UnknownProcessor> (*p)) {
1833 return list<pair<ChanCount, ChanCount> > ();
1836 if ((*p)->can_support_io_configuration(in, out)) {
1838 configuration.push_back(make_pair(in, out));
1848 return list<pair<ChanCount, ChanCount> > ();
1854 return configuration;
1864 #ifndef PLATFORM_WINDOWS
1879 if (configuration.empty ()) {
1885 bool seen_mains_out =
false;
1889 list< pair<ChanCount,ChanCount> >::iterator c = configuration.begin();
1892 if (boost::dynamic_pointer_cast<UnknownProcessor> (*p)) {
1896 (*p)->configure_io(c->first, c->second);
1901 if (boost::dynamic_pointer_cast<Delivery> (*p)
1902 && boost::dynamic_pointer_cast<Delivery> (*p)->role() ==
Delivery::Main) {
1907 seen_mains_out =
true;
1909 if (!seen_mains_out) {
1950 (*i)->deactivate ();
1966 for (ProcessorList::const_iterator j = new_order.begin(); j != new_order.end(); ++j) {
1968 if (c != (*j)->input_streams()) {
1974 if ((*i)->input_streams() != c) {
1977 c = (*i)->output_streams();
1989 __attribute__((annotate(
"realtime")))
2017 ProcessorList::iterator oiter;
2018 ProcessorList::const_iterator niter;
2021 niter = new_order.begin();
2023 while (niter != new_order.end()) {
2038 as_it_will_be.insert (as_it_will_be.end(), niter, new_order.end());
2039 while (niter != new_order.end()) {
2046 if (!(*oiter)->display_to_user()) {
2048 as_it_will_be.push_back (*oiter);
2054 if (find (new_order.begin(), new_order.end(), (*oiter)) == new_order.end()) {
2058 as_it_will_be.push_back (*niter);
2068 _processors.insert (oiter, as_it_will_be.begin(), as_it_will_be.end());
2139 return state(
false);
2146 ProcessorList::iterator i;
2149 id().
print (buf,
sizeof (buf));
2171 snprintf (buf,
sizeof (buf),
"%d",
_order_key);
2218 if ((is = boost::dynamic_pointer_cast<InternalSend> (*i)) != 0) {
2234 after->
id().
print (buf,
sizeof (buf));
2235 node->
add_property (
X_(
"processor-after-last-custom-meter"), buf);
2245 if (version < 3000) {
2254 if (node.
name() !=
"Route"){
2259 if ((prop = node.
property (
X_(
"name"))) != 0) {
2266 if ((prop = node.
property (
X_(
"flags"))) != 0) {
2287 XMLNode processor_state (
X_(
"processor_state"));
2291 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
2296 if ((prop = child->
property (
X_(
"direction"))) == 0) {
2300 if (prop->
value() ==
"Input") {
2301 _input->set_state (*child, version);
2302 }
else if (prop->
value() ==
"Output") {
2303 _output->set_state (*child, version);
2307 if (child->
name() ==
X_(
"Processor")) {
2311 if (child->
name() ==
X_(
"Pannable")) {
2320 if ((prop = node.
property (
X_(
"meter-point"))) != 0) {
2328 if ((prop = node.
property (
X_(
"meter-type"))) != 0) {
2339 if ((prop = node.
property (
"self-solo")) != 0) {
2343 if ((prop = node.
property (
"soloed-by-upstream")) != 0) {
2348 if ((prop = node.
property (
"soloed-by-downstream")) != 0) {
2353 if ((prop = node.
property (
"solo-isolated")) != 0) {
2357 if ((prop = node.
property (
"solo-safe")) != 0) {
2361 if ((prop = node.
property (
X_(
"phase-invert"))) != 0) {
2365 if ((prop = node.
property (
X_(
"denormal-protection"))) != 0) {
2369 if ((prop = node.
property (
X_(
"active"))) != 0) {
2375 if ((prop = node.
property (
X_(
"order-key"))) != 0) {
2379 if ((prop = node.
property (
X_(
"order-keys"))) != 0) {
2383 string::size_type colon, equal;
2384 string remaining = prop->
value();
2386 while (remaining.length()) {
2388 if ((equal = remaining.find_first_of (
'=')) == string::npos || equal == remaining.length()) {
2389 error <<
string_compose (
_(
"badly formed order key string in state file! [%1] ... ignored."), remaining)
2392 if (sscanf (remaining.substr (equal+1).c_str(),
"%d", &n) != 1) {
2393 error <<
string_compose (
_(
"badly formed order key string in state file! [%1] ... ignored."), remaining)
2396 string keyname = remaining.substr (0, equal);
2398 if ((keyname ==
"EditorSort") || (keyname ==
"editor")) {
2399 cerr <<
"Setting " <<
name() <<
" order key to " << n <<
" using saved Editor order." << endl;
2405 colon = remaining.find_first_of (
':');
2407 if (colon != string::npos) {
2408 remaining = remaining.substr (colon+1);
2415 if ((prop = node.
property (
X_(
"processor-after-last-custom-meter"))) != 0) {
2418 ProcessorList::const_iterator i =
_processors.begin ();
2429 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
2432 if (child->
name() ==
X_(
"Comment")) {
2440 if (prop->value() ==
"solo") {
2442 }
else if (prop->value() ==
"mute") {
2446 }
else if (child->
name() ==
X_(
"RemoteControl")) {
2447 if ((prop = child->
property (
X_(
"id"))) != 0) {
2449 sscanf (prop->value().c_str(),
"%d", &x);
2453 }
else if (child->
name() ==
X_(
"MuteMaster")) {
2479 if (node.
name() !=
"Route") {
2484 if ((prop = node.
property (
X_(
"flags"))) != 0) {
2485 string f = prop->
value ();
2496 if ((prop = node.
property (
X_(
"phase-invert"))) != 0) {
2497 boost::dynamic_bitset<> p (
_input->n_ports().n_audio ());
2504 if ((prop = node.
property (
X_(
"denormal-protection"))) != 0) {
2508 if ((prop = node.
property (
X_(
"soloed"))) != 0) {
2516 if ((prop = node.
property (
X_(
"muted"))) != 0) {
2525 if ((prop = node.
property (
X_(
"mute-affects-pre-fader"))) != 0) {
2528 mute_point = mute_point +
"PreFader";
2533 if ((prop = node.
property (
X_(
"mute-affects-post-fader"))) != 0) {
2538 mute_point = mute_point +
",";
2541 mute_point = mute_point +
"PostFader";
2546 if ((prop = node.
property (
X_(
"mute-affects-control-outs"))) != 0) {
2551 mute_point = mute_point +
",";
2554 mute_point = mute_point +
"Listen";
2559 if ((prop = node.
property (
X_(
"mute-affects-main-outs"))) != 0) {
2564 mute_point = mute_point +
",";
2567 mute_point = mute_point +
"Main";
2576 if ((prop = node.
property (
X_(
"meter-point"))) != 0) {
2584 if ((prop = node.
property (
X_(
"order-keys"))) != 0) {
2588 string::size_type colon, equal;
2589 string remaining = prop->
value();
2591 while (remaining.length()) {
2593 if ((equal = remaining.find_first_of (
'=')) == string::npos || equal == remaining.length()) {
2594 error <<
string_compose (
_(
"badly formed order key string in state file! [%1] ... ignored."), remaining)
2597 if (sscanf (remaining.substr (equal+1).c_str(),
"%d", &n) != 1) {
2598 error <<
string_compose (
_(
"badly formed order key string in state file! [%1] ... ignored."), remaining)
2601 string keyname = remaining.substr (0, equal);
2603 if (keyname ==
"EditorSort" || keyname ==
"editor") {
2610 colon = remaining.find_first_of (
':');
2612 if (colon != string::npos) {
2613 remaining = remaining.substr (colon+1);
2623 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
2633 _input->set_state_2X (*child, version,
true);
2634 _output->set_state_2X (*child, version,
false);
2636 if ((prop = child->
property (
X_(
"name"))) != 0) {
2642 if ((prop = child->
property (
X_(
"active"))) != 0) {
2648 if ((prop = child->
property (
X_(
"gain"))) != 0) {
2651 if (sscanf (prop->
value().c_str(),
"%f", &val) == 1) {
2652 _amp->gain_control()->set_value (val);
2662 for (io_niter = io_nlist.begin(); io_niter != io_nlist.end(); ++io_niter) {
2664 io_child = *io_niter;
2666 if (io_child->
name() ==
X_(
"Panner")) {
2667 _main_outs->panner_shell()->set_state(*io_child, version);
2668 }
else if (io_child->
name() ==
X_(
"Automation")) {
2678 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
2682 if (child->
name() ==
X_(
"Send") || child->
name() ==
X_(
"Insert")) {
2683 redirect_nodes.push_back(child);
2692 for (niter = nlist.begin(); niter != nlist.end(); ++niter){
2695 if (child->
name() ==
X_(
"Comment")) {
2703 if (prop->value() ==
X_(
"solo")) {
2705 }
else if (prop->value() ==
X_(
"mute")) {
2709 }
else if (child->
name() ==
X_(
"RemoteControl")) {
2710 if ((prop = child->
property (
X_(
"id"))) != 0) {
2712 sscanf (prop->value().c_str(),
"%d", &x);
2753 bool must_configure =
false;
2755 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
2759 if (prop->
value() ==
"amp") {
2761 new_order.push_back (
_amp);
2762 }
else if (prop->
value() ==
"trim") {
2764 new_order.push_back (
_trim);
2765 }
else if (prop->
value() ==
"meter") {
2767 new_order.push_back (
_meter);
2768 }
else if (prop->
value() ==
"delay") {
2773 }
else if (prop->
value() ==
"main-outs") {
2775 }
else if (prop->
value() ==
"intreturn") {
2778 must_configure =
true;
2784 must_configure =
true;
2787 }
else if (prop->
value() ==
"capture") {
2791 ProcessorList::iterator o;
2795 if (id_prop && (*o)->id() == id_prop->
value()) {
2797 new_order.push_back (*o);
2808 if (prop->
value() ==
"intsend") {
2812 }
else if (prop->
value() ==
"ladspa" || prop->
value() ==
"Ladspa" ||
2813 prop->
value() ==
"lv2" ||
2814 prop->
value() ==
"windows-vst" ||
2815 prop->
value() ==
"lxvst" ||
2816 prop->
value() ==
"audiounit") {
2820 }
else if (prop->
value() ==
"port") {
2824 }
else if (prop->
value() ==
"send") {
2850 new_order.push_back (processor);
2851 must_configure =
true;
2861 if (must_configure) {
2867 (*i)->set_owner (
this);
2872 if ((pi = boost::dynamic_pointer_cast<PluginInsert>(*i)) != 0) {
2896 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
2916 if (!
_active && (pi = boost::dynamic_pointer_cast<PluginInsert> (*i)) != 0) {
2921 (*i)->silence (nframes);
3033 ProcessorList::iterator tmp;
3079 pair<FedBy::iterator,bool> result =
_fed_by.insert (fr);
3081 if (!result.second) {
3084 if (!via_sends_only && result.first->sends_only) {
3090 return result.second;
3104 for (FedBy::const_iterator
f =
fed_by.begin();
f !=
fed_by.end(); ++
f) {
3107 if (sr && (sr.
get() ==
this)) {
3109 if (via_sends_only) {
3110 *via_sends_only =
f->sends_only;
3127 if (via_send_only) {
3128 *via_send_only =
false;
3139 if ((iop = boost::dynamic_pointer_cast<IOProcessor>(*r)) != 0) {
3140 if (iop->
feeds (other)) {
3142 if (via_send_only) {
3143 *via_send_only =
true;
3182 (*i)->transport_stopped (now);
3192 bool need_to_queue_solo_change =
true;
3198 need_to_queue_solo_change =
false;
3205 if (need_to_queue_solo_change) {
3216 bool need_to_queue_solo_change =
true;
3225 need_to_queue_solo_change =
false;
3236 if (need_to_queue_solo_change) {
3269 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
3284 if (session_state_changing) {
3304 _meter->run (bufs, start_frame, end_frame, nframes,
true);
3307 _amp->apply_gain_automation (
false);
3308 _trim->apply_gain_automation (
false);
3309 passthru (bufs, start_frame, end_frame, nframes, 0);
3317 Glib::Threads::RWLock::ReaderLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
3344 _meter->run (bufs, start_frame, end_frame, nframes,
true);
3347 passthru (bufs, start_frame, end_frame, nframes, declick);
3374 __attribute__((annotate(
"realtime")))
3382 Glib::Threads::RWLock::WriterLock pwl (
_processor_lock, Glib::Threads::TRY_LOCK);
3397 Glib::Threads::RWLock::WriterLock pwl (
_processor_lock, Glib::Threads::TRY_LOCK);
3409 if (emissions != 0) {
3422 _meter->emit_configuration_changed();
3446 _meter->emit_configuration_changed();
3460 __attribute__((annotate(
"realtime")))
3468 Glib::Threads::RWLock::WriterLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
3469 assert (!lm.locked ());
3474 bool meter_was_visible_to_user =
_meter->display_to_user ();
3482 _meter->set_display_to_user (
false);
3487 _meter->set_display_to_user (
true);
3511 m_in =
_input->n_ports();
3513 ProcessorList::iterator before = loc;
3515 m_in = (*before)->output_streams ();
3518 _meter->reflect_inputs (m_in);
3530 return (
_meter->display_to_user() != meter_was_visible_to_user);
3576 bool before_amp =
true;
3578 bool before_trim =
true;
3581 if ((*i)->active ()) {
3582 l += (*i)->signal_latency ();
3587 if ((*i) ==
_trim) {
3615 _output->set_user_latency (nframes);
3631 "%1: compensate for maximum latency of %2,"
3632 "given own latency of %3, using initial delay of %4\n",
3659 const bool bval = ((val >= 0.5) ?
true :
false);
3670 if (
Config->get_solo_control_is_listen_control()) {
3685 if (
Config->get_solo_control_is_listen_control()) {
3719 const bool bval = ((val >= 0.5) ?
true :
false);
3737 set_superficial_value(bval);
3757 (*i)->set_block_size (nframes);
3767 (*i)->protect_automation();
3820 ControlSet::Controls& c (
_pannable->controls());
3822 for (ControlSet::Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) {
3827 al->
shift (pos, frames);
3839 set<Evoral::Parameter> parameters = (*i)->what_can_be_automated();
3841 for (set<Evoral::Parameter>::const_iterator p = parameters.begin (); p != parameters.end (); ++p) {
3846 al->
shift (pos, frames);
3865 return tree.
write (path.c_str());
3872 if (str ==
name()) {
3879 bool ret = (
_input->set_name(name) &&
_output->set_name(name));
3911 for (
XMLNodeIterator i = children.begin(); i != children.end(); ++i) {
3913 if ((*i)->name() ==
X_(
"IO")) {
3917 }
else if ((*i)->name() ==
X_(
"Processor")) {
3920 if (role && role->
value() ==
X_(
"Main")) {
3921 (*i)->add_property (
X_(
"name"), name);
3924 }
else if ((*i)->name() ==
X_(
"Diskstream")) {
3926 (*i)->add_property (
X_(
"playlist"),
string_compose (
"%1.1", name).c_str());
3927 (*i)->add_property (
X_(
"name"), name);
3941 if ((send = boost::dynamic_pointer_cast<InternalSend>(*i)) != 0) {
3980 boost::dynamic_bitset<>
4044 return _amp->gain_control();
4060 if ((c = boost::dynamic_pointer_cast<AutomationControl>((*i)->control (param))) != 0) {
4081 ProcessorList::iterator i;
4084 if (boost::dynamic_pointer_cast<PluginInsert> (*i)) {
4098 ProcessorList::iterator i;
4101 if (boost::dynamic_pointer_cast<Send> (*i)) {
4115 ProcessorList::iterator i;
4118 if (boost::dynamic_pointer_cast<Send> (*i) ||
4120 if ((*i)->name() ==
name) {
4140 bool had_amp =
false;
4142 (*i)->set_pre_fader (!had_amp);
4143 if (boost::dynamic_pointer_cast<Amp> (*i)) {
4185 if (boost::dynamic_pointer_cast<UnknownProcessor const> (*i)) {
4186 p.push_back ((*i)->name ());
4204 all_connections.
min = 0;
4205 all_connections.
max = 0;
4208 all_connections.
max = 0;
4218 p->get_connected_latency_range (range, playback);
4220 all_connections.
min = min (all_connections.
min, range.
min);
4221 all_connections.
max = max (all_connections.
max, range.
max);
4228 p->set_private_latency_range (all_connections, playback);
4233 all_connections.
min += our_latency;
4234 all_connections.
max += our_latency;
4237 p->set_private_latency_range (all_connections, playback);
4240 return all_connections.
max;
4260 if ((*i)->active ()) {
4261 own_latency += (*i)->signal_latency ();
4289 p->set_public_latency_range (range, playback);
4296 p->set_public_latency_range (range, playback);
4305 __attribute__((annotate(
"realtime")))
4311 Glib::Threads::RWLock::WriterLock lm (
_processor_lock, Glib::Threads::TRY_LOCK);
4312 assert (!lm.locked ());
4330 if ((*i)->display_to_user ()) {
4331 new_processors.push_back (*i);
4337 ProcessorList::iterator
amp = new_processors.begin ();
4342 assert (amp != new_processors.end ());
4346 ProcessorList::iterator after_amp =
amp;
4354 assert (!
_meter->display_to_user ());
4355 new_processors.push_front (
_meter);
4358 assert (!
_meter->display_to_user ());
4359 new_processors.insert (amp,
_meter);
4381 ProcessorList::iterator
main = new_processors.end();
4387 assert (!
_meter->display_to_user ());
4396 new_processors.insert (meter_point,
_meter);
4403 if (
Config->get_solo_control_is_listen_control()) {
4404 switch (
Config->get_listen_position ()) {
4406 switch (
Config->get_pfl_position ()) {
4417 switch (
Config->get_afl_position ()) {
4422 new_processors.insert (new_processors.end(),
_monitor_send);
4429 new_processors.insert (new_processors.end(),
_monitor_send);
4434 #if 0 // not used - just yet
4459 assert (!
_trim->display_to_user ());
4460 new_processors.push_front (
_trim);
4511 bool seen_trim =
false;
4514 if ((*i) ==
_trim) {
4521 if (boost::dynamic_pointer_cast<PeakMeter> (*i)) {
4525 ProcessorList::iterator j = i;
4541 if ((*i)->id() ==
id) {
4576 if ((*i)->active() && (*i) !=
_main_outs && (*i)->does_routing()) {
4595 if (boost::dynamic_pointer_cast<PluginInsert>(*i)) {
4596 if ((*i)->input_streams().n_midi() > 0 &&
4597 (*i)->output_streams().n_audio() > 0) {
4623 (*i)->transport_located (pos);
4642 for (i = 0; i < n_buffers; ++i) {
4650 buf.silence (nframes);
4659 float scaling = 1.0f;
4661 if (n_ports > n_buffers) {
4662 scaling = ((float) n_buffers) / n_ports;
4665 for (i = 0; i < n_ports; ++i) {
4675 if (i < n_buffers) {
4683 if (scaling != 1.0
f) {
4684 buf.apply_gain (scaling, nframes);
4693 if (scaling != 1.0
f) {
4694 buf.accumulate_with_gain_from (source_port->
get_audio_buffer (nframes), nframes, 0, scaling);
4703 for (; i < n_buffers; ++i) {
bool transport_rolling() const
uint32_t pans_required() const
boost::shared_ptr< Pannable > _pannable
gain_t get_max_factor(gain_t factor)
void set_order_key(uint32_t)
PBD::Signal0< void > initial_delay_changed
virtual int roll(pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool &need_butler)
bool _in_configure_processors
XMLNodeList::iterator XMLNodeIterator
static const SessionEvent::RTeventCallback rt_cleanup
ARDOUR::Session & _session
std::string to_string(T t, std::ios_base &(*f)(std::ios_base &))
bool soloed_by_others_downstream() const
int atoi(const string &s)
static std::string ensure_track_or_route_name(std::string, Session &)
void set_listen(boost::shared_ptr< RouteList >, bool, SessionEvent::RTeventCallback after=rt_cleanup, bool group_override=false)
ProcessorList _pending_processor_order
void set_mute(bool yn, void *src)
MidiBuffer & get_midi(size_t i)
void set_listen(bool yn, void *src)
boost::shared_ptr< Evoral::Control > control_factory(const Evoral::Parameter &id)
AudioBuffer & get_audio_buffer(pframes_t nframes)
const std::string & content() const
void add_send(InternalSend *)
LIBARDOUR_API uint64_t Latency
void maybe_note_meter_position()
boost::shared_ptr< Delivery > _main_outs
MeterPoint meter_point() const
void set_solo(boost::shared_ptr< RouteList >, bool, SessionEvent::RTeventCallback after=rt_cleanup, bool group_override=false)
const std::string & value() const
boost::shared_ptr< Send > internal_send_for(boost::shared_ptr< const Route > target) const
void set_mute_points(MuteMaster::MutePoint)
boost::shared_ptr< Amp > amp() const
static bool get_disable_all_loaded_plugins()
virtual MeterState metering_state() const
void save_extra_xml(const XMLNode &)
double transport_speed() const
void set_user_latency(framecnt_t)
LIBARDOUR_API uint64_t Destruction
virtual void transport_stopped(framepos_t now)
Session & session() const
boost::shared_ptr< Amp > _amp
void set_count(const ChanCount &count)
int add_processors(const ProcessorList &, boost::shared_ptr< Processor >, ProcessorStreams *err=0)
boost::shared_ptr< AutomationControl > get_control(const Evoral::Parameter ¶m)
virtual XMLNode & get_template()
bool processors_reorder_needs_configure(const ProcessorList &new_order)
int add_processor_by_index(boost::shared_ptr< Processor >, int, ProcessorStreams *err=0, bool activation_allowed=true)
framecnt_t update_port_latencies(PortSet &ports, PortSet &feeders, bool playback, framecnt_t) const
const char * to_string() const
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r)
std::list< std::pair< ChanCount, ChanCount > > try_configure_processors(ChanCount, ProcessorStreams *)
void set_gain(gain_t val, void *src)
PBD::Signal0< void > meter_change
boost::dynamic_bitset phase_invert() const
const std::string & name() const
virtual void set_block_size(pframes_t nframes)
boost::shared_ptr< MonitorProcessor > _monitor_control
bool direct_feeds_according_to_reality(boost::shared_ptr< Route >, bool *via_send_only=0)
boost::shared_ptr< Pannable > pannable() const
PBD::Signal1< void, void * > comment_changed
void add_command(Command *const cmd)
void set_owner(SessionObject *)
void passthru(BufferSet &, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick)
MeterPoint _pending_meter_point
void remove_send_from_internal_return(InternalSend *)
virtual void nonrealtime_handle_transport_stopped(bool abort, bool did_locate, bool flush_processors)
const FedBy & fed_by() const
boost::shared_ptr< Control > control(const Parameter &id, bool create_if_missing=false)
boost::shared_ptr< AutomationControl > gain_control() const
PBD::Signal0< void > io_changed
void set_interpolation(InterpolationStyle)
gain_t * trim_automation_buffer() const
meter the input IO, regardless of what is going through the route
iterator end(DataType type=DataType::NIL)
XMLNode * add_child_copy(const XMLNode &)
bool set_meter_point_unlocked()
bool is_auditioning() const
LIBARDOUR_API uint64_t OrderKeys
LIBPBD_API Transmitter error
int main(int argc, char *argv[])
LIBPBD_API Transmitter warning
int remove_processor(boost::shared_ptr< Processor >, ProcessorStreams *err=0, bool need_process_lock=true)
const XMLNodeList & children(const std::string &str=std::string()) const
void set_solo_isolated(bool yn, void *src)
MuteControllable(std::string name, boost::shared_ptr< Route >)
bool _have_internal_generator
void set_deletion_in_progress()
ProcessorList _processors
bool set_name(const std::string &str)
bool has_io_processor_named(const std::string &)
void set_solo_safe(bool yn, void *src)
boost::shared_ptr< Panner > panner() const
void silence_unlocked(framecnt_t)
bool is_auditioner() const
int save_as_template(const std::string &path, const std::string &name)
std::ostream & endmsg(std::ostream &ostr)
bool feeds(boost::shared_ptr< Route >, bool *via_send_only=0)
void remove_aux_or_listen(boost::shared_ptr< Route >)
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
InstrumentInfo _instrument_info
XMLNode * add_child(const char *)
PBD::Signal1< void, void * > solo_isolated_changed
meter what is going through the route
static AudioEngine * instance()
int add_aux_send(boost::shared_ptr< Route >, boost::shared_ptr< Processor >)
int set_state(const XMLNode &, int version)
uint32_t _soloed_by_others_upstream
LIBPBD_API int replace_all(std::string &str, const std::string &target, const std::string &replacement)
AudioBuffer & get_audio(size_t i)
boost::shared_ptr< DelayLine > _delayline
virtual void maybe_declick(BufferSet &, framecnt_t, int)
bool direct_feeds_according_to_graph(boost::shared_ptr< Route >, bool *via_send_only=0)
virtual void add_control(boost::shared_ptr< Evoral::Control >)
virtual void write_out_of_band_data(BufferSet &, framepos_t, framepos_t, framecnt_t)
static PBD::Signal0< void > RemoteControlIDChange
void add_internal_return()
boost::weak_ptr< Processor > _processor_after_last_custom_meter
boost::shared_ptr< PeakMeter > _meter
boost::shared_ptr< Processor > nth_send(uint32_t n)
boost::shared_ptr< AudioPort > audio(uint32_t n) const
void set_remote_control_id(uint32_t id, bool notify_class_listeners=true)
std::list< XMLNode * > XMLNodeList
framecnt_t _signal_latency_at_trim_position
bool input_port_count_changing(ChanCount)
void set_denormal_protection(bool yn)
virtual void non_realtime_locate(framepos_t)
void set_self_solo(bool yn)
virtual void deactivate()
ChanCount processor_out_streams
boost::shared_ptr< MuteControllable > _mute_control
MuteMaster::MutePoint mute_points() const
RouteGroup * _route_group
virtual void set_latency_compensation(framecnt_t)
void silence(framecnt_t nframes, framecnt_t offset)
bool add_processor_from_xml_2X(const XMLNode &, int)
PBD::Signal1< void, void * > solo_safe_changed
boost::shared_ptr< InternalReturn > _intreturn
const ChanCount & n_ports() const
bool denormal_protection() const
bool io_name_is_legal(const std::string &)
virtual ChanCount input_streams() const
static int current_state_version
int add_processor(boost::shared_ptr< Processor >, Placement placement, ProcessorStreams *err=0, bool activation_allowed=true)
void protect_automation()
boost::shared_ptr< Processor > before_processor_for_index(int)
XMLProperty * property(const char *)
uint32_t order_key() const
LIBARDOUR_API RCConfiguration * Config
boost::shared_ptr< IO > _output
virtual void act_on_mute()
#define string_2_enum(str, e)
void silence(framecnt_t len, framecnt_t offset=0)
bool listening_via_monitor() const
enum ARDOUR::IOChange::Type type
boost::shared_ptr< Processor > the_instrument_unlocked() const
XMLNode * set_root(XMLNode *n)
int set_state_2X(const XMLNode &, int)
PBD::Signal0< void > RemoteControlIDChanged
void disable_processors()
XMLNode & get_processor_state()
bool string_is_affirmative(const std::string &str)
void set_meter_point(MeterPoint, bool force=false)
boost::shared_ptr< InternalSend > _monitor_send
audio_iterator audio_begin()
LIBARDOUR_API uint64_t Solo
framepos_t transport_frame() const
void shift(framepos_t, framecnt_t)
void set_solo(bool yn, void *src)
void set_phase_invert(uint32_t, bool yn)
void all_visible_processors_active(bool)
const PBD::ID & id() const
virtual bool set_name(const std::string &str)
bool _custom_meter_position_noted
PBD::Signal0< void > denormal_protection_changed
void print(char *buf, uint32_t bufsize) const
bool set_id(const XMLNode &)
ChanCount n_outputs() const
bool is_route_active() const
PBD::Signal0< void > active_changed
boost::dynamic_bitset _phase_invert
uint32_t _remote_control_id
boost::shared_ptr< MidiPort > midi(uint32_t n) const
boost::shared_ptr< Processor > nth_plugin(uint32_t n)
void output_change_handler(IOChange, void *src)
bool deletion_in_progress() const
PBD::Signal1< void, void * > listen_changed
ChanCount processor_max_streams
uint32_t _soloed_by_others_downstream
framecnt_t _signal_latency
void remove_send(InternalSend *)
boost::shared_ptr< RouteList > get_routes() const
#define DEBUG_TRACE(bits, str)
static ChanCount max(const ChanCount &a, const ChanCount &b)
framecnt_t update_signal_latency()
LIBARDOUR_API uint64_t Graph
bool _denormal_protection
int remove_processors(const ProcessorList &, ProcessorStreams *err=0)
boost::shared_ptr< SoloControllable > _solo_control
MidiBuffer & get_midi_buffer(pframes_t nframes)
void mod_solo_by_others_upstream(int32_t)
audio_iterator audio_end()
bool add_fed_by(boost::shared_ptr< Route >, bool sends_only)
void passthru_silence(framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick)
void update_latency_compensation(bool force=false)
int configure_processors(ProcessorStreams *)
boost::shared_ptr< PannerShell > panner_shell() const
PBD::Property< std::string > _name
void clear_deletion_in_progress()
boost::shared_ptr< Processor > the_instrument() const
int configure_processors_unlocked(ProcessorStreams *)
ChanCount n_inputs() const
LIBPBD_API Transmitter info
PBD::Signal0< void > mute_points_changed
PBD::Signal2< void, bool, void * > solo_changed
void set_list(boost::shared_ptr< Evoral::ControlList >)
void copy(const MidiBuffer ©)
int set_automation_xml_state(const XMLNode &, Evoral::Parameter default_param)
LIBARDOUR_API uint64_t Processors
virtual bool feeds(boost::shared_ptr< Route > other) const
virtual MonitorState monitoring_state() const
void inc_trim(gain_t delta, void *src)
static const std::string xml_node_name
void set_internal_instrument(boost::shared_ptr< ARDOUR::Processor >)
LIBARDOUR_API std::string bump_name_once(const std::string &s, char delimiter)
void set_public_port_latencies(framecnt_t, bool playback) const
XMLProperty * add_property(const char *name, const std::string &value)
virtual void set_processor_state(const XMLNode &)
SoloControllable(std::string name, boost::shared_ptr< Route >)
void set_delay_in(framecnt_t)
boost::shared_ptr< Amp > _trim
void inc_gain(gain_t delta, void *src)
ChanCount count
Input requested of processor.
BufferSet & get_route_buffers(ChanCount count=ChanCount::ZERO, bool silence=true)
void input_change_handler(IOChange, void *src)
boost::shared_ptr< IO > _input
std::list< std::pair< ChanCount, ChanCount > > try_configure_processors_unlocked(ChanCount, ProcessorStreams *)
void setup_invisible_processors()
void monitor_run(framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick)
uint32_t index
Index of processor where configuration failed.
bool transport_stopped() const
PBD::Signal1< void, RouteProcessorChange > processors_changed
framecnt_t bounce_get_latency(boost::shared_ptr< Processor > endpoint, bool include_endpoint, bool for_export, bool for_freeze) const
void enable_monitor_send()
virtual void set_pending_declick(int)
void shift(double before, double distance)
void add_child_nocopy(XMLNode &)
virtual int set_state(const XMLNode &, int version)
void set_active(bool yn, void *)
uint32_t get(DataType t) const
void set_superficial_value(bool muted)
bool soloed_by_others_upstream() const
virtual int no_roll(pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing)
static void set_name_in_state(XMLNode &, const std::string &)
static void set_name_in_state(XMLNode &, const std::string &)
pframes_t get_block_size() const
PBD::Signal1< void, void * > mute_changed
void reset_monitor_section()
boost::shared_ptr< CapturingProcessor > add_export_point()
void set_comment(std::string str, void *src)
XMLNode * add_content(const std::string &s=std::string())
void placement_range(Placement p, ProcessorList::iterator &start, ProcessorList::iterator &end)
const ChanCount & count() const
std::list< std::string > unknown_processors() const
std::list< boost::shared_ptr< Processor > > ProcessorList
void listen_position_changed()
PBD::Signal0< void > ActiveChanged
framecnt_t _signal_latency_at_amp_position
int reorder_processors(const ProcessorList &new_order, ProcessorStreams *err=0)
void set_trim(gain_t val, void *src)
std::set< FeedRecord, FeedRecordCompare > FedBy
void cancel_solo_after_disconnect(boost::shared_ptr< Route >, bool upstream, SessionEvent::RTeventCallback after=rt_cleanup)
bool output_port_count_changing(ChanCount)
boost::shared_ptr< IO > input() const
static const std::string state_node_name
bool set_count(uint32_t num)
virtual framecnt_t check_initial_delay(framecnt_t nframes, framepos_t &)
bool apply_processor_changes_rt()
XMLNode & get_automation_xml_state()
virtual XMLNode & state(bool)
virtual void process_output_buffers(BufferSet &bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick, bool gain_automation_ok)
boost::shared_ptr< MuteMaster > _mute_master
void cancel_solo_after_disconnect(bool upstream)
boost::shared_ptr< AutomationList > alist() const
virtual int silent_roll(pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool &need_butler)
gain_t * gain_automation_buffer() const
void ensure_buffers(ChanCount howmany=ChanCount::ZERO)
uint32_t remote_control_id() const
framecnt_t _initial_delay
boost::shared_ptr< Processor > before_processor_for_placement(Placement)
Glib::Threads::RWLock _processor_lock
void set_mute_master_solo()
void ab_plugins(bool forward)
void emit_pending_signals()
void set_processor_state_2X(XMLNodeList const &, int)
gint _pending_process_reorder
boost::shared_ptr< Route > target_route() const
GraphEdges _current_route_graph
void apply_processor_order(const ProcessorList &new_order)
void reset_instrument_info()
void set_remote_control_id_explicit(uint32_t order_key)
void mod_solo_by_others_downstream(int32_t)
bool has_no_inputs() const
void set_processor_positions()
gain_t get_min_factor(gain_t factor)
iterator begin(DataType type=DataType::NIL)
void read_from(const Sample *src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)
framecnt_t set_private_port_latencies(bool playback) const
boost::shared_ptr< Processor > processor_by_id(PBD::ID) const
boost::shared_ptr< CapturingProcessor > _capturing_processor
static const ChanCount ZERO
std::list< boost::shared_ptr< Route > > RouteList
XMLNodeList::const_iterator XMLNodeConstIterator
void fill_buffers_with_input(BufferSet &bufs, boost::shared_ptr< IO > io, pframes_t nframes)
ChanCount bounce_get_output_streams(ChanCount &cc, boost::shared_ptr< Processor > endpoint, bool include_endpoint, bool for_export, bool for_freeze) const
PBD::Signal0< void > phase_invert_changed
boost::shared_ptr< Route > monitor_out() const
virtual void bounce_process(BufferSet &bufs, framepos_t start_frame, framecnt_t nframes, boost::shared_ptr< Processor > endpoint, bool include_endpoint, bool for_export, bool for_freeze)
LIBARDOUR_API bool init(bool with_vst, bool try_optimization, const char *localedir)
bool solo_isolated() const
ChanCount n_process_buffers()
void add_send_to_internal_return(InternalSend *)
static const std::string xml_node_name
bool has(GraphVertex from, GraphVertex to, bool *via_sends_only)
std::string string_compose(const std::string &fmt, const T1 &o1)
void foreach_route(Function f)
void set_mute(boost::shared_ptr< RouteList >, bool, SessionEvent::RTeventCallback after=rt_cleanup, bool group_override=false)
bool has_order_key() const
void set_remote_control_id_internal(uint32_t id, bool notify_class_listeners=true)
PBD::Signal0< void > signal_latency_changed
void clear_processors(Placement)
bool has_external_redirects() const