mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 17:16:38 +01:00
stop crashes from out-of-range values
This commit is contained in:
parent
7c82792a57
commit
879b09d920
2 changed files with 13 additions and 12 deletions
|
|
@ -44,8 +44,9 @@
|
||||||
#include "ardour/vca_manager.h"
|
#include "ardour/vca_manager.h"
|
||||||
|
|
||||||
#include "canvas/colors.h"
|
#include "canvas/colors.h"
|
||||||
#include "canvas/rectangle.h"
|
|
||||||
#include "canvas/line.h"
|
#include "canvas/line.h"
|
||||||
|
#include "canvas/rectangle.h"
|
||||||
|
#include "canvas/text.h"
|
||||||
|
|
||||||
#include "gtkmm2ext/gui_thread.h"
|
#include "gtkmm2ext/gui_thread.h"
|
||||||
|
|
||||||
|
|
@ -400,15 +401,9 @@ MixLayout::strip_vpot (int n, int delta)
|
||||||
boost::shared_ptr<Controllable> ac = knobs[n]->controllable();
|
boost::shared_ptr<Controllable> ac = knobs[n]->controllable();
|
||||||
|
|
||||||
if (ac) {
|
if (ac) {
|
||||||
if (ac->is_gain_like()) {
|
ac->set_value (ac->interface_to_internal (
|
||||||
/* 128 steps from fader position 0 to 1.0 ..
|
min (ac->upper(), max (ac->lower(), ac->internal_to_interface (ac->get_value()) + (delta/256.0)))),
|
||||||
*/
|
PBD::Controllable::UseGroup);
|
||||||
const double new_fader_position = min (1.0, max (0.0, ac->internal_to_interface (ac->get_value()) + ((1.0 / 128.0) * delta)));
|
|
||||||
ac->set_value (ac->interface_to_internal (new_fader_position), PBD::Controllable::UseGroup);
|
|
||||||
} else {
|
|
||||||
/* 128 steps from min to max */
|
|
||||||
ac->set_value (ac->get_value() + (((ac->upper() - ac->lower()) / 128.0) * delta) , PBD::Controllable::UseGroup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1094,7 +1094,11 @@ Push2::other_vpot (int n, int delta)
|
||||||
click_gain = session->click_gain();
|
click_gain = session->click_gain();
|
||||||
if (click_gain) {
|
if (click_gain) {
|
||||||
boost::shared_ptr<AutomationControl> ac = click_gain->gain_control();
|
boost::shared_ptr<AutomationControl> ac = click_gain->gain_control();
|
||||||
ac->set_value (ac->interface_to_internal (ac->internal_to_interface (ac->get_value()) + (delta/128.0)), PBD::Controllable::UseGroup);
|
if (ac) {
|
||||||
|
ac->set_value (ac->interface_to_internal (
|
||||||
|
min (ac->upper(), max (ac->lower(), ac->internal_to_interface (ac->get_value()) + (delta/256.0)))),
|
||||||
|
PBD::Controllable::UseGroup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -1102,7 +1106,9 @@ Push2::other_vpot (int n, int delta)
|
||||||
if (master) {
|
if (master) {
|
||||||
boost::shared_ptr<AutomationControl> ac = master->gain_control();
|
boost::shared_ptr<AutomationControl> ac = master->gain_control();
|
||||||
if (ac) {
|
if (ac) {
|
||||||
ac->set_value (ac->interface_to_internal (ac->internal_to_interface (ac->get_value()) + (delta/128.0)), PBD::Controllable::UseGroup);
|
ac->set_value (ac->interface_to_internal (
|
||||||
|
min (ac->upper(), max (ac->lower(), ac->internal_to_interface (ac->get_value()) + (delta/256.0)))),
|
||||||
|
PBD::Controllable::UseGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue