Statistics: Posted by 23fx23 — 10 Sep 2010, 03:24
Statistics: Posted by gurulogic — 10 Sep 2010, 02:47


CODE:
/////////////////////////////////////////////////////////////////////////////////////// PPQ Clocks gen_ 23fx2K10_ generate clocks from PPQ, each next one beeing divided by 2///////////////////////////////////////////////////////////////////////////////////////// Enter a nb of max bars, that will correspond to the longest cycle (clock0) ie 4bars// then clock1 will be clock0/2 ie 2 bars ect.// to match module enter the nbof steps/bar you want. ie if a line module// with a 32 step/bar enter 32.////////////////////////////////////////////////////////////////////////////////////// parameters declaration////////////////////////const NB_CLOCKS = 5; // nb of clocks output to generate./////////////////////////////var PPQIN, STEPSperbar, MaxBars, SUBDIV: Tparameter;var CLOCKS : Array of Tparameter;var i: integer;var PREC: single;/////////////////////////////////////////////////////////// initialisation : create parametersprocedure init;BEGIN PPQIN := createParam('PPQ IN',PtDataField); setIsOutput(PPQIN,false);StepsPerBar:= createParam('StepsPerBar',PtDataField); setIsOutput(StepsPerBar,false);MaxBars := createParam('Max Bars',PtDatafield); setIsOutput(MaxBars,false);SUBDIV := createParam('SUBDIV',PtDatafield); setIsOutput(SUBDIV,false); setArrayLength(Clocks,NB_CLOCKS); for i:=0 to NB_CLOCKS-1 do begin CLOCKS[i]:= CreateParam('Clock'+IntToStr(i),PtDataField); SetIsInput(Clocks[i],false); end;END;//INIT////////////////////////////////////////////////// Callback procedurevar A,READSTEP,MODSTEP: integer;Procedure Callback(N:integer); BEGINIf (n=PPQIn) then begin PREC:= MAXS(1,getValue(SUBDIV)); A:= round(getValue(stepsPerBar)); for i:= 0 to NB_Clocks-1 do begin READSTEP:= round(getValue(PPQIN)*PREC*(A/4)); MODSTEP:= round((getvalue(maxBars)*(A)*PREC) / power(2,i)); SetValue(Clocks[i],(READSTEP mod MODSTEP)/PREC); end; end;END;//Callback////////////////////////////////////////////////////Statistics: Posted by 23fx23 — 10 Sep 2010, 01:57
Statistics: Posted by 23fx23 — 10 Sep 2010, 00:10
Statistics: Posted by gurulogic — 09 Sep 2010, 23:50
Statistics: Posted by 23fx23 — 09 Sep 2010, 23:41
Statistics: Posted by gurulogic — 09 Sep 2010, 19:20
Statistics: Posted by 23fx23 — 10 Sep 2010, 03:24
Statistics: Posted by gurulogic — 10 Sep 2010, 02:47


CODE:
/////////////////////////////////////////////////////////////////////////////////////// PPQ Clocks gen_ 23fx2K10_ generate clocks from PPQ, each next one beeing divided by 2///////////////////////////////////////////////////////////////////////////////////////// Enter a nb of max bars, that will correspond to the longest cycle (clock0) ie 4bars// then clock1 will be clock0/2 ie 2 bars ect.// to match module enter the nbof steps/bar you want. ie if a line module// with a 32 step/bar enter 32.////////////////////////////////////////////////////////////////////////////////////// parameters declaration////////////////////////const NB_CLOCKS = 5; // nb of clocks output to generate./////////////////////////////var PPQIN, STEPSperbar, MaxBars, SUBDIV: Tparameter;var CLOCKS : Array of Tparameter;var i: integer;var PREC: single;/////////////////////////////////////////////////////////// initialisation : create parametersprocedure init;BEGIN PPQIN := createParam('PPQ IN',PtDataField); setIsOutput(PPQIN,false);StepsPerBar:= createParam('StepsPerBar',PtDataField); setIsOutput(StepsPerBar,false);MaxBars := createParam('Max Bars',PtDatafield); setIsOutput(MaxBars,false);SUBDIV := createParam('SUBDIV',PtDatafield); setIsOutput(SUBDIV,false); setArrayLength(Clocks,NB_CLOCKS); for i:=0 to NB_CLOCKS-1 do begin CLOCKS[i]:= CreateParam('Clock'+IntToStr(i),PtDataField); SetIsInput(Clocks[i],false); end;END;//INIT////////////////////////////////////////////////// Callback procedurevar A,READSTEP,MODSTEP: integer;Procedure Callback(N:integer); BEGINIf (n=PPQIn) then begin PREC:= MAXS(1,getValue(SUBDIV)); A:= round(getValue(stepsPerBar)); for i:= 0 to NB_Clocks-1 do begin READSTEP:= round(getValue(PPQIN)*PREC*(A/4)); MODSTEP:= round((getvalue(maxBars)*(A)*PREC) / power(2,i)); SetValue(Clocks[i],(READSTEP mod MODSTEP)/PREC); end; end;END;//Callback////////////////////////////////////////////////////Statistics: Posted by 23fx23 — 10 Sep 2010, 01:57
Statistics: Posted by 23fx23 — 10 Sep 2010, 00:10
Statistics: Posted by gurulogic — 09 Sep 2010, 23:50
Statistics: Posted by 23fx23 — 09 Sep 2010, 23:41
Statistics: Posted by gurulogic — 09 Sep 2010, 19:20