Welcome to %s forums

BrainModular Users Forum

Login Register

How to trig in fastscript… ?

I need help on a Patch
Post Reply
User avatar
Vincent
Member
Posts: 317
Location: PACA
Contact:

How to trig in fastscript… ?

Post by Vincent » 17 Jun 2022, 11:35

Hi!

In a script, I'm wondering how to send a trig signal to a trig output:

Code: Select all

// trigger output
TrigNext := CreateParam('trig next',ptButton,pioOutput);
I suppose I should insert something like a "doevents" between "TrigNext.asInteger(1);" and "TrigNext.asInteger(0);", but I don't know how to code that.

Code: Select all

TrigNext.asInteger(1);
// something to insert here, but what?
TrigNext.asInteger(0);
I did not find a page with some infos on procedures and functions…

Thanks for the help.
Have a good day.

Vincent
vincent michel
composer & novelist

sm_jamieson
Member
Posts: 521

Post by sm_jamieson » 18 Jun 2022, 01:43

As I understand it, a "trigger" is when the output value goes to 1 for one processing bloc (possibly several blocks would be OK),
then back to 0.
The Process procedure is called once per processing bloc.
So you cannot do it in a single call to Process. You need to set the trigger output to 1 and also set a flag that will tell you to set
it back to 0 on the next call to Process.

This also implies you cannot have a trigger every bloc, you need 2 blocs to complete the trigger.
I'm not sure at what precise instant in the 1,0 sequence the trigger actually occurs.

Simon.

User avatar
senso
Site Admin
Posts: 4370
Location: France
Contact:

Post by senso » 19 Jun 2022, 09:31

yes it has to be handled by the Process procedure

Code: Select all

// flag
var sendTrigger:boolean;

Procedure Process;
begin
      if sendTrigger
      then begin
            TrigNext.asInteger(1);
            sendTrigger := false;
      end
      else TrigNext.asInteger(0);

end;

User avatar
Vincent
Member
Posts: 317
Location: PACA
Contact:

Post by Vincent » 30 Jun 2022, 22:05

Hi my friends,

Sorry for the delay: I did not recieve any alert... maybe a small bug in the forum...

Thanks anyway for your answers.
And yes of course, I understand now it has to be handled by the Process procedure!

Have a good day.

V
vincent michel
composer & novelist

Post Reply