Welcome to %s forums

BrainModular Users Forum

Login Register

How do I create a global variable in patches?

I need help on a Patch
Post Reply
dullard
Member
Posts: 21
Contact:

Unread post by dullard » 23 Sep 2009, 18:06

Hi All,
After searching the forum archives, there was mention of a global variable module but usine seems to no longer have one.

I have been using the following approach but it doesn't seem to work. Can anyone point out what is wrong with this method?

I created a patch with a ''set variable'' bus coming in and a ''get variable'' bus going out. Inside the patch is a variable module with the ''set variable'' bus going in to the input pin and a ''has changed'' module coming from the ''set variable'' bus going into the affect pin. The output of the variable module goes to the ''get variable'' bus.

I am writing to my global variable by sending the output from a pass module to the "set variable'' bus whenever I want to change the value... however the value in the global variable patch doesn't change.

Any ideas as to what's wrong with this approach or a better way of doing it I would be glad to hear.

Thanks

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 23 Sep 2009, 20:22

so you have something like this...?
Image

dullard
Member
Posts: 21
Contact:

Unread post by dullard » 23 Sep 2009, 23:17

Yes, exactly like that (nice graphic btw, I must find a good screenshot utility) but it isn't working for me... I must have put a spanner in the works somehow (assuming your example works for you.)

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 24 Sep 2009, 07:23

yes , this patch works here..
be carefull to have exactly the same name for get / send bus ..? check space for example..
about capture tool , check FastStone Capture 6.5...;-)

dullard
Member
Posts: 21
Contact:

Unread post by dullard » 24 Sep 2009, 18:56

I think I have identified the problem. If you have more than one thing sending a signal into the set variable bus, then even though the flow has been halted using the pass module, the values going through the bus don't stop with the result that on the GetBus end, the value is randomly flicking through the last values that came in through the SendBusses. It is as if the flow was never stopped and there's no predictable behaviour for 2 different signals going into the same bus from different patches.

This leaves me back to working out how to make a global variable...

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 24 Sep 2009, 22:43

hu , not sure to follow you...
first you said "the value in the global variable patch doesn't change." now "as if the flow was never stopped"...?
and if you send send many information to the same bus , and if there is always something coming in , it's normal that the " has changed " module let always pass information ...?

dullard
Member
Posts: 21
Contact:

Unread post by dullard » 24 Sep 2009, 23:58

nay-seven wrote:hu , not sure to follow you...
first you said "the value in the global variable patch doesn't change." now "as if the flow was never stopped"...?
In my original workspace, I had several SendBusses sending information to the same named bus. This had the effect of one blocking the other.
nay-seven wrote:and if you send send many information to the same bus , and if there is always something coming in , it's normal that the " has changed " module let always pass information ...?
If a value is sent to a bus and then the flow stopped, the value is still present on the receiving end.
...

So, after some more searching of the forums, I realise that usine works with only one SendBus of a particular named bus. So my solution to the global variable idea is to have many busses called for example: "set variable1", "set variable2", etc that are only used once in other patches but all lead to the same "get variable" bus as an output which can then be used all over the place.

Image

Note that the var module isn't needed as the "get variable" bus retains it's value.

Post Reply

Who is online

Users browsing this forum: No registered users and 83 guests