--- linuxsampler/trunk/src/scriptvm/common.h 2019/08/30 12:39:18 3583 +++ linuxsampler/trunk/src/scriptvm/common.h 2019/08/30 13:33:32 3584 @@ -515,11 +515,61 @@ /** * Calling this method evaluates the expression and returns the value + * of the expression as integer and thus behaves similar to the previous + * method, however this overridden method automatically takes unit + * prefixes into account and returns a converted value corresponding to + * the given unit @a prefix expected by the caller. + * + * Example: Assume this expression was an integer expression '12kHz' + * then calling this method as @c evalCastInt(VM_MILLI) would return + * the value @c 12000000. + * + * @param prefix - measuring unit prefix expected for result by caller + */ + vmint evalCastInt(MetricPrefix_t prefix); + + /** + * This method behaves like the previous method, just that it takes a + * measuring unit prefix with two elements (e.g. "milli cents" for + * tuning). + * + * @param prefix1 - 1st measuring unit prefix element expected by caller + * @param prefix2 - 2nd measuring unit prefix element expected by caller + */ + vmint evalCastInt(MetricPrefix_t prefix1, MetricPrefix_t prefix2); + + /** + * Calling this method evaluates the expression and returns the value * of the expression as real number. If this scalar number expression is * an integer expression then this method automatically casts the value * from integer to real number. */ vmfloat evalCastReal(); + + /** + * Calling this method evaluates the expression and returns the value + * of the expression as real number and thus behaves similar to the + * previous method, however this overridden method automatically takes + * unit prefixes into account and returns a converted value + * corresponding to the given unit @a prefix expected by the caller. + * + * Example: Assume this expression was an integer expression '8ms' then + * calling this method as @c evalCastReal(VM_NO_PREFIX) would return the + * value @c 0.008. + * + * @param prefix - measuring unit prefix expected for result by caller + */ + vmfloat evalCastReal(MetricPrefix_t prefix); + + /** + * This method behaves like the previous method, just that it takes a + * measuring unit prefix with two elements (e.g. "milli cents" for + * tuning). + * + * @param prefix1 - 1st measuring unit prefix element expected by caller + * @param prefix2 - 2nd measuring unit prefix element expected by caller + */ + vmfloat evalCastReal(MetricPrefix_t prefix1, MetricPrefix_t prefix2); }; /** @brief Virtual machine integer expression