--- linuxsampler/trunk/src/scriptvm/CoreVMFunctions.cpp 2017/05/26 18:30:42 3221 +++ linuxsampler/trunk/src/scriptvm/CoreVMFunctions.cpp 2017/08/10 13:18:06 3345 @@ -15,6 +15,7 @@ #include #include "tree.h" #include "ScriptVM.h" +#include "../common/RTMath.h" namespace LinuxSampler { @@ -71,15 +72,17 @@ VMFnResult* CoreVMFunction_message::exec(VMFnArgs* args) { if (!args->argsCount()) return errorResult(); + uint64_t usecs = RTMath::unsafeMicroSeconds(RTMath::real_clock); + VMStringExpr* strExpr = dynamic_cast(args->arg(0)); if (strExpr) { - std::cout << "[ScriptVM] " << strExpr->evalStr() << "\n"; + printf("[ScriptVM %.3f] %s\n", usecs/1000000.f, strExpr->evalStr().c_str()); return successResult(); } VMIntExpr* intExpr = dynamic_cast(args->arg(0)); if (intExpr) { - std::cout << "[ScriptVM] " << intExpr->evalInt() << "\n"; + printf("[ScriptVM %.3f] %d\n", usecs/1000000.f, intExpr->evalInt()); return successResult(); } @@ -291,7 +294,7 @@ int m_index; }; -static inline void swap(class ArrElemRef& a, class ArrElemRef& b); +static inline void swap(class ArrElemRef a, class ArrElemRef b); class ArrElemRef : protected ArrElemPOD { public: @@ -368,7 +371,7 @@ m_array->assignIntElement(m_index, value); } - friend void swap(class ArrElemRef& a, class ArrElemRef& b); + friend void swap(class ArrElemRef a, class ArrElemRef b); }; class ArrElemPtr : protected ArrElemPOD { @@ -386,7 +389,7 @@ } }; -static inline void swap(ArrElemRef& a, ArrElemRef& b) { +static inline void swap(ArrElemRef a, ArrElemRef b) { int valueA = a.getValue(); int valueB = b.getValue(); a.setValue(valueB); @@ -426,6 +429,14 @@ --m_index; return it; } + inline ArrExprIter& operator+=(difference_type d) { + m_index += d; + return *this; + } + inline ArrExprIter& operator-=(difference_type d) { + m_index -= d; + return *this; + } inline bool operator==(const ArrExprIter& other) const { return m_index == other.m_index; }