Posted: 04 Feb 2011, 12:06
I've done a little script to adapt the speed of the grain sampler sampler according to the global tempo, the lenght of the sample and his number of beats. I use it to slice the sample and re-order them.
I'm wondering if my script is buggy or not.
Do i really need to put everything in the callback procedure?
As the callback procedure is calculated each time the in parameters change, Is it to cpu intensive?
Is it buggy?
I'm still confused about this
I'm wondering if my script is buggy or not.
Do i really need to put everything in the callback procedure?
As the callback procedure is calculated each time the in parameters change, Is it to cpu intensive?
Is it buggy?
I'm still confused about this
Code: Select all
//////////////////////////
//
/////////////////////////
// parameters declaration
var BarDur : Tparameter;
var result1 : single;
var d : single;
var a,b,c : single;
var length : Tparameter;
var NbBeats : Tparameter;
var tempo : single;
var tempoOut : Tparameter;
var i,j : single;
var x : single;
var speed : Tparameter;
// initialisation : create parameters
procedure init;
begin
BarDur :=Createparam('BarDur', ptDataFader);
SetIsOutput(barDur,FALSE);
SetMax(Bardur,50000);
Length :=CreateParam('Length', ptDataFader);
SetIsOutput(Length,FALSE);
SetMax(Length,50000);
NbBeats :=CreateParam('NbBeats', ptDataFader);
SetIsOutput(NbBeats,FALSE);
TempoOut :=CreateParam('TempoOut', ptDataFader);
SetIsInput(Tempoout,FALSE);
SetMax(TempoOut,1000);
speed :=Createparam('speed',ptDataFader);
SetisInput(speed,FALSE);
SetMax(speed,50000);
end;
// Callback procedure
Procedure Callback(N:integer);
begin
If (n=BarDur) OR (n=Length) OR (n=NbBeats) then begin
d := GetValue(BarDur);
result1 := 480000/d;
a := GetValue(length);
b := GetValue(NbBeats);
c := (a/b)/1000;
tempo :=60/c;
SetValue (TempoOut, tempo);
i :=result1;
j :=tempo;
x := (i/j)*100;
SetValue(speed,x);
end;
end;
// Global variables
//////////////////////////////
// main proc
//////////////////////////////
Procedure Process;
begin
end;