C++ questions \ help .

Hi guys I will post here newbie questions about c++ and touch.
hopefully my questions will benefit others.

Assume i want to create chop with more than 1 channel as in the example
what is the a fine way to do so ?:

my try so far :

1.changed to 3 the number of channels :

[code]CPlusPlusCHOPExample::getOutputInfo(CHOP_OutputInfo* info)
{
// If there is an input connected, we are going to match it’s channel names etc
// otherwise we’ll specify our own.
if (info->opInputs->getNumInputs() > 0)
{
return false;
}
else
{
info->numChannels = 3;

	// Since we are outputting a timeslice, the system will dictate
	// the numSamples and startIndex of the CHOP data
	//info->numSamples = 1;
	//info->startIndex = 0

	// For illustration we are going to output 120hz data
	info->sampleRate = 120;
	return true; [/code]
  1. adding private string array variable called “nameList” in the example header.

[code]private:

// We don't need to store this pointer, but we do for the example.
// The OP_NodeInfo class store information about the node that's using
// this instance of the class (like its name).
const OP_NodeInfo*	myNodeInfo;

// In this example this value will be incremented each time the execute()
// function is called, then passes back to the CHOP 
int32_t				myExecuteCount;

std::string nameList[3] ;


double				myOffset;[/code]

Initialize in constructor :

[code]CPlusPlusCHOPExample::CPlusPlusCHOPExample(const OP_NodeInfo* info) : myNodeInfo(info)
{
myExecuteCount = 0;
myOffset = 0.0;
nameList[0] = “gal”;
nameList[1] = “barak”;
nameList[2] = “moshe”;

}[/code]

3.return the array with the incoming index:

[code]CPlusPlusCHOPExample::getChannelName(int32_t index, void* reserved)
{

 return (nameList[index].c_str());

//return "chan1";

}[/code]

I did include in the headr too

thanks

Offhand this seems fine. What is your question?

just alone here
no one to ask and talk about it :slight_smile:
More question are coming soon.

1 Like