ArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2020-03-05T20:49:52+02:00 https://brainmodular.com/forums/app.php/feed/topic/6622 2020-03-05T20:49:52+02:00 2020-03-05T20:49:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42269#p42269 <![CDATA[Re: Array script not working in V4]]> Statistics: Posted by nay-seven — 05 Mar 2020, 19:49


]]>
2020-03-05T20:46:42+02:00 2020-03-05T20:46:42+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42268#p42268 <![CDATA[Re: Array script not working in V4]]>
var sats: array[1..MAX] of single;

Is no longer supported.

I made variable length arrays and set their length in the init.

BUT, I am still getting nothing from the get and set commatext methods for TStringList. Has that method changed???

[edit: nevee mind, I had commented out that line....]

ALL WORKING NOW!

cheers,
-e

Statistics: Posted by woodslanding — 05 Mar 2020, 19:46


]]>
2020-03-05T17:58:51+02:00 2020-03-05T17:58:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42267#p42267 <![CDATA[Re: Array script not working in V4]]> support@brainmodular.com

Statistics: Posted by nay-seven — 05 Mar 2020, 16:58


]]>
2020-03-05T17:55:35+02:00 2020-03-05T17:55:35+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42266#p42266 <![CDATA[Re: Array script not working in V4]]> Statistics: Posted by woodslanding — 05 Mar 2020, 16:55


]]>
2020-02-18T10:28:47+02:00 2020-02-18T10:28:47+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42227#p42227 <![CDATA[Array script not working in V4]]>
Any thoughts?

It is supposed to sort through the list of channels, and output a list of channel numbers and names that are fx channels. But, although there are four non-zero values for fxStatusIN, there is no output of either names or numbers. All the input data looks fine....
2020-02-18 01_02_50-getFXprogNames.png
Oddly, it did work for names, but not numbers until I did a recompile and reset. Now it doesn't work for either. Just wondering if I have some wrong syntax that the v3 glossed over.....

CODE:

///////////////////////////////////////////////////Const MAX = 32;// parameters declarationvar fxStatusIN,huesIN,satsIN  : TParameter;  var ctIN : TParameter;var fxChansOUT,ctOUT,huesOUT,satsOUT : TParameter; var fxChans: array[1..MAX] of integer; var hues: array[1..MAX] of single;  var sats: array[1..MAX] of single;  // initialisation : create parametersprocedure init;begin    fxStatusIN := CreateParam('fx status',PtArray);  SetIsOutput(fxStatusIN,false);    SetMax(fxStatusIN,MAX);                                          ctIn := CreateParam('ch names',PtTextfield);  SetIsOutput(ctIn,false);     HuesIn := CreateParam('ch hues',PtArray);  SetIsOutput(HuesIn,false);        SatsIn := CreateParam('ch saturations',PtArray);  SetIsOutput(SatsIn,false);      fxChansOUT := CreateParam('fx chs',PtArray);  SetIsInput(fxChansOUT,false);    SetMax(fxChansOUT,MAX);                                 ctOut := CreateParam('fx prgs',PtTextfield);  SetIsInput(ctOut,false);       HuesOUT := CreateParam('fx hues',PtArray);  SetIsInput(HuesOUT,false);      satsOUT := CreateParam('fx saturations',PtArray);  SetIsInput(SatsOUT,false);    end;// Callback procedureProcedure Callback(N:integer); var fxCount,len,chanNum,i : integer;var status : integer;  var name : string;var slIN,slOUT: TStringlist;var hue,sat : single;begin    slIN.create;    slOUT.create;    len := GetLength(fxStatusIN);      slIN.setCommatext(getStringValue(ctIN)); //sl count is long because of an extra comma at the end!    fxCount := 0;     if (slIN.count - 1 <> len) then strace('>>>ERROR---isfx count = ' + inttostr(len) + ',string count = ' + intToStr(slIN.count) + ':getFXprogramNames')     for chanNum := 0 to len-1     do begin             status := trunc(GetDataArrayValue(fxStatusIN,chanNum));          hue := GetDataArrayValue(huesIN,chanNum);              sat := GetDataArrayValue(satsIN,chanNum);                     if status > 0 then          begin             fxChans[fxCount] := status;              name := slIN.getstrings(status - 1);// status is more reliable than string number. 1 indexed.              //strace('got value:' + name + ' for chan ' + inttostr(chanNum) + 'status ch = ' + inttostr(status));               //strace('hue = ' + floattostr(hue));             slOUT.add(name);                        hues[fxCount] := hue;               sats[fxCount] := sat;             fxCount := fxCount + 1;                                end;      end;         //strace('len = ' + inttostr(fxCount));     SetLength(fxChansOUT, fxCount);      SetLength(huesOUT,fxCount);       SetLength(satsOUT,fxCount);      for i := 0 to fxCount-1 do     begin         SetDataArrayValue(fxChansOUT,i,fxChans[i]);         SetStringValue(ctOUT,slOUT.getCommatext());         SetDataArrayValue(huesOUT,i,hues[i]);          SetDataArrayValue(satsOUT,i,sats[i]);      end;     slIN.free;      slOUT.free;      end;
registry.pat

Statistics: Posted by woodslanding — 18 Feb 2020, 09:28


]]>
BrainModular BrainModular Users Forum 2020-03-05T20:49:52+02:00 https://brainmodular.com/forums/app.php/feed/topic/6622 2020-03-05T20:49:52+02:00 2020-03-05T20:49:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42269#p42269 <![CDATA[Re: Array script not working in V4]]> Statistics: Posted by nay-seven — 05 Mar 2020, 19:49


]]>
2020-03-05T20:46:42+02:00 2020-03-05T20:46:42+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42268#p42268 <![CDATA[Re: Array script not working in V4]]>
var sats: array[1..MAX] of single;

Is no longer supported.

I made variable length arrays and set their length in the init.

BUT, I am still getting nothing from the get and set commatext methods for TStringList. Has that method changed???

[edit: nevee mind, I had commented out that line....]

ALL WORKING NOW!

cheers,
-e

Statistics: Posted by woodslanding — 05 Mar 2020, 19:46


]]>
2020-03-05T17:58:51+02:00 2020-03-05T17:58:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42267#p42267 <![CDATA[Re: Array script not working in V4]]> support@brainmodular.com

Statistics: Posted by nay-seven — 05 Mar 2020, 16:58


]]>
2020-03-05T17:55:35+02:00 2020-03-05T17:55:35+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42266#p42266 <![CDATA[Re: Array script not working in V4]]> Statistics: Posted by woodslanding — 05 Mar 2020, 16:55


]]>
2020-02-18T10:28:47+02:00 2020-02-18T10:28:47+02:00 https://brainmodular.com/forums/viewtopic.php?t=6622&p=42227#p42227 <![CDATA[Array script not working in V4]]>
Any thoughts?

It is supposed to sort through the list of channels, and output a list of channel numbers and names that are fx channels. But, although there are four non-zero values for fxStatusIN, there is no output of either names or numbers. All the input data looks fine....
2020-02-18 01_02_50-getFXprogNames.png
Oddly, it did work for names, but not numbers until I did a recompile and reset. Now it doesn't work for either. Just wondering if I have some wrong syntax that the v3 glossed over.....

CODE:

///////////////////////////////////////////////////Const MAX = 32;// parameters declarationvar fxStatusIN,huesIN,satsIN  : TParameter;  var ctIN : TParameter;var fxChansOUT,ctOUT,huesOUT,satsOUT : TParameter; var fxChans: array[1..MAX] of integer; var hues: array[1..MAX] of single;  var sats: array[1..MAX] of single;  // initialisation : create parametersprocedure init;begin    fxStatusIN := CreateParam('fx status',PtArray);  SetIsOutput(fxStatusIN,false);    SetMax(fxStatusIN,MAX);                                          ctIn := CreateParam('ch names',PtTextfield);  SetIsOutput(ctIn,false);     HuesIn := CreateParam('ch hues',PtArray);  SetIsOutput(HuesIn,false);        SatsIn := CreateParam('ch saturations',PtArray);  SetIsOutput(SatsIn,false);      fxChansOUT := CreateParam('fx chs',PtArray);  SetIsInput(fxChansOUT,false);    SetMax(fxChansOUT,MAX);                                 ctOut := CreateParam('fx prgs',PtTextfield);  SetIsInput(ctOut,false);       HuesOUT := CreateParam('fx hues',PtArray);  SetIsInput(HuesOUT,false);      satsOUT := CreateParam('fx saturations',PtArray);  SetIsInput(SatsOUT,false);    end;// Callback procedureProcedure Callback(N:integer); var fxCount,len,chanNum,i : integer;var status : integer;  var name : string;var slIN,slOUT: TStringlist;var hue,sat : single;begin    slIN.create;    slOUT.create;    len := GetLength(fxStatusIN);      slIN.setCommatext(getStringValue(ctIN)); //sl count is long because of an extra comma at the end!    fxCount := 0;     if (slIN.count - 1 <> len) then strace('>>>ERROR---isfx count = ' + inttostr(len) + ',string count = ' + intToStr(slIN.count) + ':getFXprogramNames')     for chanNum := 0 to len-1     do begin             status := trunc(GetDataArrayValue(fxStatusIN,chanNum));          hue := GetDataArrayValue(huesIN,chanNum);              sat := GetDataArrayValue(satsIN,chanNum);                     if status > 0 then          begin             fxChans[fxCount] := status;              name := slIN.getstrings(status - 1);// status is more reliable than string number. 1 indexed.              //strace('got value:' + name + ' for chan ' + inttostr(chanNum) + 'status ch = ' + inttostr(status));               //strace('hue = ' + floattostr(hue));             slOUT.add(name);                        hues[fxCount] := hue;               sats[fxCount] := sat;             fxCount := fxCount + 1;                                end;      end;         //strace('len = ' + inttostr(fxCount));     SetLength(fxChansOUT, fxCount);      SetLength(huesOUT,fxCount);       SetLength(satsOUT,fxCount);      for i := 0 to fxCount-1 do     begin         SetDataArrayValue(fxChansOUT,i,fxChans[i]);         SetStringValue(ctOUT,slOUT.getCommatext());         SetDataArrayValue(huesOUT,i,hues[i]);          SetDataArrayValue(satsOUT,i,sats[i]);      end;     slIN.free;      slOUT.free;      end;
registry.pat

Statistics: Posted by woodslanding — 18 Feb 2020, 09:28


]]>