un-concal list...
-
multiphone
- Member
- Posts: 303
- Contact:
Hello,
I have one question for the community of patcher or scripter. I try to do the opposite of the script "ConCal list". Rather than adding lists, I try to separate the elements one by one. For example, a list of 16 élements in 16 separate lists of one elements. If you have any ideas I'm interested.
Thanks in advance
I have one question for the community of patcher or scripter. I try to do the opposite of the script "ConCal list". Rather than adding lists, I try to separate the elements one by one. For example, a list of 16 élements in 16 separate lists of one elements. If you have any ideas I'm interested.
Thanks in advance
woodslanding has done this script , maybe can suit you:
open it to change out number
open it to change out number
Code: Select all
/// commastring splitter by emoon//////
const stringCount = 6; // if this is too small, it doesn't like it.....
var outputs : array of Tparameter;
var input : Tparameter;
var strings : array of String;
var commatext : String;
// destroy
// initialisation : create parameters
procedure init;
var digit : string;
var i : integer;
begin
input := CreateParam('commaText',ptTextField);
SetIsOutput(input,false);
setArrayLength(strings, stringCount);
setArrayLength(outputs, stringCount);
for i := 0 to (stringCount - 1) do begin
digit := IntToStr(i + 1);
outputs[i] := CreateParam('String ' + digit,ptTextField);
SetIsInPut(Outputs[i],false);
end;
end;
procedure Callback(n:integer);
var charCount : integer;
var i : integer;
var ch: string;
var pos: integer;
begin
commatext := ' ' + getStringValue(Input) + ',';
i := 0;
charCount := 0;
for pos := 1 to length(commatext) do
begin
ch := copy(commatext,pos,1);
if (ch = ',') then
begin
strings[i] := copy(commatext,pos - charCount + 1, charCount - 1);
SetStringValue(Outputs[i],strings[i]);
strace('in loop ' + strings[i]);
// a little bounds checking
if (i = length(strings)) then break;
i := i + 1;
charCount := 0;
end;
charCount := charCount + 1;
end;
end;
// no process bloc-
multiphone
- Member
- Posts: 303
- Contact:
Thanks Nay !
I had not seen this post !
All is ok, thanks woodslanding.
I had not seen this post !
All is ok, thanks woodslanding.
cool if working ok,
but i think at the time it was done woodslanding was new to script and searched a too complex way of doing this.
scanning all characters one by one, when the tstringlist allow a direct access to separate elements.
a much simpler code can be done for that, using TstringList that pick input as it's commatext.
think it will be also lighter on cpu.
looks like
i ll try to post the full script later.
but i think at the time it was done woodslanding was new to script and searched a too complex way of doing this.
scanning all characters one by one, when the tstringlist allow a direct access to separate elements.
a much simpler code can be done for that, using TstringList that pick input as it's commatext.
think it will be also lighter on cpu.
looks like
Code: Select all
for i:=0 to SL.count -1 do begin
outputs[i] := SL.strings[i]
end;-
multiphone
- Member
- Posts: 303
- Contact:
Hello 23fx,
indeed, this script is not free CPU, but it works.
I would love to improve it, but I am still unable at this time.
To be continued ...
indeed, this script is not free CPU, but it works.
I would love to improve it, but I am still unable at this time.
To be continued ...
-
woodslanding
- Member
- Posts: 1327
- Contact:
yeah, I didn't know about the stringList, or I couldn't get it to work....
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
that's what i though 
here is the equivalent with tstringlist.
here is the equivalent with tstringlist.
Code: Select all
/////////////////////////////////////////////
// Spread CommaText Elmts to individual outs
////////////////////////////////////////////
Const NB_ELMTS = 8; // adjust for nb of output wanted
////////////////////////////
// parameters declaration
var CommaIN : Tparameter;
var outputs : Array of Tparameter;
var sl1 : TStringList;
var i : integer;
/////////////////////////
procedure Destroy;
begin
sl1.free;
end;
////////////////////////////
procedure init;
begin
CommaIN := CreateParam('Comma_In',ptTextField);
SetIsOutPut(CommaIN,false);
setArrayLength(OUTPUTS,NB_ELMTS);
for i:=0 to NB_ELMTS -1 do begin
outputs[i] := CreateParam('out'+ intToStr(i),ptTextField);
SetIsInPut(Outputs[i],false);
end;
Sl1 := TStringList.Create;
end;
//////////////////////////////////////////
procedure Callback(n:integer);
begin
if (n=commaIn) then begin
SL1.commatext:= getStringValue(CommaIN);
for i:= 0 to NB_ELMTS -1 do begin
if i < SL1.count then begin
setStringValue(outputs[i],Sl1.strings[i]);
end else begin
setStringValue(outputs[i],'');
end;
end;
end;
end;
//////////////////////////////////////////////-
multiphone
- Member
- Posts: 303
- Contact:
Hello 23FX,
Very nice !
Thanks for efficiency.
I look your code deeper.
Very nice !
Thanks for efficiency.
I look your code deeper.
you re welcome multiphone
once you catched the in/out creation, more explained in the 'basics scripts' section in wiki,
the only thing to catch is Tstringlist, it's kind of delphi object that can pick a commatext, and let acces the individual
elements via indexes in it's internal memory. the script just reassingn elements to same output nb.
it just need a protection to assign only if an element exists,, via checking if index (i) is within the total number of elements
given by the SL1.count , otherwise it sets a blank name ''.
hope it helps.
once you catched the in/out creation, more explained in the 'basics scripts' section in wiki,
the only thing to catch is Tstringlist, it's kind of delphi object that can pick a commatext, and let acces the individual
elements via indexes in it's internal memory. the script just reassingn elements to same output nb.
it just need a protection to assign only if an element exists,, via checking if index (i) is within the total number of elements
given by the SL1.count , otherwise it sets a blank name ''.
hope it helps.
-
multiphone
- Member
- Posts: 303
- Contact:
OK, i understand...
Thank for explication.
I try to unproved the script with an supplementary inlet for choose the number active of out (maybe can i patch that more easily) and a random determination of N elements in one list.
Thank for explication.
I try to unproved the script with an supplementary inlet for choose the number active of out (maybe can i patch that more easily) and a random determination of N elements in one list.
Who is online
Users browsing this forum: No registered users and 17 guests
