WS: crash bugfix related to missing strip panner

Surface made Ardour crash when a client connected
and some session track was not a VCA nor had a panner,
like MIDI strips.
This commit is contained in:
Luciano Iam 2020-09-01 22:28:00 +02:00 committed by Robin Gareus
parent 7a9d4b1f64
commit 9c08c058a3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 18 additions and 30 deletions

View File

@ -65,20 +65,17 @@ WebsocketsDispatcher::update_all_nodes (Client client)
ValueVector strip_desc = ValueVector ();
strip_desc.push_back (strip.name ());
strip_desc.push_back (strip.is_vca ());
strip_desc.push_back (strip.has_pan ());
update (client, Node::strip_description, strip_addr, strip_desc);
update (client, Node::strip_gain, strip_id, strip.gain ());
update (client, Node::strip_mute, strip_id, strip.mute ());
// Pan and plugins not available in VCAs
if (strip.is_vca ()) {
continue;
if (strip.has_pan ()) {
update (client, Node::strip_pan, strip_id, strip.pan ());
}
update (client, Node::strip_pan, strip_id, strip.pan ());
for (ArdourMixerStrip::PluginMap::iterator it = strip.plugins ().begin (); it != strip.plugins ().end (); ++it) {
uint32_t plugin_id = it->first;
boost::shared_ptr<PluginInsert> insert = it->second->insert ();

View File

@ -121,11 +121,6 @@ ArdourMixerPlugin::param_value (boost::shared_ptr<ARDOUR::AutomationControl> con
ArdourMixerStrip::ArdourMixerStrip (boost::shared_ptr<ARDOUR::Stripable> stripable, PBD::EventLoop* event_loop)
: _stripable (stripable)
{
if (is_vca ()) {
/* no plugins to handle */
return;
}
boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (_stripable);
if (!route) {
@ -188,6 +183,12 @@ ArdourMixerStrip::set_gain (double db)
_stripable->gain_control ()->set_value (from_db (db), PBD::Controllable::NoGroup);
}
bool
ArdourMixerStrip::has_pan () const
{
return _stripable->pan_azimuth_control () != 0;
}
double
ArdourMixerStrip::pan () const
{
@ -224,12 +225,6 @@ ArdourMixerStrip::set_mute (bool mute)
_stripable->mute_control ()->set_value (mute ? 1.0 : 0.0, PBD::Controllable::NoGroup);
}
bool
ArdourMixerStrip::is_vca () const
{
return _stripable->presentation_info ().flags () & ARDOUR::PresentationInfo::VCA;
}
float
ArdourMixerStrip::meter_level_db () const
{

View File

@ -83,14 +83,13 @@ public:
double gain () const;
void set_gain (double);
bool has_pan () const;
double pan () const;
void set_pan (double);
bool mute () const;
void set_mute (bool);
bool is_vca () const;
std::string name () const;
float meter_level_db () const;

View File

@ -88,8 +88,9 @@ import { createRootContainer, Container, Dialog, Label, Button, Toggle,
plugins.classList.add('strip-plugins');
plugins.appendTo(container);
if (strip.isVca || (strip.plugins.length == 0)) {
if (strip.plugins.length == 0) {
plugins.classList.add('disabled');
plugins.element.style.visibility = 'hidden';
} else {
plugins.callback = () => openPlugins (strip);
}
@ -97,8 +98,10 @@ import { createRootContainer, Container, Dialog, Label, Button, Toggle,
const pan = new PanKnob();
pan.appendTo(container);
if (!strip.isVca) {
if (strip.hasPan) {
pan.bindTo(strip, 'pan');
} else {
pan.element.style.visibility = 'hidden';
}
const mute = new Toggle();
@ -123,12 +126,6 @@ import { createRootContainer, Container, Dialog, Label, Button, Toggle,
label.text = strip.name;
label.classList.add('strip-label');
label.appendTo(container);
if (strip.isVca) {
// hide plugins and pan keeping layout
pan.element.style.visibility = 'hidden';
plugins.element.style.visibility = 'hidden';
}
}
function openPlugins (strip) {

View File

@ -33,7 +33,7 @@ export default class Strip extends AddressableComponent {
super(parent, addr);
this._plugins = {};
this._name = desc[0];
this._isVca = desc[1];
this._hasPan = desc[1];
this._meter = 0;
this._gain = 0;
this._pan = 0;
@ -48,8 +48,8 @@ export default class Strip extends AddressableComponent {
return this._name;
}
get isVca () {
return this._isVca;
get hasPan () {
return this._hasPan;
}
get meter () {