<commit_before>/* 
 * LowpassFunction Unit for TTBlue
 * Originally written for the Jamoma FunctionLib
 * Copyright © 2007 by <NAME>
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "LowpassFunction.h"
#define thisTTClass LowpassFunction


LowpassFunction::LowpassFunction(TTUInt16 newMaxNumChannels)
	: TTAudioObject("lowpass", newMaxNumChannels), feedback(NULL)
{
	registerAttributeWithSetter(coefficient, kTypeFloat64);
	registerMessageSimple(clear);
	registerMessageWithArgument(updateMaxNumChannels);
	
	// Set Defaults...
	setAttributeValue(TT("coefficient"), 0.75);
	sendMessage(TT("clear"));
	
	setProcessMethod(processAudio);
	setCalculateMethod(calculateValue);
	setAttributeValue(TT("maxNumChannels"),	newMaxNumChannels);			// This attribute is inherited
}

LowpassFunction::~LowpassFunction()
{
	delete[] feedback;
}


TTErr LowpassFunction::updateMaxNumChannels(const TTValue& oldMaxNumChannels)
{
	delete[] feedback;
	feedback = new TTFloat64[maxNumChannels];
	return clear();
}

<commit_msg>channel allocation has to happen before calling clear on lowpass<commit_after>/* 
 * LowpassFunction Unit for TTBlue
 * Originally written for the Jamoma FunctionLib
 * Copyright © 2007 by <NAME>
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "LowpassFunction.h"
#define thisTTClass LowpassFunction


LowpassFunction::LowpassFunction(TTUInt16 newMaxNumChannels)
	: TTAudioObject("lowpass", newMaxNumChannels), feedback(NULL)
{
	registerAttributeWithSetter(coefficient, kTypeFloat64);
	registerMessageSimple(clear);
	registerMessageWithArgument(updateMaxNumChannels);
	
	// Set Defaults...
	setAttributeValue(TT("maxNumChannels"),	newMaxNumChannels);			// This attribute is inherited
	setAttributeValue(TT("coefficient"), 0.75);
	sendMessage(TT("clear"));
	
	setProcessMethod(processAudio);
	setCalculateMethod(calculateValue);
}

LowpassFunction::~LowpassFunction()
{
	delete[] feedback;
}


TTErr LowpassFunction::updateMaxNumChannels(const TTValue& oldMaxNumChannels)
{
	delete[] feedback;
	feedback = new TTFloat64[maxNumChannels];
	return clear();
}


{'fraction_non_alphanumeric': 0.10735227785295444, 'fraction_numerical': 0.011727559765448805, 'mean_word_length': 6.54421768707483, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6976994', 'n_tokens_mistral': 709, 'n_tokens_neox': 665, 'n_words': 149}