ArrayArrayArray BrainModular BrainModular Users Forum 2011-02-05T13:41:59+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/2682 2011-02-05T13:41:59+02:00 2011-02-05T13:41:59+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2682&p=17912#p17912 <![CDATA[CallBack procedure [script]]]>
"You only need to use Process whenever there is something you want to be done within a block without any callbacks",

Thanks for this precision!

Digging so slowly in script :)....

Statistics: Posted by ethnix73 — 05 Feb 2011, 12:41


]]>
2011-02-05T11:52:09+02:00 2011-02-05T11:52:09+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2682&p=17911#p17911 <![CDATA[CallBack procedure [script]]]>
Another approach is to have a Boolean variable set to TRUE in the callback, and then check that variable in Process, do the calculations, and set the Boolean to FALSE.

BTW, for a little script like this I don't see much point in sweating over optimizations, and I don't think you'd notice much difference in CPU anyway. The one thing you could o, hoiwever, is remove the Process procedure as it isn't needed. You only need to use Process whenever there is something you want to be done within a block without any callbacks; eg zeroing an MIDI output array or checking some timing vaiables.

Statistics: Posted by bsork — 05 Feb 2011, 10:52


]]>
2011-02-04T13:06:58+02:00 2011-02-04T13:06:58+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2682&p=17908#p17908 <![CDATA[CallBack procedure [script]]]>
I'm wondering if my script is buggy or not.

Do i really need to put everything in the callback procedure?
As the callback procedure is calculated each time the in parameters change, Is it to cpu intensive?
Is it buggy?

I'm still confused about this

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar BarDur &#58; Tparameter;var result1 &#58; single;var d &#58; single;var a,b,c &#58; single;var length &#58; Tparameter;var NbBeats &#58; Tparameter;var tempo &#58; single;var tempoOut &#58; Tparameter;var i,j &#58; single;var x &#58; single;var speed &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  BarDur &#58;=Createparam&#40;'BarDur', ptDataFader&#41;;SetIsOutput&#40;barDur,FALSE&#41;;SetMax&#40;Bardur,50000&#41;;Length &#58;=CreateParam&#40;'Length', ptDataFader&#41;;SetIsOutput&#40;Length,FALSE&#41;;SetMax&#40;Length,50000&#41;;NbBeats &#58;=CreateParam&#40;'NbBeats', ptDataFader&#41;;SetIsOutput&#40;NbBeats,FALSE&#41;;TempoOut &#58;=CreateParam&#40;'TempoOut', ptDataFader&#41;;SetIsInput&#40;Tempoout,FALSE&#41;;SetMax&#40;TempoOut,1000&#41;;speed &#58;=Createparam&#40;'speed',ptDataFader&#41;;SetisInput&#40;speed,FALSE&#41;;SetMax&#40;speed,50000&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginIf &#40;n=BarDur&#41; OR &#40;n=Length&#41; OR &#40;n=NbBeats&#41; then begind &#58;= GetValue&#40;BarDur&#41;;result1 &#58;= 480000/d;a &#58;= GetValue&#40;length&#41;;b &#58;= GetValue&#40;NbBeats&#41;;c &#58;= &#40;a/b&#41;/1000;tempo &#58;=60/c;SetValue &#40;TempoOut, tempo&#41;;i &#58;=result1;j &#58;=tempo;x &#58;= &#40;i/j&#41;*100;SetValue&#40;speed,x&#41;;end;end;// Global variables//////////////////////////////// main proc//////////////////////////////Procedure Process;beginend;

Statistics: Posted by ethnix73 — 04 Feb 2011, 12:06


]]>
BrainModular BrainModular Users Forum 2011-02-05T13:41:59+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/2682 2011-02-05T13:41:59+02:00 2011-02-05T13:41:59+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2682&p=17912#p17912 <![CDATA[CallBack procedure [script]]]>
"You only need to use Process whenever there is something you want to be done within a block without any callbacks",

Thanks for this precision!

Digging so slowly in script :)....

Statistics: Posted by ethnix73 — 05 Feb 2011, 12:41


]]>
2011-02-05T11:52:09+02:00 2011-02-05T11:52:09+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2682&p=17911#p17911 <![CDATA[CallBack procedure [script]]]>
Another approach is to have a Boolean variable set to TRUE in the callback, and then check that variable in Process, do the calculations, and set the Boolean to FALSE.

BTW, for a little script like this I don't see much point in sweating over optimizations, and I don't think you'd notice much difference in CPU anyway. The one thing you could o, hoiwever, is remove the Process procedure as it isn't needed. You only need to use Process whenever there is something you want to be done within a block without any callbacks; eg zeroing an MIDI output array or checking some timing vaiables.

Statistics: Posted by bsork — 05 Feb 2011, 10:52


]]>
2011-02-04T13:06:58+02:00 2011-02-04T13:06:58+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2682&p=17908#p17908 <![CDATA[CallBack procedure [script]]]>
I'm wondering if my script is buggy or not.

Do i really need to put everything in the callback procedure?
As the callback procedure is calculated each time the in parameters change, Is it to cpu intensive?
Is it buggy?

I'm still confused about this

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar BarDur &#58; Tparameter;var result1 &#58; single;var d &#58; single;var a,b,c &#58; single;var length &#58; Tparameter;var NbBeats &#58; Tparameter;var tempo &#58; single;var tempoOut &#58; Tparameter;var i,j &#58; single;var x &#58; single;var speed &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  BarDur &#58;=Createparam&#40;'BarDur', ptDataFader&#41;;SetIsOutput&#40;barDur,FALSE&#41;;SetMax&#40;Bardur,50000&#41;;Length &#58;=CreateParam&#40;'Length', ptDataFader&#41;;SetIsOutput&#40;Length,FALSE&#41;;SetMax&#40;Length,50000&#41;;NbBeats &#58;=CreateParam&#40;'NbBeats', ptDataFader&#41;;SetIsOutput&#40;NbBeats,FALSE&#41;;TempoOut &#58;=CreateParam&#40;'TempoOut', ptDataFader&#41;;SetIsInput&#40;Tempoout,FALSE&#41;;SetMax&#40;TempoOut,1000&#41;;speed &#58;=Createparam&#40;'speed',ptDataFader&#41;;SetisInput&#40;speed,FALSE&#41;;SetMax&#40;speed,50000&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginIf &#40;n=BarDur&#41; OR &#40;n=Length&#41; OR &#40;n=NbBeats&#41; then begind &#58;= GetValue&#40;BarDur&#41;;result1 &#58;= 480000/d;a &#58;= GetValue&#40;length&#41;;b &#58;= GetValue&#40;NbBeats&#41;;c &#58;= &#40;a/b&#41;/1000;tempo &#58;=60/c;SetValue &#40;TempoOut, tempo&#41;;i &#58;=result1;j &#58;=tempo;x &#58;= &#40;i/j&#41;*100;SetValue&#40;speed,x&#41;;end;end;// Global variables//////////////////////////////// main proc//////////////////////////////Procedure Process;beginend;

Statistics: Posted by ethnix73 — 04 Feb 2011, 12:06


]]>