How do I convert a number to a single
Another noob scripting question. I'm comparing values stored in an array to a previous version of the same array. I've specified the "current" and "last" arrays as being of type single. I get an "invalid expression" error when I try to compare values at the same index in each array. Does this mean that the values are of different types? If so, how do I convert them (presumably to singles)? Thanks.
Regards,
Scott
Scott
Doesnt sound like thats the problem, can you please share your code so I can look at and maybe help?
-s
-s
"Every act of creation is first an act of destruction." -Picasso
Thanks for responding to my request, Seph. Here's the code:
//////////////////////////
//
/////////////////////////
const ar_size = 512;
// parameters declaration
var aux_send_levels : Tparameter;
var tr_fader_levels : Tparameter;
var last_ar, cur_ar : array [0..ar_size] of single;
// initialisation : create parameters
procedure init;
var i : integer;
begin
SetModuleColor($606060+302060);
aux_send_levels := CreateParam('aux_rec_lvls',ptArray);
SetIsOutPut(aux_send_levels,false);
tr_fader_levels := CreateParam('tr_fdr_lvls',ptArray);
SetIsInPut(tr_fader_levels,false);
for i:= 0 to ar_size do
begin
last_ar := -1.0;
end;
end;
// Callback procedure
Procedure Callback(N:integer);
var i : integer;
var cv,lv : single;
begin
for i := 0 to ar_size - 1 do
begin
cv := GetDataArrayValue(aux_send_levels, i);
lv := last_ar;
// if (cv <> lv) then do <--- error occurs here
// begin
// end;
end;
last_ar := cur_ar;
end;
//////////////////////////
//
/////////////////////////
const ar_size = 512;
// parameters declaration
var aux_send_levels : Tparameter;
var tr_fader_levels : Tparameter;
var last_ar, cur_ar : array [0..ar_size] of single;
// initialisation : create parameters
procedure init;
var i : integer;
begin
SetModuleColor($606060+302060);
aux_send_levels := CreateParam('aux_rec_lvls',ptArray);
SetIsOutPut(aux_send_levels,false);
tr_fader_levels := CreateParam('tr_fdr_lvls',ptArray);
SetIsInPut(tr_fader_levels,false);
for i:= 0 to ar_size do
begin
last_ar := -1.0;
end;
end;
// Callback procedure
Procedure Callback(N:integer);
var i : integer;
var cv,lv : single;
begin
for i := 0 to ar_size - 1 do
begin
cv := GetDataArrayValue(aux_send_levels, i);
lv := last_ar;
// if (cv <> lv) then do <--- error occurs here
// begin
// end;
end;
last_ar := cur_ar;
end;
Regards,
Scott
Scott
So maybe try this:
if (cv<>lv) then
begin
end;
I think the "do" is throwing your invalid expression.
-s
if (cv<>lv) then
begin
end;
I think the "do" is throwing your invalid expression.
-s
"Every act of creation is first an act of destruction." -Picasso
Lol. Thanks, seph.
Community FTW
Community FTW
Regards,
Scott
Scott
Who is online
Users browsing this forum: No registered users and 73 guests
