CODE:
//////////////////////////// Pattern Store /////////////////////////// parameters declarationconst PATTERNs = 8;const STEPs = 32;const IOs = 9; var MEMs : integer; type tStep = array [0..STEPs-1] of single;type stepBank = array [0..IOs-1] of tStep; var patternBank : array of stepBank;var memory : array [0..(PATTERNs*IOs)-1] of tParameter;var stepIn : array of integer;var stepOut : array of integer;var store : tParameter;var load : tParameter; var stepNum : tParameter; var current : tParameter;var copy : tParameter;//var copys : tParameter;var resetP : tParameter;var resetA : tParameter; var p,i,n,s : integer; // initialisation : create parametersprocedure init;begin MEMs := PATTERNs * IOs; writeln('length of all my MEMs '+inttostr(MEMs)); setArrayLength(patternBank,PATTERNS); setArrayLength(stepIn,IOs); setArrayLength(stepOut,IOs); store := createParam('store',ptButton); setIsOutput(store,false); load := createParam('load',ptDataField); setIsOutput(load,false); copy := createParam('copy',ptSwitch); setIsOutput(copy,false); setIsSeparator(copy,true);// copys := createParam('copy store',ptButton);// setIsInput(copys,false); stepNum := createParam('step num',ptDataField); setIsSeparator(stepNum,true); current := createParam('current',ptDataField); setIsInput(current,false); setIsOutput(current,false); resetP := createParam('reset pattern',ptButton); setIsOutput(resetP,false); resetA := createParam('reset all',ptButton); setIsOutput(resetA,false); for i := 0 to IOs-1 do begin stepIn[i] := createParam('seq '+inttostr(i+1),ptArray); setIsOutput(stepIn[i],false); for s:=0 to STEPs-1 do begin setDataArrayValue(stepIn[i],s,0); end; setLength(stepIn[i],STEPs); end; setIsSeparator(stepIn[0],true); for i := 0 to IOs-1 do begin stepOut[i] := createParam('seq '+inttostr(i+1),ptArray); setIsInput(stepOut[i],false); for s:=0 to STEPs-1 do begin setDataArrayValue(stepOut[i],s,0); end; setLength(stepOut[i],STEPs); end; for i:=0 to MEMs-1 do begin memory[i] := createParam('mem '+inttostr(i+1),ptArray); setIsInput(memory[i],false); setIsOutput(memory[i],false); setDontSave(memory[i],false); setLength(memory[i],STEPs); // i hope this only happens once, at the very beginning for s:=0 to STEPs-1 do begin setDataArrayValue(memory[i],s,0); end; end; writeln('initted'); // load will hold a value from a switch group, // so it will begin with a value.// setvalue(current, getValue(load)); end; var choice,next, prev, x, m : integer;var v : single;var temp : tStep;// Callbackprocedure Procedure Callback(N:integer);begin case N of resetP: begin choice := round(getValue(current)); writeln('reset pattern '+inttostr(choice)); setLength(stepOut[choice],STEPs); setLength(memory[choice],STEPs); for s:=0 to STEPs-1 do begin setDataArrayValue(memory[choice],s,0); setDataArrayValue(stepOut[choice],s,0); end; end; resetA: begin writeln('resetting all patterns'); for m:=0 to MEMs-1 do begin for s:=0 to STEPs-1 do begin setDataArrayValue(memory[m],s,0); end; end; end; copy: begin choice := round(getvalue(copy)); writeln('copy is '+inttostr(choice)); // setValue( copys, choice ); end; store: begin choice := round( getValue(load) ); for i := 0 to IOs-1 do begin m := ((choice-1) * PATTERNs) + i; writeln('storing in '+inttostr(m)); setLength(stepOut[i],STEPs); setLength(memory[m],STEPs); for s := 0 to STEPs-1 do begin temp[s] := getDataArrayValue(stepIn[i],s); setDataArrayValue(memory[m],s,temp[s]); setDataArrayValue(stepOut[i],s,temp[s]); end; end; end;//store stepNum: begin if getValue(stepNum) = 1 then begin next := round( getValue(load) ); prev := round( getValue(current) ); if next <> prev then begin writeln('setting current to load'); setValue(current, next); end; end else if getValue(stepNum) = 31 then begin next := round( getValue(load) ); prev := round( getValue(current) ); if next <> prev then begin for i:=0 to IOs-1 do begin n := ((next-1) * IOs) + i; writeln('getting values from '+inttostr(n)); setLength(stepOut[i],STEPs); for s:=0 to STEPs-1 do begin temp[s] := getDataArrayValue(memory[n],s); setDataArrayValue(stepOut[i],s,temp[s]); end; end; setValue(current,next); end; end; end;//stepNum // this case handles 'copy to new pattern' load: begin prev := round( getValue(current)); for i:=0 to IOs-1 do begin p := ((prev-1) * IOs) + i; writeln('auto-saving into '+inttostr(p)); setLength(memory[p],STEPs); setLength(stepOut[i],STEPs); for s:=0 to STEPs-1 do begin temp[s] := getDataArrayValue(stepIn[i],s); setDataArrayValue(memory[p],s,temp[s]); setDataArrayValue(stepOut[i],s,temp[s]); end; end; choice := round( getValue(copy) ); if choice = 1 then begin next := round( getValue(load) ); prev := round( getValue(current) ); for i:=0 to IOs-1 do begin n := ((next-1) * IOs) + i; p := ((prev-1) * IOs) + i; writeln('loading from '+inttostr(p)+' into '+inttostr(n)); setLength(memory[n],STEPs); for s:=0 to STEPs-1 do begin temp[s] := getDataArrayValue(memory[p],s); setDataArrayValue(memory[n],s,temp[s]); end; end; // Don't leave copy on! setValue(copy,0); end; end; end;end; // Global variables //var loadPattern : integer;//var stepPos : integer; //////////////////////////////// main proc ////////////////////////////// Procedure Process;begin // v2end;Statistics: Posted by ceasless — 22 Sep 2013, 19:20
Statistics: Posted by funkyguitarist — 19 Sep 2013, 22:31
CODE:
//////////////////////////// Pattern Store /////////////////////////// parameters declarationconst PATTERNs = 8;const STEPs = 32;const IOs = 9; var MEMs : integer; type tStep = array [0..STEPs-1] of single;type stepBank = array [0..IOs-1] of tStep; var patternBank : array of stepBank;var memory : array [0..(PATTERNs*IOs)-1] of tParameter;var stepIn : array of integer;var stepOut : array of integer;var store : tParameter;var load : tParameter; var stepNum : tParameter; var current : tParameter;var copy : tParameter;//var copys : tParameter;var resetP : tParameter;var resetA : tParameter; var p,i,n,s : integer; // initialisation : create parametersprocedure init;begin MEMs := PATTERNs * IOs; writeln('length of all my MEMs '+inttostr(MEMs)); setArrayLength(patternBank,PATTERNS); setArrayLength(stepIn,IOs); setArrayLength(stepOut,IOs); store := createParam('store',ptButton); setIsOutput(store,false); load := createParam('load',ptDataField); setIsOutput(load,false); copy := createParam('copy',ptSwitch); setIsOutput(copy,false); setIsSeparator(copy,true);// copys := createParam('copy store',ptButton);// setIsInput(copys,false); stepNum := createParam('step num',ptDataField); setIsSeparator(stepNum,true); current := createParam('current',ptDataField); setIsInput(current,false); setIsOutput(current,false); resetP := createParam('reset pattern',ptButton); setIsOutput(resetP,false); resetA := createParam('reset all',ptButton); setIsOutput(resetA,false); for i := 0 to IOs-1 do begin stepIn[i] := createParam('seq '+inttostr(i+1),ptArray); setIsOutput(stepIn[i],false); for s:=0 to STEPs-1 do begin setDataArrayValue(stepIn[i],s,0); end; setLength(stepIn[i],STEPs); end; setIsSeparator(stepIn[0],true); for i := 0 to IOs-1 do begin stepOut[i] := createParam('seq '+inttostr(i+1),ptArray); setIsInput(stepOut[i],false); for s:=0 to STEPs-1 do begin setDataArrayValue(stepOut[i],s,0); end; setLength(stepOut[i],STEPs); end; for i:=0 to MEMs-1 do begin memory[i] := createParam('mem '+inttostr(i+1),ptArray); setIsInput(memory[i],false); setIsOutput(memory[i],false); setDontSave(memory[i],false); setLength(memory[i],STEPs); // i hope this only happens once, at the very beginning for s:=0 to STEPs-1 do begin setDataArrayValue(memory[i],s,0); end; end; writeln('initted'); // load will hold a value from a switch group, // so it will begin with a value.// setvalue(current, getValue(load)); end; var choice,next, prev, x, m : integer;var v : single;var temp : tStep;// Callbackprocedure Procedure Callback(N:integer);begin case N of resetP: begin choice := round(getValue(current)); writeln('reset pattern '+inttostr(choice)); setLength(stepOut[choice],STEPs); setLength(memory[choice],STEPs); for s:=0 to STEPs-1 do begin setDataArrayValue(memory[choice],s,0); setDataArrayValue(stepOut[choice],s,0); end; end; resetA: begin writeln('resetting all patterns'); for m:=0 to MEMs-1 do begin for s:=0 to STEPs-1 do begin setDataArrayValue(memory[m],s,0); end; end; end; copy: begin choice := round(getvalue(copy)); writeln('copy is '+inttostr(choice)); // setValue( copys, choice ); end; store: begin choice := round( getValue(load) ); for i := 0 to IOs-1 do begin m := ((choice-1) * PATTERNs) + i; writeln('storing in '+inttostr(m)); setLength(stepOut[i],STEPs); setLength(memory[m],STEPs); for s := 0 to STEPs-1 do begin temp[s] := getDataArrayValue(stepIn[i],s); setDataArrayValue(memory[m],s,temp[s]); setDataArrayValue(stepOut[i],s,temp[s]); end; end; end;//store stepNum: begin if getValue(stepNum) = 1 then begin next := round( getValue(load) ); prev := round( getValue(current) ); if next <> prev then begin writeln('setting current to load'); setValue(current, next); end; end else if getValue(stepNum) = 31 then begin next := round( getValue(load) ); prev := round( getValue(current) ); if next <> prev then begin for i:=0 to IOs-1 do begin n := ((next-1) * IOs) + i; writeln('getting values from '+inttostr(n)); setLength(stepOut[i],STEPs); for s:=0 to STEPs-1 do begin temp[s] := getDataArrayValue(memory[n],s); setDataArrayValue(stepOut[i],s,temp[s]); end; end; setValue(current,next); end; end; end;//stepNum // this case handles 'copy to new pattern' load: begin prev := round( getValue(current)); for i:=0 to IOs-1 do begin p := ((prev-1) * IOs) + i; writeln('auto-saving into '+inttostr(p)); setLength(memory[p],STEPs); setLength(stepOut[i],STEPs); for s:=0 to STEPs-1 do begin temp[s] := getDataArrayValue(stepIn[i],s); setDataArrayValue(memory[p],s,temp[s]); setDataArrayValue(stepOut[i],s,temp[s]); end; end; choice := round( getValue(copy) ); if choice = 1 then begin next := round( getValue(load) ); prev := round( getValue(current) ); for i:=0 to IOs-1 do begin n := ((next-1) * IOs) + i; p := ((prev-1) * IOs) + i; writeln('loading from '+inttostr(p)+' into '+inttostr(n)); setLength(memory[n],STEPs); for s:=0 to STEPs-1 do begin temp[s] := getDataArrayValue(memory[p],s); setDataArrayValue(memory[n],s,temp[s]); end; end; // Don't leave copy on! setValue(copy,0); end; end; end;end; // Global variables //var loadPattern : integer;//var stepPos : integer; //////////////////////////////// main proc ////////////////////////////// Procedure Process;begin // v2end;Statistics: Posted by ceasless — 22 Sep 2013, 19:20
Statistics: Posted by funkyguitarist — 19 Sep 2013, 22:31