void FeedbackDelayNetworkNode::process() {
	//First, check an d set properties.
	//We just do this inline because it's trivial.
	if(werePropertiesModified(this, Lav_FDN_DELAYS)) {
		setDelays(getProperty(Lav_FDN_DELAYS).getFloatArrayPtr());
	}
	if(werePropertiesModified(this, Lav_FDN_MATRIX)) {
		setMatrix(getProperty(Lav_FDN_MATRIX).getFloatArrayPtr());
	}
	if(werePropertiesModified(this, Lav_FDN_OUTPUT_GAINS)) {
		setOutputGains(getProperty(Lav_FDN_OUTPUT_GAINS).getFloatArrayPtr());
	}
	if(werePropertiesModified(this, Lav_FDN_FILTER_TYPES, Lav_FDN_FILTER_FREQUENCIES)) {
		configureFilters(
		getProperty(Lav_FDN_FILTER_TYPES).getIntArrayPtr(),
		getProperty(Lav_FDN_FILTER_FREQUENCIES).getFloatArrayPtr());
	}
	for(int i = 0	; i < block_size; i++) {
		network->computeFrame(last_output);
		for(int j = 0; j < num_output_buffers; j++) { 	
			output_buffers[j][i] = last_output[j]*gains[j];
			next_input[j] = input_buffers[j][i];
			//Apply the filter.
			last_output[j] = filters[j]->tick(last_output[j]);
		}
		network->advance(next_input, last_output);
	}
}
Exemplo n.º 2
0
	void TooltipItem::init()
	{
		addChild(mLayer);
		mLayer->addChild(mGraphic);
		mLayer->addChild(mText);

		mText->setPosition(8.0f, 8.0f);
		mGraphic->setPosition(8.0f, 8.0f);

		setDelays(0.0f, 0.0f);

		mTooltipGraphic = mLayer;
	}
Exemplo n.º 3
0
	void  TooltipItem::updateTooltip()
	{
		std::stringstream ss;
		if (mItem->getItemLocation() == Item::INVENTORY)
		{
			setDelays(0.0f, 0.0f);
			mGraphic->setAsset(mItem->getGraphic()->getAsset());
			mGraphic->setVisible(true);
			mText->setPosition(16.0f + mGraphic->getWidth(), 8.0f);
			ItemCommon::ItemType type = mItem->getItemType();
			if (type == ItemCommon::GOLD)
			{
				ss << "Gold: " << mItem->getItemValue() << '\n';
			}
			else if (type == ItemCommon::POTION)
			{
				ss << "Value: " << mItem->getItemValue();
			}
			else if (type == ItemCommon::SPELL_SCROLL)
			{

			}
			else if (type == ItemCommon::MESSAGE_SCROLL)
			{
				ss << "Right click to read the message.";
			}
			else
			{
				int i = 0;
				while (true)
				{
					Stat::StatType stat = Stat::getStatType(i);
					i++;
					if (stat == Stat::MAX_STAT_LENGTH)
					{
						break;
					}
					float value = mItem->getStatModifiers()->calculateStat(stat, 0.0f);
					if (value <= 0.00001f)
					{
						continue;
					}
					ss << "<title class='" << Stat::getStatName(stat) << "'>" << Stat::getNiceStatName(stat) << "</title>: " << value << '\n';
					
				}
				ss << "<title class='value'>Value</title>: " << mItem->getItemValue();
			}
			mText->setText(ss.str().c_str());

			float width = mText->getMeasuredWidth();
			float height = mText->getMeasuredHeight();
			mLayer->setWidth(mText->getPositionX() + width);
			mLayer->setHeight(math::maxv(height, mGraphic->getHeight()));
		}
		else
		{
			setDelays(0.8f, 1.5f);
			mGraphic->setVisible(false);
			mText->setPosition(8.0f, 8.0f);
			std::stringstream ss;
			ss << mItem->getFullItemName() << '\n';
			ss << "Looks to be a " << ItemCommon::getItemTypeNameNice(mItem->getItemType());
			mText->setText(ss.str().c_str());

			float width = mText->getMeasuredWidth();
			float height = mText->getMeasuredHeight();
			mLayer->setSize(width, height);
		}
	}