mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
triggerbox: rename sidechain port when track's name chanes
Just like PluginInsert::update_sidechain_name, the name is implicitly set, using the owning route's name, suffixed with the [i18n localized] Processor name. This fixes an issue if a track is renamed and a new track with the old name is created. This commonly happens during File Import: For each ImportAsTrack a generic named track (e.g. "Audio") is created before it is renamed. Previously this lead to Failed to register port "Audio 1-trig/midi_in 1", reason is unknown from here
This commit is contained in:
parent
0e5b259cf0
commit
b72268f6e1
4 changed files with 28 additions and 16 deletions
|
|
@ -541,7 +541,8 @@ class LIBARDOUR_API TriggerBox : public Processor
|
||||||
TriggerPtr get_next_trigger ();
|
TriggerPtr get_next_trigger ();
|
||||||
TriggerPtr peek_next_trigger ();
|
TriggerPtr peek_next_trigger ();
|
||||||
|
|
||||||
void add_midi_sidechain (std::string const & name);
|
void add_midi_sidechain ();
|
||||||
|
void update_sidechain_name ();
|
||||||
|
|
||||||
bool pass_thru() const { return _requests.pass_thru; }
|
bool pass_thru() const { return _requests.pass_thru; }
|
||||||
void set_pass_thru (bool yn);
|
void set_pass_thru (bool yn);
|
||||||
|
|
|
||||||
|
|
@ -3160,8 +3160,11 @@ Route::set_processor_state (const XMLNode& node, int version)
|
||||||
cerr << "Seen triggerbox!\n";
|
cerr << "Seen triggerbox!\n";
|
||||||
if (!_triggerbox) {
|
if (!_triggerbox) {
|
||||||
_triggerbox.reset (new TriggerBox (_session, _default_type));
|
_triggerbox.reset (new TriggerBox (_session, _default_type));
|
||||||
|
_triggerbox->set_owner (this);
|
||||||
}
|
}
|
||||||
_triggerbox->set_state (**niter, version);
|
_triggerbox->set_state (**niter, version);
|
||||||
|
_triggerbox->update_sidechain_name ();
|
||||||
|
|
||||||
new_order.push_back (_triggerbox);
|
new_order.push_back (_triggerbox);
|
||||||
} else {
|
} else {
|
||||||
set_processor_state (**niter, version, prop, new_order, must_configure);
|
set_processor_state (**niter, version, prop, new_order, must_configure);
|
||||||
|
|
@ -4581,6 +4584,10 @@ Route::set_name (const string& str)
|
||||||
pi->update_sidechain_name ();
|
pi->update_sidechain_name ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_triggerbox) {
|
||||||
|
_triggerbox->update_sidechain_name ();
|
||||||
|
}
|
||||||
|
|
||||||
bool ret = (_input->set_name(newname) && _output->set_name(newname));
|
bool ret = (_input->set_name(newname) && _output->set_name(newname));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
|
||||||
|
|
@ -2740,7 +2740,7 @@ Session::new_audio_track (int input_channels, int output_channels, RouteGroup* r
|
||||||
* data type is AUDIO, the triggerbox will need
|
* data type is AUDIO, the triggerbox will need
|
||||||
* a sidehcain MIDI input to be able to be MIDI controlled
|
* a sidehcain MIDI input to be able to be MIDI controlled
|
||||||
*/
|
*/
|
||||||
tb->add_midi_sidechain (track->name());
|
tb->add_midi_sidechain ();
|
||||||
track->presentation_info ().set_trigger_track (true);
|
track->presentation_info ().set_trigger_track (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2158,10 +2158,11 @@ TriggerBox::trigger (Triggers::size_type n)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TriggerBox::add_midi_sidechain (std::string const & name)
|
TriggerBox::add_midi_sidechain ()
|
||||||
{
|
{
|
||||||
|
assert (owner());
|
||||||
if (!_sidechain) {
|
if (!_sidechain) {
|
||||||
_sidechain.reset (new SideChain (_session, name + "-trig"));
|
_sidechain.reset (new SideChain (_session, string_compose ("%1/%2", owner()->name(), name ())));
|
||||||
_sidechain->activate ();
|
_sidechain->activate ();
|
||||||
_sidechain->input()->add_port ("", owner(), DataType::MIDI); // add a port, don't connect.
|
_sidechain->input()->add_port ("", owner(), DataType::MIDI); // add a port, don't connect.
|
||||||
boost::shared_ptr<Port> p = _sidechain->input()->nth (0);
|
boost::shared_ptr<Port> p = _sidechain->input()->nth (0);
|
||||||
|
|
@ -2174,6 +2175,16 @@ TriggerBox::add_midi_sidechain (std::string const & name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TriggerBox::update_sidechain_name ()
|
||||||
|
{
|
||||||
|
if (!_sidechain) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert (owner());
|
||||||
|
_sidechain->set_name (string_compose ("%1/%2", owner()->name(), name ()));
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TriggerBox::can_support_io_configuration (const ChanCount& in, ChanCount& out)
|
TriggerBox::can_support_io_configuration (const ChanCount& in, ChanCount& out)
|
||||||
{
|
{
|
||||||
|
|
@ -2831,12 +2842,7 @@ TriggerBox::get_state (void)
|
||||||
node.add_child_nocopy (*trigger_child);
|
node.add_child_nocopy (*trigger_child);
|
||||||
|
|
||||||
if (_sidechain) {
|
if (_sidechain) {
|
||||||
XMLNode* scnode = new XMLNode (X_("Sidechain"));
|
node.add_child_nocopy (_sidechain->get_state ());
|
||||||
std::string port_name = _sidechain->input()->nth (0)->name();
|
|
||||||
port_name = port_name.substr (0, port_name.find ('-'));
|
|
||||||
scnode->set_property (X_("name"), port_name);
|
|
||||||
scnode->add_child_nocopy (_sidechain->get_state());
|
|
||||||
node.add_child_nocopy (*scnode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
@ -2881,14 +2887,12 @@ TriggerBox::set_state (const XMLNode& node, int version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode* scnode = node.child (X_("Sidechain"));
|
/* sidechain is a Processor (IO) */
|
||||||
|
XMLNode* scnode = node.child (Processor::state_node_name.c_str ());
|
||||||
if (scnode) {
|
if (scnode) {
|
||||||
std::string name;
|
add_midi_sidechain ();
|
||||||
scnode->get_property (X_("name"), name);
|
|
||||||
add_midi_sidechain (name);
|
|
||||||
assert (_sidechain);
|
assert (_sidechain);
|
||||||
_sidechain->set_state (*scnode->children().front(), version);
|
_sidechain->set_state (*scnode, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue