LV2/Generic UI: Remove direct calls to plugin API
Use Ardour Controllable indirection.
This commit is contained in:
parent
8e063110db
commit
7dac8994f6
@ -1273,9 +1273,9 @@ void
|
|||||||
GenericPluginUI::output_update ()
|
GenericPluginUI::output_update ()
|
||||||
{
|
{
|
||||||
for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) {
|
for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) {
|
||||||
float val = plugin->get_parameter ((*i)->parameter().id());
|
|
||||||
char buf[32];
|
char buf[32];
|
||||||
std::shared_ptr<ReadOnlyControl> c = _pib->control_output ((*i)->parameter().id());
|
std::shared_ptr<ReadOnlyControl> c = _pib->control_output ((*i)->parameter().id());
|
||||||
|
float val = c->get_parameter ();
|
||||||
const std::string& str = ARDOUR::value_as_string(c->desc(), Variant(val));
|
const std::string& str = ARDOUR::value_as_string(c->desc(), Variant(val));
|
||||||
size_t len = str.copy(buf, 31);
|
size_t len = str.copy(buf, 31);
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
@ -70,9 +70,9 @@ LV2PluginUI::write_from_ui(void* controller,
|
|||||||
|
|
||||||
std::shared_ptr<AutomationControl> ac = me->_controllables[port_index];
|
std::shared_ptr<AutomationControl> ac = me->_controllables[port_index];
|
||||||
|
|
||||||
me->_updates.insert (port_index);
|
|
||||||
|
|
||||||
if (ac) {
|
if (ac) {
|
||||||
|
me->_updates.insert (port_index);
|
||||||
ac->set_value(*(const float*)buffer, Controllable::NoGroup);
|
ac->set_value(*(const float*)buffer, Controllable::NoGroup);
|
||||||
}
|
}
|
||||||
} else if (format == URIMap::instance().urids.atom_eventTransfer) {
|
} else if (format == URIMap::instance().urids.atom_eventTransfer) {
|
||||||
@ -208,7 +208,7 @@ void
|
|||||||
LV2PluginUI::control_changed (uint32_t port_index)
|
LV2PluginUI::control_changed (uint32_t port_index)
|
||||||
{
|
{
|
||||||
/* Must run in GUI thread because we modify _updates with no lock */
|
/* Must run in GUI thread because we modify _updates with no lock */
|
||||||
if (_lv2->get_parameter (port_index) != _values_last_sent_to_ui[port_index]) {
|
if (_controllables[port_index]->get_value () != _values_last_sent_to_ui[port_index]) {
|
||||||
/* current plugin parameter does not match last value received
|
/* current plugin parameter does not match last value received
|
||||||
from GUI, so queue an update to push it to the GUI during
|
from GUI, so queue an update to push it to the GUI during
|
||||||
our regular timeout.
|
our regular timeout.
|
||||||
@ -241,7 +241,7 @@ LV2PluginUI::queue_port_update()
|
|||||||
for (uint32_t i = 0; i < num_ports; ++i) {
|
for (uint32_t i = 0; i < num_ports; ++i) {
|
||||||
bool ok;
|
bool ok;
|
||||||
uint32_t port = _lv2->nth_parameter(i, ok);
|
uint32_t port = _lv2->nth_parameter(i, ok);
|
||||||
if (ok) {
|
if (ok && _lv2->parameter_is_input (i)) {
|
||||||
_updates.insert (port);
|
_updates.insert (port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ LV2PluginUI::output_update()
|
|||||||
uint32_t nports = _output_ports.size();
|
uint32_t nports = _output_ports.size();
|
||||||
for (uint32_t i = 0; i < nports; ++i) {
|
for (uint32_t i = 0; i < nports; ++i) {
|
||||||
uint32_t index = _output_ports[i];
|
uint32_t index = _output_ports[i];
|
||||||
float val = _lv2->get_parameter (index);
|
float val = _pib->control_output (index)->get_parameter ();
|
||||||
|
|
||||||
if (val != _values_last_sent_to_ui[index]) {
|
if (val != _values_last_sent_to_ui[index]) {
|
||||||
/* Send to GUI */
|
/* Send to GUI */
|
||||||
@ -292,7 +292,7 @@ LV2PluginUI::output_update()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (Updates::iterator i = _updates.begin(); i != _updates.end(); ++i) {
|
for (Updates::iterator i = _updates.begin(); i != _updates.end(); ++i) {
|
||||||
float val = _lv2->get_parameter (*i);
|
float val = _controllables[*i]->get_value ();
|
||||||
/* push current value to the GUI */
|
/* push current value to the GUI */
|
||||||
suil_instance_port_event ((SuilInstance*)_inst, (*i), 4, 0, &val);
|
suil_instance_port_event ((SuilInstance*)_inst, (*i), 4, 0, &val);
|
||||||
_values_last_sent_to_ui[(*i)] = val;
|
_values_last_sent_to_ui[(*i)] = val;
|
||||||
@ -483,13 +483,12 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
|
|||||||
if (_lv2->parameter_is_control(port) && _lv2->parameter_is_input(port)) {
|
if (_lv2->parameter_is_control(port) && _lv2->parameter_is_input(port)) {
|
||||||
if (_controllables[port]) {
|
if (_controllables[port]) {
|
||||||
_controllables[port]->Changed.connect (control_connections, invalidator (*this), boost::bind (&LV2PluginUI::control_changed, this, port), gui_context());
|
_controllables[port]->Changed.connect (control_connections, invalidator (*this), boost::bind (&LV2PluginUI::control_changed, this, port), gui_context());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* queue for first update ("push") to GUI */
|
/* queue for first update ("push") to GUI */
|
||||||
_updates.insert (port);
|
_updates.insert (port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_lv2->has_message_output()) {
|
if (_lv2->has_message_output()) {
|
||||||
_message_update_connection = Timers::super_rapid_connect (
|
_message_update_connection = Timers::super_rapid_connect (
|
||||||
|
Loading…
Reference in New Issue
Block a user