summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/transform.h3
-rw-r--r--libs/ardour/transform.cc6
2 files changed, 8 insertions, 1 deletions
diff --git a/libs/ardour/ardour/transform.h b/libs/ardour/ardour/transform.h
index 2b63bb6af0..08e4a43521 100644
--- a/libs/ardour/ardour/transform.h
+++ b/libs/ardour/ardour/transform.h
@@ -106,7 +106,8 @@ public:
ADD, ///< Add top two values
SUB, ///< Subtract top from second-top
MULT, ///< Multiply top two values
- DIV ///< Divide second-top by top
+ DIV, ///< Divide second-top by top
+ MOD ///< Modulus (division remainder)
};
Operation(Operator o, const Value& a=Value()) : op(o), arg(a) {}
diff --git a/libs/ardour/transform.cc b/libs/ardour/transform.cc
index 9a91a65731..3b4f53c860 100644
--- a/libs/ardour/transform.cc
+++ b/libs/ardour/transform.cc
@@ -106,6 +106,12 @@ Transform::Operation::eval(Context& ctx) const
}
value /= rhs.to_double();
break;
+ case MOD:
+ if (rhs.to_double() == 0.0) {
+ return; // Program will fail safely
+ }
+ value = fmod(value, rhs.to_double());
+ break;
default: break;
}