Page 1 of 1

Posted: 21 Jul 2011, 21:08
by CleverConQueso
Folks-
I've got a comma separated text box with a list of paths to sample files feeding the 'List Comma Text' input of a sampler. Rather than use the 'next sample' or 'random sample' commands, I want to be able to use a formula to randomly select the next sample to play and choose its file number. This would be based on the total number of files that are loaded to the sampler and each time the app refreshes, the file count will change. So my question is this -

Does anyone know if there is any way to get an item count from the list text object?
- OR -
Does anyone know if there is a way to get the number of files that are loaded to a sample player?

Thanks,
- CCQ -

Posted: 21 Jul 2011, 21:57
by 23fx23
it's possible to get the nb of elmts of a commatext via a simple a script .
im away from usine so i ll do it by memory, sorry if doesn't work at first, i can't check.
i ll check when back home. copy and paste to a new empty sript and compile.

Code: Select all

////////////////////////////
Var Commain,NBITEMS : tparameter;
Var SL1: Tstringlist;
//////////////////////////////
Procedure Init;
Begin
commain:= CreateParam('commain',Pttextfield);Setisoutput(commain,false);
NBitems:=CreateParam('NBitems',ptdatafield);SetisInput(NBITEMS,false);
SL1:=Tstringlist.Create;
SL1.commatext:=' ';
END;
///////////////////////////////////////////////////////////
Procedure Callback (n:integer);
BEGIN

SL1.commatext:= getstringvalue(COMMAIN);
setvalue(NBITEMS,SL1.count);

END;
/////////////////////////////////////

Posted: 21 Jul 2011, 22:07
by nay-seven
crazy boy !
yes, works fine ;)

Posted: 21 Jul 2011, 22:14
by 23fx23
Ok cool ;)

Posted: 22 Jul 2011, 01:35
by CleverConQueso
Holy crap! That's awesome and works great. Thank you so much.
-CCQ-