Esempio n. 1
0
void NeuronType::convolveFilters() {
   const float deltaT = SystemVar::GetFloatVar("deltaT");
   Filter* synapticFilter = m_synapseType.getFilter();
   float* vals = synapticFilter->getFilter();
   if (deltaT > verySmallFloat) {
      if ((m_dendriteToSomaFilter.size() > 1) && (synapticFilter->size() > 1)) {
         unsigned int convSize = m_dendriteToSomaFilter.size() + synapticFilter->size() - 1;
         m_convolvedFilter.setFilter(Calc::convolve(
                                         m_dendriteToSomaFilter.getFilter(), m_dendriteToSomaFilter.size(),
                                         synapticFilter->getFilter(), synapticFilter->size(), deltaT), convSize);
      } else if (m_dendriteToSomaFilter.size() > 1) {
         m_convolvedFilter.setFilter(m_dendriteToSomaFilter.getFilter(), m_dendriteToSomaFilter.size());
      } else {
         m_convolvedFilter.setFilter(synapticFilter->getFilter(), synapticFilter->size());
      }
   }
}
Esempio n. 2
0
bool Source::setEffect(const char *name, const std::map<Filter::Parameter, float> &params)
{
	ALuint slot, target;
	Filter *filter = nullptr;

	// effect with this name doesn't exist
	if (!dynamic_cast<Audio*>(audiomodule())->getEffectID(name, target))
		return false;

	auto iter = effectmap.find(name);
	if (iter == effectmap.end())
	{
		// new send target needed but no more room
		if (slotlist.empty())
			return false;

		slot = slotlist.top();
		slotlist.pop();
	}
	else
	{
		slot = iter->second.slot;
		filter = iter->second.filter;
	}
	if (!filter)
		filter = new Filter();

	effectmap[name] = {filter, slot, target};

	filter->setParams(params);

#ifdef ALC_EXT_EFX
	if (valid)
	{
		//in case of failure contains AL_FILTER_NULL, a valid non-filter
		alSource3i(source, AL_AUXILIARY_SEND_FILTER, target, slot, filter->getFilter());
		//alGetError();
	}
#endif
	return true;
}