ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray
Statistics: Posted by moody33 — 01 Mar 2011, 23:14 CODE: Statistics: Posted by 23fx23 — 01 Mar 2011, 22:31 Statistics: Posted by nay-seven — 01 Mar 2011, 22:03 Statistics: Posted by waolelaid — 01 Mar 2011, 21:37 Statistics: Posted by moody33 — 01 Mar 2011, 20:09 Statistics: Posted by moody33 — 01 Mar 2011, 19:38 Statistics: Posted by moody33 — 01 Mar 2011, 19:38 CODE: Statistics: Posted by 23fx23 — 01 Mar 2011, 19:28 Statistics: Posted by 23fx23 — 01 Mar 2011, 19:08 Statistics: Posted by moody33 — 01 Mar 2011, 17:22 Statistics: Posted by 23fx23 — 01 Mar 2011, 12:09
@23fx23 Impressive script! Exactly what I need for my stuff and it works very well !!! You make my day and I wish to not find other problems within my patch ( and I'm sure there is other sysex problem in view since I'm a bit blind with numbers ![]()
Thanks you so much for your help ! ![]()
]]>![]()
@moody, i m not sure i fully understood, but this is a new version that may solve the pb:
it's a multimode single script, normally you should be able to set_only, extract_only or booth via the listbox.///////////////////////////////////////////////////////////////// Get/Set Each(n) + IndexStart from/to array of values in/out/////////////////////////////////////////////////////////////var ArrayIN, ArrayOUT, ValuesIn, valuesOut, Mode : tparameter;var GoSet : tparameter;var Index : tparameter;var SubSize: tparameter;var ValTMP: integer;var i, l : integer;var NB_OF_SUBS, ID, pass, lvals : integer;////////////////////////procedure init;begin ArrayIn:= createParam('Array in', PtArray); setisOutput(Arrayin,false);goset := createParam('Process', Ptbutton); setisOutput(goset,false);index := createParam('index (offset)', Ptdatafader); setisOutput(index,false);SetFormat(index,'%.0f'); SetMax(index,511);SubSize:= createParam('each (subsize)', Ptdatafader); setisOutput(subsize,false);SetFormat(subsize,'%.0f'); SetMax(subsize,511); setMin(subsize,1); setValue(subsize,1);Mode := createParam('mode', PtListBox); setisOutput(Mode,false);SetListBoxString(Mode, '"Set only", "Set+Extract", "Extract only"');setvalue(mode,0);ValuesIn:= createParam('Values in', PtArray); setisOutput(ValuesIn,false);ArrayOut:= createParam('Array out', PtArray); setisINput(ArrayOut,false);ValuesOut:= createParam('Values out', PtArray); setisINput(ValuesOut,false);setLength(ArrayOut,0);end;/////////////////////////////////////Procedure Callback(N:integer); beginif (n=ArrayIn) then IN_TO_OUT;if (n=GoSet) and (getValue(GoSet)=1) then begin IN_TO_OUT; if getvalue(mode)<2 then INSERT_VALUES; if getvalue(mode)>0 then EXTRACT_VALUES; end;end;//////////////////////////////////////////procedure EXTRACT_VALUES;begin NB_OF_SUBS:= L div round(getvalue(subsize)); setlength(ValuesOut,NB_OF_SUBS); for i:= 0 to NB_OF_SUBS-1 do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if (ID < L) then begin ValTMP:= round(getdataArrayValue(Arrayout,id)); setDataArrayValue(ValuesOut,i,ValTMP); end else begin setDataArrayValue(ValuesOut,i,0); end; end;end;////////////////////////procedure INSERT_VALUES;begin for i:= 0 to Lvals-1 do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if ID < L then begin ValTMP:= round(getdataArrayValue(valuesin,i)); setDataArrayValue(ArrayOut,ID,VALTMP); end; end;end;///////////////procedure IN_TO_OUT;begin L:= getlength(arrayin); Lvals:= getLength(ValuesIn); setlength(arrayOut,L); for i:= 0 to L-1 do begin setDataArrayValue(ArrayOut,i,getDataArrayValue(ArrayIn,i)); end;end;//////////////////////////////
]]>
but you don't need to follow this to make your own project ![]()
]]>
it's now made for progammers and as i quit school
at fourteen i can't follow now i know nothing about math
and yet less in programming i had a look on the next new module
working with csound that makes everybody very enthusiastic
but it's still C language
i already don't understand the use of "arrays " so I think
i can't go on
good night and excuse me
]]>
]]>
]]>
I'm not sure to understand well, but you seems to correctly understand what I mean. To be more clear => Back to my first example with 3 x 512 values stored in one big array of 1536 values. I want to set a new value for index n°2 (A) , another one for index 512+2 (B) , and another one for index 1024+2(C). Each new value to set are different, so that's why an array input is required. So for A: new value=a ; for B=>b ; for C=> c where a is the first value of an input array, b, the second value , and c the third value to set.
For the second script, in state of setting a new value each subsize+offset , I need to extract values like the GetArrayVal module do. In my example, I would like to extract element value 10, value 512+10, and value 1024+10. all extracting values should be output as an array output.
The challenge was just in case of, and was a bit of joke.However , I'd really like to have a script like this.
Sure, I will take a look in how to make script one day, but it seems to be very hard for me to understand, It's like chinese and far beyond my own logic. ! Although I don't say I will never learn how to.
I'm often impressed by people like you, bsork and other , going deeply in this kind of programming ! ![]()
]]>//////////////////////////// SetEach+IndexStart_array of values in/////////////////////////var ArrayIN, ArrayOUT, ValuesIn : tparameter;var GoSet : tparameter;var Index, valin : tparameter;var SubSize: tparameter;var i, l : integer;////////////////////////procedure init;begin ArrayIn:= createParam('Array in', PtArray); setisOutput(Arrayin,false);goset := createParam('set values', Ptbutton); setisOutput(goset,false);index := createParam('index (offset)', Ptdatafader); setisOutput(index,false);SetFormat(index,'%.0f'); SetMax(index,511);SubSize:= createParam('each (subsize)', Ptdatafader); setisOutput(subsize,false);SetFormat(subsize,'%.0f'); SetMax(subsize,511); setMin(subsize,1); setValue(subsize,1);//valin := createParam('value', Ptdatafader); setisOutput(valin,false);//SetFormat(valin,'%.0f'); SetMax(valin,255);ValuesIn:= createParam('Values in', PtArray); setisOutput(ValuesIn,false);ArrayOut:= createParam('Array out', PtArray); setisINput(ArrayOut,false);setLength(ArrayOut,0);end;/////////////////////////////////////Procedure Callback(N:integer); var NB_OF_SUBS, ID : integer;beginif (n=ArrayIn) then IN_TO_OUT;if (n=GoSet) and (getValue(GoSet)=1) then begin IN_TO_OUT; NB_OF_SUBS:= L div round(getvalue(subsize)); for i:= 0 to NB_OF_SUBS-1 do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if ID <= (MinI(L,getLength(ValuesIn))-1) then begin setDataArrayValue(ArrayOut,ID,getdataArrayValue(valuesin,i)); end; end;end;end;///////////////procedure IN_TO_OUT;begin L:= getlength(arrayin); setlength(arrayOut,L); for i:= 0 to L-1 do begin setDataArrayValue(ArrayOut,i,getDataArrayValue(ArrayIn,i)); end;end;//////////////////////////////
]]>
i was looking at your other challenge but, while i could easily make the clocked insert feature, the sort_array code is quite trickier
than i imagined and above my pgming (basic) math or scripting skillz for now, i will make a break and update this one by waiting a new challenging attempt ![]()
i have no pb and enjoy helping you as much as i can but beleive me, you should try slowly learn scripting, i did have no clue a few month ago as well ![]()
]]>
And at last, a related script that could give to the user a Get array Element Value each (n) size with offset?
Could be very useful in some situation, and especially in my attempt to build a full sysex editor for my beloved G2.
Thanks you for your precious help cause I actually know absolutely nothing in scripting.
]]>
]]>
Statistics: Posted by 23fx23 — 01 Mar 2011, 11:46
Statistics: Posted by moody33 — 01 Mar 2011, 11:17
Statistics: Posted by bsork — 01 Mar 2011, 08:29
CODE:
//////////////////////////// SetEach+IndexStart/////////////////////////var ArrayIN, ArrayOUT : tparameter;var GoSet : tparameter;var Index, valin : tparameter;var SubSize: tparameter;var i, l : integer;////////////////////////procedure init;begin ArrayIn:= createParam('Array in', PtArray); setisOutput(Arrayin,false);goset := createParam('set values', Ptbutton); setisOutput(goset,false);index := createParam('index (offset)', Ptdatafader); setisOutput(index,false);SetFormat(index,'%.0f'); SetMax(index,512);SubSize:= createParam('each (subsize)', Ptdatafader); setisOutput(subsize,false);SetFormat(subsize,'%.0f'); SetMax(subsize,512); setMin(subsize,1); setValue(subsize,1);valin := createParam('value', Ptdatafader); setisOutput(valin,false);SetFormat(valin,'%.0f'); SetMax(valin,255);ArrayOut:= createParam('Array out', PtArray); setisINput(ArrayOut,false);setLength(ArrayOut,0);end;/////////////////////////////////////Procedure Callback(N:integer); var NB_OF_SUBS, ID : integer;beginif (n=ArrayIn) then IN_TO_OUT;if (n=GoSet) and (getValue(GoSet)=1) then begin IN_TO_OUT; NB_OF_SUBS:= L div round(getvalue(subsize)); for i:= 0 to NB_OF_SUBS do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if ID <= L-1 then begin setDataArrayValue(ArrayOut,ID,getValue(valin)); end; end;end;end;///////////////procedure IN_TO_OUT;begin L:= getlength(arrayin); setlength(arrayOut,L); for i:= 0 to L-1 do begin setDataArrayValue(ArrayOut,i,getDataArrayValue(ArrayIn,i)); end;end;//////////////////////////////Statistics: Posted by 23fx23 — 01 Mar 2011, 00:59
Statistics: Posted by moody33 — 28 Feb 2011, 23:33
Statistics: Posted by bsork — 28 Feb 2011, 22:43
Statistics: Posted by moody33 — 28 Feb 2011, 22:08
Statistics: Posted by moody33 — 28 Feb 2011, 21:30
Statistics: Posted by moody33 — 01 Mar 2011, 23:14
CODE:
///////////////////////////////////////////////////////////////// Get/Set Each(n) + IndexStart from/to array of values in/out/////////////////////////////////////////////////////////////var ArrayIN, ArrayOUT, ValuesIn, valuesOut, Mode : tparameter;var GoSet : tparameter;var Index : tparameter;var SubSize: tparameter;var ValTMP: integer;var i, l : integer;var NB_OF_SUBS, ID, pass, lvals : integer;////////////////////////procedure init;begin ArrayIn:= createParam('Array in', PtArray); setisOutput(Arrayin,false);goset := createParam('Process', Ptbutton); setisOutput(goset,false);index := createParam('index (offset)', Ptdatafader); setisOutput(index,false);SetFormat(index,'%.0f'); SetMax(index,511);SubSize:= createParam('each (subsize)', Ptdatafader); setisOutput(subsize,false);SetFormat(subsize,'%.0f'); SetMax(subsize,511); setMin(subsize,1); setValue(subsize,1);Mode := createParam('mode', PtListBox); setisOutput(Mode,false);SetListBoxString(Mode, '"Set only", "Set+Extract", "Extract only"');setvalue(mode,0);ValuesIn:= createParam('Values in', PtArray); setisOutput(ValuesIn,false);ArrayOut:= createParam('Array out', PtArray); setisINput(ArrayOut,false);ValuesOut:= createParam('Values out', PtArray); setisINput(ValuesOut,false);setLength(ArrayOut,0);end;/////////////////////////////////////Procedure Callback(N:integer); beginif (n=ArrayIn) then IN_TO_OUT;if (n=GoSet) and (getValue(GoSet)=1) then begin IN_TO_OUT; if getvalue(mode)<2 then INSERT_VALUES; if getvalue(mode)>0 then EXTRACT_VALUES; end;end;//////////////////////////////////////////procedure EXTRACT_VALUES;begin NB_OF_SUBS:= L div round(getvalue(subsize)); setlength(ValuesOut,NB_OF_SUBS); for i:= 0 to NB_OF_SUBS-1 do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if (ID < L) then begin ValTMP:= round(getdataArrayValue(Arrayout,id)); setDataArrayValue(ValuesOut,i,ValTMP); end else begin setDataArrayValue(ValuesOut,i,0); end; end;end;////////////////////////procedure INSERT_VALUES;begin for i:= 0 to Lvals-1 do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if ID < L then begin ValTMP:= round(getdataArrayValue(valuesin,i)); setDataArrayValue(ArrayOut,ID,VALTMP); end; end;end;///////////////procedure IN_TO_OUT;begin L:= getlength(arrayin); Lvals:= getLength(ValuesIn); setlength(arrayOut,L); for i:= 0 to L-1 do begin setDataArrayValue(ArrayOut,i,getDataArrayValue(ArrayIn,i)); end;end;//////////////////////////////Statistics: Posted by 23fx23 — 01 Mar 2011, 22:31
Statistics: Posted by nay-seven — 01 Mar 2011, 22:03
Statistics: Posted by waolelaid — 01 Mar 2011, 21:37
Statistics: Posted by moody33 — 01 Mar 2011, 20:09
Statistics: Posted by moody33 — 01 Mar 2011, 19:38
Statistics: Posted by moody33 — 01 Mar 2011, 19:38
CODE:
//////////////////////////// SetEach+IndexStart_array of values in/////////////////////////var ArrayIN, ArrayOUT, ValuesIn : tparameter;var GoSet : tparameter;var Index, valin : tparameter;var SubSize: tparameter;var i, l : integer;////////////////////////procedure init;begin ArrayIn:= createParam('Array in', PtArray); setisOutput(Arrayin,false);goset := createParam('set values', Ptbutton); setisOutput(goset,false);index := createParam('index (offset)', Ptdatafader); setisOutput(index,false);SetFormat(index,'%.0f'); SetMax(index,511);SubSize:= createParam('each (subsize)', Ptdatafader); setisOutput(subsize,false);SetFormat(subsize,'%.0f'); SetMax(subsize,511); setMin(subsize,1); setValue(subsize,1);//valin := createParam('value', Ptdatafader); setisOutput(valin,false);//SetFormat(valin,'%.0f'); SetMax(valin,255);ValuesIn:= createParam('Values in', PtArray); setisOutput(ValuesIn,false);ArrayOut:= createParam('Array out', PtArray); setisINput(ArrayOut,false);setLength(ArrayOut,0);end;/////////////////////////////////////Procedure Callback(N:integer); var NB_OF_SUBS, ID : integer;beginif (n=ArrayIn) then IN_TO_OUT;if (n=GoSet) and (getValue(GoSet)=1) then begin IN_TO_OUT; NB_OF_SUBS:= L div round(getvalue(subsize)); for i:= 0 to NB_OF_SUBS-1 do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if ID <= (MinI(L,getLength(ValuesIn))-1) then begin setDataArrayValue(ArrayOut,ID,getdataArrayValue(valuesin,i)); end; end;end;end;///////////////procedure IN_TO_OUT;begin L:= getlength(arrayin); setlength(arrayOut,L); for i:= 0 to L-1 do begin setDataArrayValue(ArrayOut,i,getDataArrayValue(ArrayIn,i)); end;end;//////////////////////////////Statistics: Posted by 23fx23 — 01 Mar 2011, 19:28
Statistics: Posted by 23fx23 — 01 Mar 2011, 19:08
Statistics: Posted by moody33 — 01 Mar 2011, 17:22
Statistics: Posted by 23fx23 — 01 Mar 2011, 12:09
Statistics: Posted by 23fx23 — 01 Mar 2011, 11:46
Statistics: Posted by moody33 — 01 Mar 2011, 11:17
Statistics: Posted by bsork — 01 Mar 2011, 08:29
CODE:
//////////////////////////// SetEach+IndexStart/////////////////////////var ArrayIN, ArrayOUT : tparameter;var GoSet : tparameter;var Index, valin : tparameter;var SubSize: tparameter;var i, l : integer;////////////////////////procedure init;begin ArrayIn:= createParam('Array in', PtArray); setisOutput(Arrayin,false);goset := createParam('set values', Ptbutton); setisOutput(goset,false);index := createParam('index (offset)', Ptdatafader); setisOutput(index,false);SetFormat(index,'%.0f'); SetMax(index,512);SubSize:= createParam('each (subsize)', Ptdatafader); setisOutput(subsize,false);SetFormat(subsize,'%.0f'); SetMax(subsize,512); setMin(subsize,1); setValue(subsize,1);valin := createParam('value', Ptdatafader); setisOutput(valin,false);SetFormat(valin,'%.0f'); SetMax(valin,255);ArrayOut:= createParam('Array out', PtArray); setisINput(ArrayOut,false);setLength(ArrayOut,0);end;/////////////////////////////////////Procedure Callback(N:integer); var NB_OF_SUBS, ID : integer;beginif (n=ArrayIn) then IN_TO_OUT;if (n=GoSet) and (getValue(GoSet)=1) then begin IN_TO_OUT; NB_OF_SUBS:= L div round(getvalue(subsize)); for i:= 0 to NB_OF_SUBS do begin ID:= round(getvalue(index)+(i*getvalue(subsize))); if ID <= L-1 then begin setDataArrayValue(ArrayOut,ID,getValue(valin)); end; end;end;end;///////////////procedure IN_TO_OUT;begin L:= getlength(arrayin); setlength(arrayOut,L); for i:= 0 to L-1 do begin setDataArrayValue(ArrayOut,i,getDataArrayValue(ArrayIn,i)); end;end;//////////////////////////////Statistics: Posted by 23fx23 — 01 Mar 2011, 00:59
Statistics: Posted by moody33 — 28 Feb 2011, 23:33
Statistics: Posted by bsork — 28 Feb 2011, 22:43
Statistics: Posted by moody33 — 28 Feb 2011, 22:08
Statistics: Posted by moody33 — 28 Feb 2011, 21:30