using namespace PBD;
uint32_t Route::order_key_cnt = 0;
-
+sigc::signal<void> Route::SyncOrderKeys;
Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, DataType default_type)
: IO (sess, name, input_min, input_max, output_min, output_max, default_type),
_flags (flg),
- _solo_control (X_("solo"), *this, ToggleControllable::SoloControl),
- _mute_control (X_("mute"), *this, ToggleControllable::MuteControl)
+ _solo_control (new ToggleControllable (X_("solo"), *this, ToggleControllable::SoloControl)),
+ _mute_control (new ToggleControllable (X_("mute"), *this, ToggleControllable::MuteControl))
{
init ();
}
Route::Route (Session& sess, const XMLNode& node, DataType default_type)
: IO (sess, *node.child ("IO"), default_type),
- _solo_control (X_("solo"), *this, ToggleControllable::SoloControl),
- _mute_control (X_("mute"), *this, ToggleControllable::MuteControl)
+ _solo_control (new ToggleControllable (X_("solo"), *this, ToggleControllable::SoloControl)),
+ _mute_control (new ToggleControllable (X_("mute"), *this, ToggleControllable::MuteControl))
{
init ();
_set_state (node, false);
_muted = false;
_soloed = false;
_solo_safe = false;
+ _recordable = true;
+ _active = true;
_phase_invert = false;
_denormal_protection = false;
order_keys[strdup (N_("signal"))] = order_key_cnt++;
- _active = true;
_silent = false;
_meter_point = MeterPostFader;
_initial_delay = 0;
Route::set_order_key (const char* name, long n)
{
order_keys[strdup(name)] = n;
+
+ if (Config->get_sync_all_route_ordering()) {
+ for (OrderKeys::iterator x = order_keys.begin(); x != order_keys.end(); ++x) {
+ x->second = n;
+ }
+ }
+
_session.set_dirty ();
}
+void
+Route::sync_order_keys ()
+{
+ uint32_t key;
+
+ if (order_keys.empty()) {
+ return;
+ }
+
+ OrderKeys::iterator x = order_keys.begin();
+ key = x->second;
+ ++x;
+
+ for (; x != order_keys.end(); ++x) {
+ x->second = key;
+ }
+}
+
void
Route::inc_gain (gain_t fraction, void *src)
{
if (_mix_group->is_relative()) {
-
- gain_t usable_gain = gain();
+ gain_t usable_gain = gain();
if (usable_gain < 0.000001f) {
- usable_gain=0.000001f;
+ usable_gain = 0.000001f;
}
gain_t delta = val;
if (delta < 0.000001f) {
- delta=0.000001f;
+ delta = 0.000001f;
}
delta -= usable_gain;
- if (delta == 0.0f) return;
+ if (delta == 0.0f)
+ return;
gain_t factor = delta / usable_gain;
if (factor > 0.0f) {
factor = _mix_group->get_max_factor(factor);
if (factor == 0.0f) {
- gain_changed (src);
+ _gain_control->Changed(); /* EMIT SIGNAL */
return;
}
} else {
factor = _mix_group->get_min_factor(factor);
if (factor == 0.0f) {
- gain_changed (src);
+ _gain_control->Changed(); /* EMIT SIGNAL */
return;
}
}
-------------------------------------------------------------------------------------------------- */
if (declick > 0) {
- Amp::run (bufs, nframes, 0.0, 1.0, false);
+ Amp::run_in_place (bufs, nframes, 0.0, 1.0, false);
_pending_declick = 0;
} else if (declick < 0) {
- Amp::run (bufs, nframes, 1.0, 0.0, false);
+ Amp::run_in_place (bufs, nframes, 1.0, 0.0, false);
_pending_declick = 0;
} else {
/* no global declick */
if (solo_gain != dsg) {
- Amp::run (bufs, nframes, solo_gain, dsg, false);
+ Amp::run_in_place (bufs, nframes, solo_gain, dsg, false);
solo_gain = dsg;
}
}
-------------------------------------------------------------------------------------------------- */
if (meter && (_meter_point == MeterInput)) {
- _meter->run(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
}
if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) {
- Amp::run (bufs, nframes, mute_gain, dmg, false);
+ Amp::run_in_place (bufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
for (i = _processors.begin(); i != _processors.end(); ++i) {
switch ((*i)->placement()) {
case PreFader:
- (*i)->run (bufs, start_frame, end_frame, nframes, offset);
+ (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset);
break;
case PostFader:
post_fader_work = true;
bufs.set_count(pre_fader_streams());
if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_post_fader) {
- Amp::run (bufs, nframes, mute_gain, dmg, false);
+ Amp::run_in_place (bufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
-------------------------------------------------------------------------------------------------- */
if (meter && (_meter_point == MeterPreFader)) {
- _meter->run(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
}
// OR recording
- // h/w monitoring not in use
-
- (!Config->get_monitoring_model() == HardwareMonitoring &&
-
// AND software monitoring required
- Config->get_monitoring_model() == SoftwareMonitoring)) {
+ Config->get_monitoring_model() == SoftwareMonitoring) {
if (apply_gain_automation) {
if (_gain != dg) {
- Amp::run (bufs, nframes, _gain, dg, _phase_invert);
+ Amp::run_in_place (bufs, nframes, _gain, dg, _phase_invert);
_gain = dg;
} else if (_gain != 0 && (_phase_invert || _gain != 1.0)) {
case PreFader:
break;
case PostFader:
- (*i)->run (bufs, start_frame, end_frame, nframes, offset);
+ (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset);
break;
}
}
}
if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_control_outs) {
- Amp::run (bufs, nframes, mute_gain, dmg, false);
+ Amp::run_in_place (bufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
----------------------------------------------------------------------*/
if (!_soloed && (mute_gain != dmg) && !mute_declick_applied && _mute_affects_main_outs) {
- Amp::run (bufs, nframes, mute_gain, dmg, false);
+ Amp::run_in_place (bufs, nframes, mute_gain, dmg, false);
mute_gain = dmg;
mute_declick_applied = true;
}
if ((_gain == 0 && !apply_gain_automation) || dmg == 0) {
_meter->reset();
} else {
- _meter->run(output_buffers(), start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(output_buffers(), start_frame, end_frame, nframes, offset);
}
}
}
collect_input (bufs, nframes, offset);
if (meter_first) {
- _meter->run(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
meter_first = false;
}
if (_soloed != yn) {
_soloed = yn;
solo_changed (src); /* EMIT SIGNAL */
- _solo_control.Changed (); /* EMIT SIGNAL */
+ _solo_control->Changed (); /* EMIT SIGNAL */
}
}
_muted = yn;
mute_changed (src); /* EMIT SIGNAL */
- _mute_control.Changed (); /* EMIT SIGNAL */
+ _mute_control->Changed (); /* EMIT SIGNAL */
Glib::Mutex::Lock lm (declick_lock);
desired_mute_gain = (yn?0.0f:1.0f);
for (i = iclist.begin(); i != iclist.end(); ++i) {
+ cerr << "now applying for " << (*i).processor->name() << " in = " << (*i).in.n_audio() << " out = " << (*i).out.n_audio() << endl;
+
if ((*i).processor->configure_io ((*i).in, (*i).out)) {
return -1;
}
for (i = iclist.begin(); i != iclist.end(); ++i) {
+
+ cerr << "Checking whether " << (*i).processor->name() << " can support " << required_inputs.n_audio() << " inputs\n";
+
if ((*i).processor->can_support_input_configuration (required_inputs) < 0) {
if (err) {
err->index = index;
(*i).in = required_inputs;
(*i).out = (*i).processor->output_for_input_configuration (required_inputs);
+ cerr << "config looks like " << (*i).processor->name() << " in = " << (*i).in.n_audio() << " out = " << (*i).out.n_audio() << endl;
+
required_inputs = (*i).out;
++index;
Route::state(bool full_state)
{
XMLNode *node = new XMLNode("Route");
- ProcessorList:: iterator i;
+ ProcessorList::iterator i;
char buf[32];
if (_flags) {
node->add_property ("order-keys", order_string);
node->add_child_nocopy (IO::state (full_state));
- node->add_child_nocopy (_solo_control.get_state ());
- node->add_child_nocopy (_mute_control.get_state ());
+ node->add_child_nocopy (_solo_control->get_state ());
+ node->add_child_nocopy (_mute_control->get_state ());
XMLNode* remote_control_node = new XMLNode (X_("remote_control"));
snprintf (buf, sizeof (buf), "%d", _remote_control_id);
if ((prop = node.property ("type")) != 0) {
boost::shared_ptr<Processor> processor;
+ bool have_insert = false;
- if (prop->value() == "ladspa" || prop->value() == "Ladspa" || prop->value() == "vst") {
-
+ if (prop->value() == "ladspa" || prop->value() == "Ladspa" ||
+ prop->value() == "lv2" ||
+ prop->value() == "vst" ||
+ prop->value() == "audiounit") {
+
processor.reset (new PluginInsert(_session, node));
+ have_insert = true;
} else if (prop->value() == "port") {
} else if (prop->value() == "send") {
processor.reset (new Send (_session, node));
+ have_insert = true;
} else {
error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg;
}
-
+
add_processor (processor);
} else {
error << _("Processor XML node has no type property") << endmsg;
}
}
-
+
catch (failed_constructor &err) {
warning << _("processor could not be created. Ignored.") << endmsg;
return;
if ((prop = node.property (X_("denormal-protection"))) != 0) {
set_denormal_protection (prop->value()=="yes"?true:false, this);
}
-
+
+ _active = true;
if ((prop = node.property (X_("active"))) != 0) {
set_active (prop->value() == "yes");
}
} else if (child->name() == X_("controllable") && (prop = child->property("name")) != 0) {
if (prop->value() == "solo") {
- _solo_control.set_state (*child);
- _session.add_controllable (&_solo_control);
+ _solo_control->set_state (*child);
+ _session.add_controllable (_solo_control);
}
else if (prop->value() == "mute") {
- _mute_control.set_state (*child);
- _session.add_controllable (&_mute_control);
+ _mute_control->set_state (*child);
+ _session.add_controllable (_mute_control);
}
}
else if (child->name() == X_("remote_control")) {
_control_outs = 0;
}
- if (control() || master()) {
+ if (is_control() || is_master()) {
/* no control outs for these two special busses */
return 0;
}
/* now connect to the named ports */
for (size_t n = 0; n < limit; ++n) {
- if (_control_outs->connect_output (_control_outs->output (n), ports[n], this)) {
+ if (_control_outs->connect_output (_control_outs->output (n), ports[n % ports.size()], this)) {
error << string_compose (_("could not connect %1 to %2"), _control_outs->output(n)->name(), ports[n]) << endmsg;
return -1;
}
return onoff;
}
-void
-Route::set_active (bool yn)
-{
- _active = yn;
- active_changed(); /* EMIT SIGNAL */
-}
-
void
Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_processors)
{
return 0;
}
- return max (n_inputs ().n_audio(), static_cast<size_t>(processor_max_outs.n_audio()));
+ return max (n_inputs ().n_audio(), processor_max_outs.n_audio());
}
int
if (am.locked() && _session.transport_rolling()) {
- ARDOUR::AutomationList& gain_auto = gain_automation();
-
- if (gain_auto.automation_playback()) {
- apply_gain_automation = gain_auto.curve().rt_safe_get_vector (start_frame, end_frame, _session.gain_automation_buffer(), nframes);
+ if (_gain_control->list()->automation_playback()) {
+ apply_gain_automation = _gain_control->list()->curve().rt_safe_get_vector (
+ start_frame, end_frame, _session.gain_automation_buffer(), nframes);
}
}
}