<commit_before>/** @file
 *
 * @ingroup audioGraphLibrary
 *
 * @brief Wraps an object from Jamoma DSP to function within AudioGraph 
 *
 * @details The TTAudioGraphObjectBase wraps a Jamoma DSP object such that it is possible to build a dynamic graph of audio processing units. It is implemented as a #TTObjectBase so that it can receive dynamically bound messages,
 * including notifications from other objects.
 *
 * @authors <NAME>, <NAME>
 *
 * @copyright Copyright © 2010, <NAME> @n
 * This code is licensed under the terms of the "New BSD License" @n
 * http://creativecommons.org/licenses/BSD/
 */


#include "TTAudioGraphObject.h"
#include "TTAudioGraphInlet.h"
#include "TTAudioGraphOutlet.h"

#define thisTTClass			TTAudioGraphObjectBase

TTMutexPtr TTAudioGraphObjectBase::sSharedMutex = NULL;


//	Arguments
//	1. (required) The name of the Jamoma DSP object you want to wrap
//	2. (optional) Number of inlets, default = 1
//	3. (optional) Number of outlets, default = 1


TTObjectBasePtr TTAudioGraphObjectBase::instantiate(TTSymbol name, TTValue arguments)
{
	return new TTAudioGraphObjectBase(arguments);
}

extern "C" void TTAudioGraphObjectBase::registerClass() 
{
	TTClassRegister(TT("audio.object"), "audio, graph, wrapper", TTAudioGraphObjectBase::instantiate );
}


TTAudioGraphObjectBase :: TTAudioGraphObjectBase (const TTValue& arguments) :
	TTGraphObjectBase(arguments),
	mStatus(kTTAudioGraphProcessUnknown),
	mAudioFlags(kTTAudioGraphProcessor), 
	mInputSignals(NULL), 
	mOutputSignals(NULL), 
	mVectorSize(0),
	mSampleStamp(-1)
{
	TTSymbol	wrappedObjectName = kTTSymEmpty;
	TTUInt16	numInlets = 1;
	TTUInt16	numOutlets = 1;
	
	addAttributeWithSetter(NumAudioInlets, kTypeUInt32);
	addAttributeWithSetter(NumAudioOutlets, kTypeUInt32);
	
	TT_ASSERT(audiograph_correct_instantiation_arg_count, (arguments.size() > 0));

	wrappedObjectName = arguments[0];
	if (arguments.size() > 1)
		numInlets = arguments[1];
	if (arguments.size() > 2)
		numOutlets = arguments[2];
	
	setAttributeValue(TT("numAudioInlets"), numInlets);
	setAttributeValue(TT("numAudioOutlets"), numOutlets);
	
	// if an object supports the 'setOwner' message, then we tell it that we want to become the owner
	// this is particularly important for the dac object
	TTValue v = TTPtr(this);
	TTValue unusedReturnValue;
	mKernel.send("setOwner", v, unusedReturnValue);<commit_msg>TTAudioGraphObject: fix for passing bogus arg to constructor of audio stream arrays.<commit_after>/** @file
 *
 * @ingroup audioGraphLibrary
 *
 * @brief Wraps an object from Jamoma DSP to function within AudioGraph 
 *
 * @details The TTAudioGraphObjectBase wraps a Jamoma DSP object such that it is possible to build a dynamic graph of audio processing units. It is implemented as a #TTObjectBase so that it can receive dynamically bound messages,
 * including notifications from other objects.
 *
 * @authors <NAME>, <NAME>
 *
 * @copyright Copyright © 2010, <NAME> @n
 * This code is licensed under the terms of the "New BSD License" @n
 * http://creativecommons.org/licenses/BSD/
 */


#include "TTAudioGraphObject.h"
#include "TTAudioGraphInlet.h"
#include "TTAudioGraphOutlet.h"

#define thisTTClass			TTAudioGraphObjectBase

TTMutexPtr TTAudioGraphObjectBase::sSharedMutex = NULL;


//	Arguments
//	1. (required) The name of the Jamoma DSP object you want to wrap
//	2. (optional) Number of inlets, default = 1
//	3. (optional) Number of outlets, default = 1


TTObjectBasePtr TTAudioGraphObjectBase::instantiate(TTSymbol name, TTValue arguments)
{
	return new TTAudioGraphObjectBase(arguments);
}

extern "C" void TTAudioGraphObjectBase::registerClass() 
{
	TTClassRegister(TT("audio.object"), "audio, graph, wrapper", TTAudioGraphObjectBase::instantiate );
}


TTAudioGraphObjectBase :: TTAudioGraphObjectBase (const TTValue& arguments) :
	TTGraphObjectBase(arguments),
	mStatus(kTTAudioGraphProcessUnknown),
	mAudioFlags(kTTAudioGraphProcessor), 
	mInputSignals(1),
	mOutputSignals(1),
	mVectorSize(0),
	mSampleStamp(-1)
{
	TTSymbol	wrappedObjectName = kTTSymEmpty;
	TTUInt16	numInlets = 1;
	TTUInt16	numOutlets = 1;
	
	addAttributeWithSetter(NumAudioInlets, kTypeUInt32);
	addAttributeWithSetter(NumAudioOutlets, kTypeUInt32);
	
	TT_ASSERT(audiograph_correct_instantiation_arg_count, (arguments.size() > 0));

	wrappedObjectName = arguments[0];
	if (arguments.size() > 1)
		numInlets = arguments[1];
	if (arguments.size() > 2)
		numOutlets = arguments[2];
	
	setAttributeValue(TT("numAudioInlets"), numInlets);
	setAttributeValue(TT("numAudioOutlets"), numOutlets);
	
	// if an object supports the 'setOwner' message, then we tell it that we want to become the owner
	// this is particularly important for the dac object
	TTValue v = TTPtr(this);
	TTValue unusedReturnValue;
	mKernel.send("setOwner", v, unusedReturnValue);
{'fraction_non_alphanumeric': 0.09819013938007073, 'fraction_numerical': 0.011649677553567713, 'mean_word_length': 5.6134800550206325, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2487235', 'n_tokens_mistral': 1596, 'n_tokens_neox': 1496, 'n_words': 438}