MCP: patch from seablade to fix pot displays (both absolute value and negative values)
git-svn-id: svn://localhost/ardour2/branches/3.0@12739 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5b1da330a4
commit
9429401f11
@ -47,11 +47,20 @@ Pot::set (float val, bool onoff, Mode mode)
|
|||||||
|
|
||||||
// Pot/LED mode
|
// Pot/LED mode
|
||||||
msg |= (mode << 4);
|
msg |= (mode << 4);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Even though a width value may be negative, there is
|
||||||
|
* technically still width there, it is just reversed,
|
||||||
|
* so make sure to show it on the LED ring appropriately.
|
||||||
|
*/
|
||||||
|
if (val < 0){
|
||||||
|
val = val * -1;
|
||||||
|
}
|
||||||
|
|
||||||
// val, but only if off hasn't explicitly been set
|
// val, but only if off hasn't explicitly been set
|
||||||
if (onoff) {
|
if (onoff) {
|
||||||
if (mode == spread) {
|
if (mode == spread) {
|
||||||
msg |= (lrintf (val * 6) + 1) & 0x0f; // 0b00001111
|
msg |= (lrintf (val * 6)) & 0x0f; // 0b00001111
|
||||||
} else {
|
} else {
|
||||||
msg |= (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111
|
msg |= (lrintf (val * 10.0) + 1) & 0x0f; // 0b00001111
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user