EventRef Param::appendRamp( float valueEnd, float rampSeconds, const Options &options ) { initInternalBuffer(); auto ctx = getContext(); auto endTimeAndValue = findEndTimeAndValue(); float timeBegin = endTimeAndValue.first + options.getDelay(); float timeEnd = timeBegin + rampSeconds; EventRef event( new Event( timeBegin, timeEnd, endTimeAndValue.second, valueEnd, options.getRampFn() ) ); lock_guard<mutex> lock( ctx->getMutex() ); mEvents.push_back( event ); return event; }
EventRef Param::appendRamp( float valueBegin, float valueEnd, double rampSeconds, const Options &options ) { initInternalBuffer(); auto ctx = getContext(); auto endTimeAndValue = findEndTimeAndValue(); double timeBegin = ( options.getBeginTime() >= 0 ? options.getBeginTime() : endTimeAndValue.first + options.getDelay() ); double timeEnd = timeBegin + rampSeconds; EventRef event( new Event( timeBegin, timeEnd, valueBegin, valueEnd, false, options.getRampFn() ) ); if( ! options.getLabel().empty() ) event->mLabel = options.getLabel(); lock_guard<mutex> lock( ctx->getMutex() ); mEvents.push_back( event ); return event; }