<commit_before>/*
 * TTBlue DC Offset Filter and Blocker 
 * Copyright © 2008, <NAME>
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "TTDCBlock.h"


TTDCBlock::TTDCBlock()
{
	registerMessage("clear", clear);	// make the clear method public
	setProcess(processAudio);			// tell the base class what routine to use for processing audio
	clear();							// clear our feedback storage variables
}


TTDCBlock::~TTDCBlock()
{
	;
}


TTErr TTDCBlock::clear()
{
	short i;

	for(i=0; i<TT_MAX_NUM_CHANNELS; i++){
		last_input[i] = 0;
		last_output[i] = 0;
	}
	return TT_ERR_NONE;
}


// DSP LOOP
// Note: an algorithm that is frequently used in Max:
//		"biquad~ 1.0 -1.0 -0.9997 0.0"
TTErr TTDCBlock::processAudio(TTAudioSignal& in, TTAudioSignal& out)
{
	short			vs;
	TTSampleValue	*inSample,
					*outSample;
	short			numchannels = getMinChannelCount(in, out);
	short			channel;
	TTSampleValue	temp;

	//	TODO: this should be implmenented in the base class as an attr which switches the function pointer
	//	if(bypassAttribute)
	//		return [super processAudioWithInput:audioIn andOutput:audioOut];

	for(channel=0; channel<numchannels; channel++){
		inSample = in->vectors[channel];
		outSample = out->vectors[channel];
		vs = in->vs;
		
		while(vs--){
			temp = *inSample++;
			*outSample++ = lastOutput[channel] = TTAntiDenormal(temp - lastInput[channel] + (lastOutput[channel] * 0.9997));
			lastInput[channel] = temp;
		}<commit_msg>typo<commit_after>/*
 * TTBlue DC Offset Filter and Blocker 
 * Copyright © 2008, <NAME>
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "TTDCBlock.h"


TTDCBlock::TTDCBlock()
{
	registerMessage("clear", clear);	// make the clear method public
	setProcess(processAudio);			// tell the base class what routine to use for processing audio
	clear();							// clear our feedback storage variables
}


TTDCBlock::~TTDCBlock()
{
	;
}


TTErr TTDCBlock::clear()
{
	short i;

	for(i=0; i<TT_MAX_NUM_CHANNELS; i++){
		lastInput[i] = 0;
		lastOutput[i] = 0;
	}
	return TT_ERR_NONE;
}


// DSP LOOP
// Note: an algorithm that is frequently used in Max:
//		"biquad~ 1.0 -1.0 -0.9997 0.0"
TTErr TTDCBlock::processAudio(TTAudioSignal& in, TTAudioSignal& out)
{
	short			vs;
	TTSampleValue	*inSample,
					*outSample;
	short			numchannels = getMinChannelCount(in, out);
	short			channel;
	TTSampleValue	temp;

	//	TODO: this should be implmenented in the base class as an attr which switches the function pointer
	//	if(bypassAttribute)
	//		return [super processAudioWithInput:audioIn andOutput:audioOut];

	for(channel=0; channel<numchannels; channel++){
		inSample = in->vectors[channel];
		outSample = out->vectors[channel];
		vs = in->vs;
		
		while(vs--){
			temp = *inSample++;
			*outSample++ = lastOutput[channel] = TTAntiDenormal(temp - lastInput[channel] + (lastOutput[channel] * 0.9997));
			lastInput[channel] = temp;
		}
{'fraction_non_alphanumeric': 0.1316927169936814, 'fraction_numerical': 0.015962753574991686, 'mean_word_length': 3.923076923076923, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4980907', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1046, 'n_words': 284}