Page 1 of 1
Posted: 12 Jun 2013, 16:47
by woodslanding
I have a script based on the simple audio example script from v5. But it requires some values of type PSingle.
V6 does not recognize this type. What do I use instead? There are no audio example scripts that I can see in the new browser....
Posted: 12 Jun 2013, 22:42
by bsork
PSingle is a pointer type, and to me it seems that pointer types aren't allowed in the new version (so far?). Using ^Single instead of the predefined PSingle type didn't help. GetDataPointer() is also missing.
Here's an attempt at doing the old audio example in a different way:
Code: Select all
/////////////////////////////////////////////
// Audio Volume
// Simple Audio Volume Script
////////////////////////////////////////////
// parameters declaration
var input : Tparameter;
var output : Tparameter;
var gain : TParameter;
// initialisation : create parameters
procedure init;
begin
Input := CreateParam('In',ptaudio);
output := CreateParam('out',ptaudio);
gain := CreateParam('gain',ptDataFader);
SetIsOutPut(Input,false);
SetIsOutPut(Gain,false);
SetIsInPut(Output,false);
SetMin(gain,0);
SetMax(gain,1);
Setvalue(gain,1);
SetLength(output,BLOCSIZE);
end;
// Global variables
var i : integer;
//var pin,pout : PSingle;
var g : single;
//////////////////////////////
// main proc
//////////////////////////////
procedure Process;
begin
//pIn := GetdataPointer(0);
//pOut := GetdataPointer(1);
g := GetValue(2);
for i := 0 to BLOCSIZE-1
do begin
//pout^:= pin^*g;
//incptr(pin);
//incptr(pout)
SetDataArrayValue(1, i, GetDataArrayValue(0, i)*g);
end;
end;
This works, but uses a
lot CPU.
I tried the same in V5, and there both versions of the script worked, and both used negligible CPU.
Posted: 12 Jun 2013, 22:54
by senso
Because of the cross platform implementation (WIN,OSX,64) we use a new script engine which is less CPU friendly.
That's why the the V5 script-pointers capabilities are not available in Hollyhock.
No solution actually except rewrite a new script engine and it could take years...
But we made a particular effort to simplify the SDK. A user module is a very good option for intensive data manipulations?
Posted: 13 Jun 2013, 08:32
by woodslanding
Okay, that's good to know. I'll lay off the scripts. And I'll look into the SDK.
But for now, I realized my script doesn't need to work in the audio path anyway, it can just create a control signal for a volume module.
But I may just use modules anyway if the script engine is not cpu friendly. I mostly did it to save CPU!
cheers,
-e
Posted: 13 Jun 2013, 08:52
by woodslanding
Wow, no joke!
A simple midi change channel script takes ..33% on my quad-core i7!
16 of those, that's 5% CPU just to change midi channels.
Seems like a set of basic midi tools would be a good use for the SDK. Or nice to have as basic modules....
I'll see if it's cheaper to convert to and from midi using modules.
EDIT: that brings it down by about half. Guess that's the better choice.
Posted: 13 Jun 2013, 14:42
by 23fx23
,;:, damned macs^^ :p
Posted: 14 Jun 2013, 12:01
by seamus
I replaced some midi scripts with the midi transformer and my patch became 50% more efficient.
Thanks for the tip!
Posted: 14 Jun 2013, 13:26
by senso
check also the Midi multi-filter
Posted: 14 Jun 2013, 13:28
by senso
slowly I'll replace all midi scripts by modules which are 100x faster
Posted: 14 Jun 2013, 15:24
by seamus
Thanks senso!