Global Variables

gderreck

2020-07-16 21:37:23

Greetings,

I would like to know if global variables maintain their state when MT Pro is closed. I would like to pass a global variable's value at close, to a local variable at startup.

Thanks,

Graham

Steve-Bome Forum Moderator

2020-07-16 22:10:45

Hi Graham,

 

Global variables are not persistent across session. They are guaranteed to be 0 at project start, however if you set up a translator with rules to change their values at project open, you can make them be anything you want.

I generally set up the default values in rules this way and then create 2 translators that run a timer called "Init". The first translator is triggered by project open and the second is triggered by hitting the computer ESC key.

The timer has no output but just rules to set whatever global variables I want set. Having this all in one translator (under rules), helps keep all of my global variables well documented and available in one place.

 

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

gderreck

2020-07-16 22:50:10

Thanks Steve,

As it stands, whenever I change programs in the controller, it sends a Change Program message to Bome, which is captured and acted on by the appropriate translator. The translator output then activates the appropriate preset. That works.

I then setup a startup preset with a single translator which sends a program change notice (currently setup 1) to the controller, and yes, you guessed it, the controller sends a program change notice back to Bome, which activates the appropriate preset. That keeps the controller and Bome on the same page. But the program number is hard wired.

What I was hoping to do was have the controller and Bome preset which were active at close, activate at startup. Is there a different way around this? Or should I just be satisfied that I can start the program with the controller and Bome on the same page, so to speak?

OK. This came to me while writing the note. It seems Bome opens with the same preset active as when the program closed (That makes me wonder why other data can't persist. I digress).

So, I set up one translator for each setup in the controller. Based on which preset is active on startup, Bome outputs the raw MIDI message with the appropriate setup number and then the controller opens the appropriate setup and sends a program change message to Bome.

But how can Bome know which preset is active at startup? Even worse, there will always be 3 presets active at startup.  Program Change which acts on the setup changes in the controller during the session, Startup which sends the program change to the controller when Bome opens, and whichever preset was active when Bome was closed. So even if Bome knows which presets are active, how does it know which one to recognize. The only difference between the two special presets and the last operations preset open when Bome closed, is 'Ignore for Next/Previous preset...', is checked for the two specials.

Maybe you should just tell me to stop daydreaming and be happy that the preset in Bome matches the setup in the controller when Bome starts. Even if it is an arbitrary choice.

Sorry for the novella here. If you've got an idea, I'd be grateful to do it.

Have good one,

Graham

Steve-Bome Forum Moderator

2020-07-16 23:32:19

Hi,

I'm not sure I'm 100% following you but yes, if you close MT Pro when presets have changed within the program, MT Pro should prompt you if you want to save the file (if confirm is set in settings). Only if you save the file, will the current presets (that have changed) be active.  

If confirm is not set, it should not save the project and when opened again, the original presets will be re-activated (based on the last program file save).

I think you need to decide whether the controller tells MT Pro what state it should be at startup (by pressing a button on a controller to set a global variable or change a preset), or whether you want MT Pro to assume a given state (by global variable).

You can also tell MT Pro which presets to activate/deactivate at project start. The technique is to use a timer and have various translators activate, or deactivate presets using the same incoming timer. You could also use the "Init" timer to do this.

There is an option to deactivate all other presets when a preset is activated. You can also define "always active" preset that are not effected by this so that you can have say one preset that is never de-activated and then select among a group of the rest of the presets by activating only the one you want (having the others automatically be deactivated).

In your situation, if your controller is smart enough, you can certainly have MT Pro query the controller and then have the controller response message set the desired state (using global variable or preset change).

 

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

 

 

 

 

gderreck

2020-07-16 23:48:46

Hey Steve,

There isn't an easy way to get the data. Current setup isn't bad. Just have to change to the setup I want after Bome starts, and all is good. If I want to start with setup 1 (hardwired in Bome), I don't have to change anything. The controller and Bome will be in sync. regardless.

Thanks,

Graham

Steve-Bome Forum Moderator

2020-07-16 23:52:53

comment

Yes, bottom line is no persistent variables across session so if you need to store something, it would have to be an external controller that can save the variable for you and send it back to you at startup.