I want to get the value of an array (inlet) at a specified index (inlet).
If that value (y)=0, set it to 1.
If that value (y)=1, set it to 0.
But i've got parameter conflict between SINGLE and INTEGER with the function GetDataArrayValue
Does i need to create another array (array of single) and feed it with the array(inlet)?
Code: Select all
//////////////////////////
//
/////////////////////////
// parameters declaration
var ArrayIn : Tparameter;
var Index : Tparameter;
var ArrayOut : Tparameter;
var Out : Tparameter;
var x,y : single;
// initialisation : create parameters
procedure init;
begin
ArrayIn :=CreateParam('ArrayIn',ptArray);
SetisOutput(ArrayIn,False);
Index :=CreateParam('Index',ptDataFader);
SetIsOutput(Index,FALSE);
ArrayOut :=CreateParam('ArrayOut',ptArray);
SetisInput(Arrayout,FALSE);
Out :=CreateParam('Out',Ptdatafield);
SetisInput(out,FALSE);
setformat (out,'%.0f');
end;
// Callback procedure
Procedure Callback(N:integer);
begin
x :=GetValue (Index);
y :=GetDataArrayValue(ArrayIn,x);
end;
// Global variables
//////////////////////////////
// main proc
//////////////////////////////
Procedure Process;
begin
if y=0 then begin
SetValue (out,1)
end;
If y=1 then begin
SetValue (out,0)
end;
end;