<commit_before>/* 
 * Lydbaer Extensions for TTBlue
 * Creates a wrapper for TTAudioObjects that can be used to build an audio processing graph.
 * Copyright © 2008, <NAME>
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "multicore.h"
#define thisTTClass MCoreSource


MCoreSource::MCoreSource(TTUInt16 newMaxNumChannels)
: TTAudioObject("multicore.source", newMaxNumChannels)
{
	buffer = new TTAudioSignal(newMaxNumChannels);
	setProcessMethod(processAudio);
}


MCoreSource::~MCoreSource()
{
	delete buffer;
}


TTErr MCoreSource::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
	TTAudioSignal&	out = outputs->getSignal(0);
	return TTAudioSignal::copy(*buffer, out);
}
<commit_msg>*** Proper object life-cycle management for internal buffer -- not having this causes memory corruption because the reference counting on the object was wrong! ***<commit_after>/* 
 * Lydbaer Extensions for TTBlue
 * Creates a wrapper for TTAudioObjects that can be used to build an audio processing graph.
 * Copyright © 2008, <NAME>
 * 
 * License: This code is licensed under the terms of the GNU LGPL
 * http://www.gnu.org/licenses/lgpl.html 
 */

#include "multicore.h"
#define thisTTClass MCoreSource


MCoreSource::MCoreSource(TTUInt16 newMaxNumChannels)
: TTAudioObject("multicore.source", newMaxNumChannels)
{
	TTObjectInstantiate(kTTSym_audiosignal, &buffer, newMaxNumChannels);
	setProcessMethod(processAudio);
}


MCoreSource::~MCoreSource()
{
	TTObjectRelease(&buffer) ;
}


TTErr MCoreSource::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs)
{
	TTAudioSignal&	out = outputs->getSignal(0);
	return TTAudioSignal::copy(*buffer, out);
}

{'fraction_non_alphanumeric': 0.10045402951191827, 'fraction_numerical': 0.007945516458569807, 'mean_word_length': 5.8599221789883265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7559845', 'n_tokens_mistral': 578, 'n_tokens_neox': 559, 'n_words': 150}