Login | Register 

C++ questions \ help .

Still a little green? Ask your beginner's questions here

C++ questions \ help .

Postby barakooda » Mon May 14, 2018 8:41 am

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: Select all
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;
      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;

2. adding private string array variable called "nameList" in the example header.

Code: Select all

   // 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;

Initialize in constructor :
Code: Select all
CPlusPlusCHOPExample::CPlusPlusCHOPExample(const OP_NodeInfo* info) : myNodeInfo(info)
   myExecuteCount = 0;
   myOffset = 0.0;
   nameList[0] = "gal";
   nameList[1] = "barak";
   nameList[2] = "moshe";


3.return the array with the incoming index:
Code: Select all
CPlusPlusCHOPExample::getChannelName(int32_t index, void* reserved)

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

   //return "chan1";

I did include <string> in the headr too

User avatar
Posts: 637
Joined: Fri Nov 27, 2009 5:08 pm

Re: C++ questions \ help .

Postby malcolm » Wed May 16, 2018 3:46 pm

Offhand this seems fine. What is your question?
User avatar
Posts: 4318
Joined: Tue Nov 13, 2007 1:11 am

Re: C++ questions \ help .

Postby barakooda » Wed May 16, 2018 4:35 pm

just alone here
no one to ask and talk about it :-)
More question are coming soon.
User avatar
Posts: 637
Joined: Fri Nov 27, 2009 5:08 pm

Return to Beginners

Who is online

Users browsing this forum: Google [Bot] and 15 guests