mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-11 09:06:33 +01:00
Invert Pan-Azimuth (up means left)
It's a well established convention that pan y-axis automation, or vertical uses (top) +1 for left. This special cases rotary knobs (and horizontal sliders) to retain a clockwise movement (or movement to the right) for panning to the right.
This commit is contained in:
parent
85ea1250e1
commit
c663a2d8ef
5 changed files with 39 additions and 12 deletions
|
|
@ -113,8 +113,8 @@ public:
|
||||||
double normal() const { return _desc.normal; }
|
double normal() const { return _desc.normal; }
|
||||||
bool toggled() const { return _desc.toggled; }
|
bool toggled() const { return _desc.toggled; }
|
||||||
|
|
||||||
double internal_to_interface (double i) const;
|
double internal_to_interface (double, bool rotary = false) const;
|
||||||
double interface_to_internal (double i) const;
|
double interface_to_internal (double, bool rotary = false) const;
|
||||||
|
|
||||||
virtual std::string get_user_string() const;
|
virtual std::string get_user_string() const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,12 @@ struct LIBARDOUR_API ParameterDescriptor : public Evoral::ParameterDescriptor
|
||||||
* interface value, using settings from Evoral::ParameterDescriptor.
|
* interface value, using settings from Evoral::ParameterDescriptor.
|
||||||
*
|
*
|
||||||
* default for AutomationControl::internal_to_interface ();
|
* default for AutomationControl::internal_to_interface ();
|
||||||
|
*
|
||||||
|
* @param v the control-value to convert
|
||||||
|
* @param rotary set to true if the GUI control is a rotary knob
|
||||||
|
* @return interface value in range 0..1
|
||||||
*/
|
*/
|
||||||
float to_interface (float) const;
|
float to_interface (float v, bool rotary = false) const;
|
||||||
|
|
||||||
/** normalized [0..1] to control-value range
|
/** normalized [0..1] to control-value range
|
||||||
*
|
*
|
||||||
|
|
@ -70,8 +74,12 @@ struct LIBARDOUR_API ParameterDescriptor : public Evoral::ParameterDescriptor
|
||||||
* using settings from Evoral::ParameterDescriptor.
|
* using settings from Evoral::ParameterDescriptor.
|
||||||
*
|
*
|
||||||
* default for AutomationControl::interface_to_internal ();
|
* default for AutomationControl::interface_to_internal ();
|
||||||
|
*
|
||||||
|
* @param v the value in range 0..1 to on convert
|
||||||
|
* @param rotary set to true if the GUI control is a rotary knob
|
||||||
|
* @return control-value in range lower..upper
|
||||||
*/
|
*/
|
||||||
float from_interface (float) const;
|
float from_interface (float v, bool rotary = false) const;
|
||||||
|
|
||||||
bool is_linear () const;
|
bool is_linear () const;
|
||||||
float compute_delta (float from, float to) const;
|
float compute_delta (float from, float to) const;
|
||||||
|
|
|
||||||
|
|
@ -337,23 +337,23 @@ AutomationControl::commit_transaction (bool did_write)
|
||||||
|
|
||||||
/* take control-value and return UI range [0..1] */
|
/* take control-value and return UI range [0..1] */
|
||||||
double
|
double
|
||||||
AutomationControl::internal_to_interface (double val) const
|
AutomationControl::internal_to_interface (double val, bool rotary) const
|
||||||
{
|
{
|
||||||
// XXX maybe optimize. _desc.from_interface() has
|
// XXX maybe optimize. _desc.from_interface() has
|
||||||
// a switch-statement depending on AutomationType.
|
// a switch-statement depending on AutomationType.
|
||||||
return _desc.to_interface (val);
|
return _desc.to_interface (val, rotary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* map GUI range [0..1] to control-value */
|
/* map GUI range [0..1] to control-value */
|
||||||
double
|
double
|
||||||
AutomationControl::interface_to_internal (double val) const
|
AutomationControl::interface_to_internal (double val, bool rotary) const
|
||||||
{
|
{
|
||||||
if (!isfinite_local (val)) {
|
if (!isfinite_local (val)) {
|
||||||
assert (0);
|
assert (0);
|
||||||
val = 0;
|
val = 0;
|
||||||
}
|
}
|
||||||
// XXX maybe optimize. see above.
|
// XXX maybe optimize. see above.
|
||||||
return _desc.from_interface (val);
|
return _desc.from_interface (val, rotary);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ ParameterDescriptor::midi_note_num (const std::string& name)
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
ParameterDescriptor::to_interface (float val) const
|
ParameterDescriptor::to_interface (float val, bool rotary) const
|
||||||
{
|
{
|
||||||
val = std::min (upper, std::max (lower, val));
|
val = std::min (upper, std::max (lower, val));
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
|
@ -323,6 +323,12 @@ ParameterDescriptor::to_interface (float val) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PanAzimuthAutomation:
|
case PanAzimuthAutomation:
|
||||||
|
if (rotary) {
|
||||||
|
val = val;
|
||||||
|
} else {
|
||||||
|
val = 1.0 - val;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PanElevationAutomation:
|
case PanElevationAutomation:
|
||||||
val = val;
|
val = val;
|
||||||
break;
|
break;
|
||||||
|
|
@ -356,7 +362,7 @@ ParameterDescriptor::to_interface (float val) const
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
ParameterDescriptor::from_interface (float val) const
|
ParameterDescriptor::from_interface (float val, bool rotary) const
|
||||||
{
|
{
|
||||||
val = std::max (0.f, std::min (1.f, val));
|
val = std::max (0.f, std::min (1.f, val));
|
||||||
|
|
||||||
|
|
@ -374,6 +380,12 @@ ParameterDescriptor::from_interface (float val) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PanAzimuthAutomation:
|
case PanAzimuthAutomation:
|
||||||
|
if (rotary) {
|
||||||
|
val = val;
|
||||||
|
} else {
|
||||||
|
val = 1.0 - val;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PanElevationAutomation:
|
case PanElevationAutomation:
|
||||||
val = val;
|
val = val;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,15 @@ public:
|
||||||
virtual double get_save_value () const { return get_value(); }
|
virtual double get_save_value () const { return get_value(); }
|
||||||
|
|
||||||
/** Conversions between `internal', 'interface', and 'user' values */
|
/** Conversions between `internal', 'interface', and 'user' values */
|
||||||
virtual double internal_to_interface (double i) const {return (i-lower())/(upper() - lower());} //by default, the interface range is just a linear interpolation between lower and upper values
|
virtual double internal_to_interface (double i, bool rotary = false) const {
|
||||||
virtual double interface_to_internal (double i) const {return lower() + i*(upper() - lower());}
|
/* by default, the interface range is just a linear
|
||||||
|
* interpolation between lower and upper values */
|
||||||
|
return (i-lower())/(upper() - lower());
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual double interface_to_internal (double i, bool rotary = false) const {
|
||||||
|
return lower() + i*(upper() - lower());
|
||||||
|
}
|
||||||
|
|
||||||
/** Get and Set `interface' value (typically, fraction of knob travel) */
|
/** Get and Set `interface' value (typically, fraction of knob travel) */
|
||||||
virtual float get_interface() const { return (internal_to_interface(get_value())); }
|
virtual float get_interface() const { return (internal_to_interface(get_value())); }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue