Update I/O plugin port-names when plugin changes them
This commit is contained in:
@@ -59,6 +59,7 @@ public:
|
||||
int set_block_size (pframes_t);
|
||||
void set_public_latency (bool);
|
||||
bool ensure_io ();
|
||||
void set_pretty_port_names ();
|
||||
|
||||
bool is_pre () const { return _pre; }
|
||||
|
||||
@@ -119,6 +120,7 @@ private:
|
||||
void create_parameters ();
|
||||
void parameter_changed_externally (uint32_t, float);
|
||||
void property_changed_externally (uint32_t, Variant);
|
||||
void processor_change (RouteProcessorChange const&);
|
||||
|
||||
void setup ();
|
||||
|
||||
|
||||
@@ -257,6 +257,7 @@ IOPlug::setup ()
|
||||
_plugin->reconfigure_io (_n_in, aux_in, _n_out);
|
||||
_plugin->ParameterChangedExternally.connect_same_thread (*this, std::bind (&IOPlug::parameter_changed_externally, this, _1, _2));
|
||||
_plugin->PropertyChanged.connect_same_thread (*this, std::bind (&IOPlug::property_changed_externally, this, _1, _2));
|
||||
_plugin->ProcessorChange.connect_same_thread (*this, std::bind (&IOPlug::processor_change, this, _1));
|
||||
_plugin->activate ();
|
||||
_plugin->set_insert (this, 0);
|
||||
}
|
||||
@@ -384,6 +385,14 @@ IOPlug::property_changed_externally (uint32_t which, Variant val)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
IOPlug::processor_change (RouteProcessorChange const& rpc)
|
||||
{
|
||||
if (rpc & RouteProcessorChange::PortNameChange) {
|
||||
set_pretty_port_names ();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
IOPlug::set_block_size (pframes_t n_samples)
|
||||
{
|
||||
@@ -400,21 +409,9 @@ IOPlug::ui_elements () const
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
IOPlug::ensure_io ()
|
||||
void
|
||||
IOPlug::set_pretty_port_names ()
|
||||
{
|
||||
PBD::Unwinder<bool> uw (_configuring_io, true);
|
||||
|
||||
/* must be called with process-lock held */
|
||||
if (_input->ensure_io (_n_in, false, this) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (_output->ensure_io (_n_out, false, this) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_bufs.ensure_buffers (ChanCount::max (_n_in, _n_out), _session.get_block_size ());
|
||||
|
||||
for (uint32_t i = 0; i < _n_in.n_audio (); ++i) {
|
||||
const auto& pd (_plugin->describe_io_port (DataType::AUDIO, true, i));
|
||||
std::string const pn = string_compose ("%1 %2 - %3", _("IO"), name (), pd.name);
|
||||
@@ -435,17 +432,35 @@ IOPlug::ensure_io ()
|
||||
std::string const pn = string_compose ("%1 %2 - %3", _("IO"), name (), pd.name);
|
||||
_output->midi (i)->set_pretty_name (pn);
|
||||
}
|
||||
}
|
||||
|
||||
if (_pre) {
|
||||
for (uint32_t i = 0; i < _n_out.n_audio (); ++i) {
|
||||
std::string const& n = AudioEngine::instance ()->make_port_name_non_relative (_output->audio (i)->name ());
|
||||
_audio_input_ports.insert (make_pair (n, PortManager::AudioInputPort (24288))); // 2^19 ~ 1MB / port
|
||||
}
|
||||
for (uint32_t i = 0; i < _n_out.n_midi (); ++i) {
|
||||
std::string const& n = AudioEngine::instance ()->make_port_name_non_relative (_output->midi (i)->name ());
|
||||
_midi_input_ports.insert (make_pair (n, PortManager::MIDIInputPort (32)));
|
||||
}
|
||||
}
|
||||
bool
|
||||
IOPlug::ensure_io ()
|
||||
{
|
||||
PBD::Unwinder<bool> uw (_configuring_io, true);
|
||||
|
||||
/* must be called with process-lock held */
|
||||
if (_input->ensure_io (_n_in, false, this) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (_output->ensure_io (_n_out, false, this) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
_bufs.ensure_buffers (ChanCount::max (_n_in, _n_out), _session.get_block_size ());
|
||||
|
||||
set_pretty_port_names ();
|
||||
|
||||
if (_pre) {
|
||||
for (uint32_t i = 0; i < _n_out.n_audio (); ++i) {
|
||||
std::string const& n = AudioEngine::instance ()->make_port_name_non_relative (_output->audio (i)->name ());
|
||||
_audio_input_ports.insert (make_pair (n, PortManager::AudioInputPort (24288))); // 2^19 ~ 1MB / port
|
||||
}
|
||||
for (uint32_t i = 0; i < _n_out.n_midi (); ++i) {
|
||||
std::string const& n = AudioEngine::instance ()->make_port_name_non_relative (_output->midi (i)->name ());
|
||||
_midi_input_ports.insert (make_pair (n, PortManager::MIDIInputPort (32)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user