ArrayArrayArray BrainModular BrainModular Users Forum 2018-04-13T10:47:49+02:00 https://brainmodular.com/forums/app.php/feed/topic/6192 2018-04-13T10:47:49+02:00 2018-04-13T10:47:49+02:00 https://brainmodular.com/forums/viewtopic.php?t=6192&p=39750#p39750 <![CDATA[how to correctly pass parameters into module]]>
when you take a look at
https://github.com/drakh/Hollyhock-Modu ... erator.cpp

those needed parameters sits on lines 8-10, so the question is where to put them that thay will be "private" for each instance of the module
As you have found, the thing that is unique to an instance of the module is the class. At least on windows, anything else will be shared by all intances of the module. I don't know if user modules on MAC behave the same way.

So you put the parameters in the class where you put the events, e.g.

class AdvancedEuclideanGenerator : public UserModuleBase
{
public:
AdvancedEuclideanGenerator(){};
virtual ~AdvancedEuclideanGenerator(){};
public:
void onGetModuleInfo (MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo);
void onInitModule (MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo);
void onGetParamInfo (int ParamIndex, TParamInfo* pParamInfo);
void onCallBack (UsineMessage *Message);
private:
//-------------------------------------------------------------------------
// parameters events
UsineEventPtr dtfInputSteps;
UsineEventPtr dtfInputBeats;
UsineEventPtr dtfInputAccents;
UsineEventPtr dtfInputGenerate;
UsineEventPtr dftBeatsOut;
UsineEventPtr dftAccentsOut;
inline void updateCellsValues();

int steps = 16;
int beats = 0;
int accents = 0;
};

Statistics: Posted by sm_jamieson — 13 Apr 2018, 10:47


]]>
2018-04-13T10:35:58+02:00 2018-04-13T10:35:58+02:00 https://brainmodular.com/forums/viewtopic.php?t=6192&p=39749#p39749 <![CDATA[how to correctly pass parameters into module]]> https://github.com/drakh/Hollyhock-Modu ... erator.cpp

those needed parameters sits on lines 8-10, so the question is where to put them that thay will be "private" for each instance of the module

Statistics: Posted by drakh — 13 Apr 2018, 10:35


]]>
2018-04-13T10:33:16+02:00 2018-04-13T10:33:16+02:00 https://brainmodular.com/forums/viewtopic.php?t=6192&p=39748#p39748 <![CDATA[how to correctly pass parameters into module]]>
https://drive.google.com/file/d/1-V7NsB ... sp=sharing

tehere are three identical patches, each one using my module "Advanced euclidean generator" ( the code is abialable here https://github.com/drakh/Hollyhock-Modu ... nGenerator )

Now the problem.

when i change input value for one module for example - "beats" this input value is changed in each module in the workspace you can see it in linked screenshot - i changed beats and accetns in first patch, then clicked to generate in each of those other patches, and the output is the same for each instance of the module.

When i will change for example "accents" in the middle patch to "3" and then i generate the sequence for each module, each module will output 3 ticks in accents array.

I know that HH SDK modules shares memory, so the question is how to fill those data in .cpp that each instance of the module will have its "own" input parameters

thank you

Statistics: Posted by drakh — 13 Apr 2018, 10:33


]]>
BrainModular BrainModular Users Forum 2018-04-13T10:47:49+02:00 https://brainmodular.com/forums/app.php/feed/topic/6192 2018-04-13T10:47:49+02:00 2018-04-13T10:47:49+02:00 https://brainmodular.com/forums/viewtopic.php?t=6192&p=39750#p39750 <![CDATA[how to correctly pass parameters into module]]>
when you take a look at
https://github.com/drakh/Hollyhock-Modu ... erator.cpp

those needed parameters sits on lines 8-10, so the question is where to put them that thay will be "private" for each instance of the module
As you have found, the thing that is unique to an instance of the module is the class. At least on windows, anything else will be shared by all intances of the module. I don't know if user modules on MAC behave the same way.

So you put the parameters in the class where you put the events, e.g.

class AdvancedEuclideanGenerator : public UserModuleBase
{
public:
AdvancedEuclideanGenerator(){};
virtual ~AdvancedEuclideanGenerator(){};
public:
void onGetModuleInfo (MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo);
void onInitModule (MasterInfo* pMasterInfo, ModuleInfo* pModuleInfo);
void onGetParamInfo (int ParamIndex, TParamInfo* pParamInfo);
void onCallBack (UsineMessage *Message);
private:
//-------------------------------------------------------------------------
// parameters events
UsineEventPtr dtfInputSteps;
UsineEventPtr dtfInputBeats;
UsineEventPtr dtfInputAccents;
UsineEventPtr dtfInputGenerate;
UsineEventPtr dftBeatsOut;
UsineEventPtr dftAccentsOut;
inline void updateCellsValues();

int steps = 16;
int beats = 0;
int accents = 0;
};

Statistics: Posted by sm_jamieson — 13 Apr 2018, 10:47


]]>
2018-04-13T10:35:58+02:00 2018-04-13T10:35:58+02:00 https://brainmodular.com/forums/viewtopic.php?t=6192&p=39749#p39749 <![CDATA[how to correctly pass parameters into module]]> https://github.com/drakh/Hollyhock-Modu ... erator.cpp

those needed parameters sits on lines 8-10, so the question is where to put them that thay will be "private" for each instance of the module

Statistics: Posted by drakh — 13 Apr 2018, 10:35


]]>
2018-04-13T10:33:16+02:00 2018-04-13T10:33:16+02:00 https://brainmodular.com/forums/viewtopic.php?t=6192&p=39748#p39748 <![CDATA[how to correctly pass parameters into module]]>
https://drive.google.com/file/d/1-V7NsB ... sp=sharing

tehere are three identical patches, each one using my module "Advanced euclidean generator" ( the code is abialable here https://github.com/drakh/Hollyhock-Modu ... nGenerator )

Now the problem.

when i change input value for one module for example - "beats" this input value is changed in each module in the workspace you can see it in linked screenshot - i changed beats and accetns in first patch, then clicked to generate in each of those other patches, and the output is the same for each instance of the module.

When i will change for example "accents" in the middle patch to "3" and then i generate the sequence for each module, each module will output 3 ticks in accents array.

I know that HH SDK modules shares memory, so the question is how to fill those data in .cpp that each instance of the module will have its "own" input parameters

thank you

Statistics: Posted by drakh — 13 Apr 2018, 10:33


]]>