Пример #1
0
	void ReverbChannel::SetSamplerate(int samplerate)
	{
		this->samplerate = samplerate;
		highPass.SetSamplerate(samplerate);
		lowPass.SetSamplerate(samplerate);

		for (size_t i = 0; i < lines.size(); i++)
		{
			lines[i]->SetSamplerate(samplerate);
		}

		auto update = [&](Parameter p) { SetParameter(p, parameters[p]); };
		update(Parameter::PreDelay);
		update(Parameter::TapLength);
		update(Parameter::DiffusionDelay);
		update(Parameter::LineDelay);
		update(Parameter::LateDiffusionDelay);
		update(Parameter::EarlyDiffusionModRate);
		update(Parameter::LineModRate);
		update(Parameter::LateDiffusionModRate);
		update(Parameter::LineModAmount);
		UpdateLines();
	}
Пример #2
0
	void ReverbChannel::SetParameter(Parameter para, double value)
	{
		parameters[para] = value;

		switch (para)
		{
		case Parameter::PreDelay:
			preDelay.SampleDelay = (int)Ms2Samples(value);
			break;
		case Parameter::HighPass:
			highPass.SetCutoffHz(value);
			break;
		case Parameter::LowPass:
			lowPass.SetCutoffHz(value);
			break;

		case Parameter::TapCount:
			multitap.SetTapCount((int)value);
			break;
		case Parameter::TapLength:
			multitap.SetTapLength((int)Ms2Samples(value));
			break;
		case Parameter::TapGain:
			multitap.SetTapGain(value);
			break;
		case Parameter::TapDecay:
			multitap.SetTapDecay(value);
			break;

		case Parameter::DiffusionEnabled:
		{
			auto newVal = value >= 0.5;
			if (newVal != diffuserEnabled)
				diffuser.ClearBuffers();
			diffuserEnabled = newVal;
			break;
		}
		case Parameter::DiffusionStages:
			diffuser.Stages = (int)value;
			break;
		case Parameter::DiffusionDelay:
			diffuser.SetDelay((int)Ms2Samples(value));
			break;
		case Parameter::DiffusionFeedback:
			diffuser.SetFeedback(value);
			break;

		case Parameter::LineCount:
			lineCount = (int)value;
			perLineGain = GetPerLineGain();
			break;
		case Parameter::LineDelay:
			UpdateLines();
			break;
		case Parameter::LineFeedback:
			UpdateLines();
			break;

		case Parameter::LateDiffusionEnabled:
			for (auto line : lines)
			{
				auto newVal = value >= 0.5;
				if (newVal != line->DiffuserEnabled)
					line->ClearDiffuserBuffer();
				line->DiffuserEnabled = newVal;
			}
			break;
		case Parameter::LateDiffusionStages:
			for(auto line : lines)
				line->SetDiffuserStages((int)value);
			break;
		case Parameter::LateDiffusionDelay:
			for (auto line : lines)
				line->SetDiffuserDelay((int)Ms2Samples(value));
			break;
		case Parameter::LateDiffusionFeedback:
			for (auto line : lines)
				line->SetDiffuserFeedback(value);
			break;

		case Parameter::PostLowShelfGain:
			for (auto line : lines)
				line->SetLowShelfGain(value);
			break;
		case Parameter::PostLowShelfFrequency:
			for (auto line : lines)
				line->SetLowShelfFrequency(value);
			break;
		case Parameter::PostHighShelfGain:
			for (auto line : lines)
				line->SetHighShelfGain(value);
			break;
		case Parameter::PostHighShelfFrequency:
			for (auto line : lines)
				line->SetHighShelfFrequency(value);
			break;
		case Parameter::PostCutoffFrequency:
			for (auto line : lines)
				line->SetCutoffFrequency(value);
			break;

		case Parameter::EarlyDiffusionModAmount:
			diffuser.SetModulationEnabled(value > 0.0);
			diffuser.SetModAmount(Ms2Samples(value));
			break;
		case Parameter::EarlyDiffusionModRate:
			diffuser.SetModRate(value);
			break;
		case Parameter::LineModAmount:
			UpdateLines();
			break;
		case Parameter::LineModRate:
			UpdateLines();
			break;
		case Parameter::LateDiffusionModAmount:
			UpdateLines();
			break;
		case Parameter::LateDiffusionModRate:
			UpdateLines();
			break;

		case Parameter::TapSeed:
			multitap.SetSeed(value);
			break;
		case Parameter::DiffusionSeed:
			diffuser.SetSeed(value);
			break;
		case Parameter::DelaySeed:
			delayLineSeed = value;
			UpdateLines();
			break;
		case Parameter::PostDiffusionSeed:
			postDiffusionSeed = value;
			UpdatePostDiffusion();
			break;

		case Parameter::CrossSeed:
			crossSeed = value;
			multitap.SetCrossSeed(value);
			diffuser.SetCrossSeed(value);
			UpdateLines();
			UpdatePostDiffusion();
			break;

		case Parameter::DryOut:
			dryOut = value;
			break;
		case Parameter::PredelayOut:
			predelayOut = value;
			break;
		case Parameter::EarlyOut:
			earlyOut = value;
			break;
		case Parameter::MainOut:
			lineOut = value;
			break;

		case Parameter::HiPassEnabled:
			highPassEnabled = value >= 0.5;
			break;
		case Parameter::LowPassEnabled:
			lowPassEnabled = value >= 0.5;
			break;
		case Parameter::LowShelfEnabled:
			for (auto line : lines)
				line->LowShelfEnabled = value >= 0.5;
			break;
		case Parameter::HighShelfEnabled:
			for (auto line : lines)
				line->HighShelfEnabled = value >= 0.5;
			break;
		case Parameter::CutoffEnabled:
			for (auto line : lines)
				line->CutoffEnabled = value >= 0.5;
			break;
		case Parameter::LateStageTap:
			for (auto line : lines)
				line->LateStageTap = value >= 0.5;
			break;

		case Parameter::Interpolation:
			for (auto line : lines)
				line->SetInterpolationEnabled(value >= 0.5);
			break;
		}
	}
Пример #3
0
void CParticleEngine::Update()
{
	UpdateLines();
}
Пример #4
0
void XnVPushDetector::AddPoint(const XnPoint3D& pt, XnFloat fTime)
{
	m_pPoints->AddPoint(pt, fTime);
	UpdateLines(fTime);
} // XnVPushDetector::AddPoint
Пример #5
0
void SpotLightShape::UpdateInnerConeAndLines()
{
	//Formula to get Size
	// Size = 2 * distance * tan(angle / 2)
	float size = 2.0f * 1.0f * glm::tan(glm::radians(m_FallOffAngle / 2.0f));
	float nearSize = 2.0f * m_NearAttenuation * glm::tan(glm::radians(m_FallOffAngle / 2.0f));
	float farSize = 2.0f * m_FarAttenuation * glm::tan(glm::radians(m_FallOffAngle / 2.0f));

	UpdateRingInfo(m_InnerConeAndLinesVtxs, size, 1.0f, m_InnerCircleColor);

	////////////////////////////////////////////////
	//Update Lines

	//Where to start setting lines
	uint32_t idxStart = m_SizeOfRings;

	////////////////////////////////////////////////
	//4 from Start to inner ring
	glm::vec3 startPoints[4];
	glm::vec3 endPoints[4];

	////////////////////////////////////////////////
	//Update from Start to Inner Circle
	startPoints[0] = startPoints[1] = startPoints[2] = startPoints[3] = AEMathHelpers::Vec3fZero;

	endPoints[0] = glm::vec3(size / 2.0f, 0.0f, 1.0f);
	endPoints[1] = glm::vec3(0.0f, -size / 2.0f, 1.0f);
	endPoints[2] = glm::vec3(0.0f, size / 2.0f, 1.0f);
	endPoints[3] = glm::vec3(-size / 2.0f, 0.0f, 1.0f);

	UpdateLines(idxStart, startPoints, endPoints, m_LineInnerColor);
	idxStart += 8;

	////////////////////////////////////////////////
	//Update from Inner Circle to Near Fall Off Attenuation Ring
	startPoints[0] = endPoints[0];
	startPoints[1] = endPoints[1];
	startPoints[2] = endPoints[2];
	startPoints[3] = endPoints[3];

	endPoints[0] = glm::vec3(nearSize / 2.0f, 0.0f, m_NearAttenuation);
	endPoints[1] = glm::vec3(0.0f, -nearSize / 2.0f, m_NearAttenuation);
	endPoints[2] = glm::vec3(0.0f, nearSize / 2.0f, m_NearAttenuation);
	endPoints[3] = glm::vec3(-nearSize / 2.0f, 0.0f, m_NearAttenuation);

	UpdateLines(idxStart, startPoints, endPoints, m_LineNearColor);
	idxStart += 8;

	////////////////////////////////////////////////
	//Update from Near Fall Off Attenuation Ring to Far Fall off Attenuation Ring
	startPoints[0] = endPoints[0];
	startPoints[1] = endPoints[1];
	startPoints[2] = endPoints[2];
	startPoints[3] = endPoints[3];

	endPoints[0] = glm::vec3(farSize / 2.0f, 0.0f, m_FarAttenuation);
	endPoints[1] = glm::vec3(0.0f, -farSize / 2.0f, m_FarAttenuation);
	endPoints[2] = glm::vec3(0.0f, farSize / 2.0f, m_FarAttenuation);
	endPoints[3] = glm::vec3(-farSize / 2.0f, 0.0f, m_FarAttenuation);

	UpdateLines(idxStart, startPoints, endPoints, m_LineFarColor);
}