Beispiel #1
0
const float* Param::getValueArray()
{
	if( ! mIsVaryingThisBlock ) {
		initInternalBuffer();
		dsp::fill( mValue, mInternalBuffer.getData(), mInternalBuffer.getSize() );
	}

	return mInternalBuffer.getData();
}
Beispiel #2
0
EventRef Param::applyRamp( float valueBegin, float valueEnd, float rampSeconds, const Options &options )
{
	initInternalBuffer();

	auto ctx = getContext();
	float timeBegin = (float)ctx->getNumProcessedSeconds() + options.getDelay();
	float timeEnd = timeBegin + rampSeconds;

	EventRef event( new Event( timeBegin, timeEnd, valueBegin, valueEnd, options.getRampFn() ) );

	lock_guard<mutex> lock( ctx->getMutex() );
	resetImpl();
	mEvents.push_back( event );

	return event;
}
Beispiel #3
0
void Param::setProcessor( const NodeRef &node )
{
	if( ! node )
		return;

	initInternalBuffer();

	lock_guard<mutex> lock( getContext()->getMutex() );

	resetImpl();

	// force node to be mono and initialize it
	node->setNumChannels( 1 );
	node->initializeImpl();

	mProcessor = node;
}
Beispiel #4
0
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;
}
Beispiel #5
0
void Param::setProcessor( const NodeRef &node )
{
	if( ! node )
		return;

	initInternalBuffer();

	lock_guard<mutex> lock( getContext()->getMutex() );

	resetImpl();

	// force node to be mono and initialize it
	node->setNumChannels( 1 );
	node->initializeImpl();

	mProcessor = node;
	mIsVaryingThisBlock = true; // stays true until there is no more processor and eval() sets this to false.
}
Beispiel #6
0
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;
}
Beispiel #7
0
EventRef Param::applyRamp( float valueEnd, double rampSeconds, const Options &options )
{
	initInternalBuffer();

	auto ctx = getContext();
	double timeBegin = ( options.getBeginTime() >= 0 ? options.getBeginTime() : ctx->getNumProcessedSeconds() + options.getDelay() );
	double timeEnd = timeBegin + rampSeconds;

	EventRef event( new Event( timeBegin, timeEnd, mValue, valueEnd, true, options.getRampFn() ) );

	if( ! options.getLabel().empty() )
		event->mLabel = options.getLabel();

	lock_guard<mutex> lock( ctx->getMutex() );

	removeEventsAt( timeBegin );
	if( mProcessor )
		mProcessor.reset();

	mEvents.push_back( event );
	return event;
}