Best way to get the status of megatrigs for a Macro Page?

Use this forum to post about your macro page designs in HALion 6
Post Reply
Brian Roland
Senior Member
Posts: 1104
Joined: Fri Jun 19, 2015 5:24 pm
Contact:

Best way to get the status of megatrigs for a Macro Page?

Post by Brian Roland »

I'd like to grab the status of various condition lines from megatrigs to move a cursor of which I'm calling "Focus" around on the macro page (based on a modified ListRow template).

Does the Megatriginfo parameter send any kind of usable information? If so, what does it carry and how do I extract it? I'd love to get a simple booleen corresponding to the status indicator light.

Meanwhile, I have kludged a method that feeds off the MegatrigCondChangeCount parameter. I am wondering how high this parameter counts before it eventually resets, or rather, what is a good value to plug in as the 'max'? I must enter something or it stops at 100.

Essentially the last counter to move sets the focus like so.

Code: Select all

--[[ Keyswitch Focus  -->  This gets updated using the code below.  Macro elements check it to know what to display...stacks can be hidden/shown.  Etc. ]]--

defineParameter("Focus", nil, 1)
Focus = 1

--[[ These connect to key-switch condition lines of  MegatrigCondChange Count parameters ]]--
defineParameter("ks1", nil, 0, 0, 9999999999, function() ksa() end)
defineParameter("ks2", nil, 0, 0, 9999999999, function() ksb() end)
defineParameter("ks3", nil, 0, 0, 9999999999, function() ksc() end)
defineParameter("ks4", nil, 0, 0, 9999999999, function() ksd() end)
defineParameter("ks5", nil, 0, 0, 9999999999, function() kse() end)


function ksa()
	if Focus ~= 1 then
		Focus = 1
	end
end
function ksb()
	if Focus ~=2 then
		Focus = 2
	end
end
function ksc()
	if Focus ~= 3 then
		Focus = 3
	end
end
function ksd()
	if Focus ~=4 then
		Focus = 4
	end
end
function kse()
	if Focus ~= 5 then
		Focus = 5
	end
end

How high does that count before it resets?
Last edited by Brian Roland on Tue Oct 01, 2019 3:03 am, edited 1 time in total.

AposMus
Member
Posts: 236
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Best way to get the status of megatrigs for a Macro Page?

Post by AposMus »

Megatriginfo seems to be a string parameter. I managed to set a string to it, but it doesn't seem to return any other value than the string you supplied it.

Wouldn't it be better to set all your conditions via scripting and ditch the Megatrig modules all together?
Windows 10 Pro
Cubase Pro 11
Halion 6.4
HSO
Dark Planet

Brian Roland
Senior Member
Posts: 1104
Joined: Fri Jun 19, 2015 5:24 pm
Contact:

Re: Best way to get the status of megatrigs for a Macro Page?

Post by Brian Roland »

AposMus wrote:
Mon Sep 30, 2019 5:23 pm
Megatriginfo seems to be a string parameter. I managed to set a string to it, but it doesn't seem to return any other value than the string you supplied it.

Wouldn't it be better to set all your conditions via scripting and ditch the Megatrig modules all together?
It might, but then all the 'user options' around them must be coded as well, while when using megatrigs all it takes is linking elements to already existing HALion parameters for most of the stuff. Mega-trigs rock because they are easy and fast to use. It's bone head easy to make changes on the fly during the design, and post design polish and tweak process. They are rather flexible as well. Too bad that info parameter doesn't spit out more 'documented' info (like a table or something that can be snooped).

I can see the point in using a custom script if the script itself needs to be able to delay or trigger its own key-switches. Otherwise...megatrigs are great. All they need to be even better is a better info pin to grab the status from, a built in timer in case you want to 'buffer or delay' its actions, and perhaps the ability to send data through it from scripts, or an 'option' to swap the order so lua processing comes before megatrigs rather than after them....a back door of sorts (as it seems the megatrig is processed BEFORE lua scripts, rather than after.

I.E. What if there was a blank at the very top of the megatrig module user interface, where one could insert a script 'upstream' of the megatrig? Or a checkbox in the lua module itself. Wishful thinking for the future.....

Snooping the trigger count gets the job done in this case. It's more efficient if key switches are set to the sticky mode (in the held down 'temporary' mode, the count keeps pulsing pretty regularly), but still works either way.

At this point, I'm just wondering how to enter a value for (no limit) as the maximum value when defining the parameter. The default if one simply leaves out the 'max' entry is 100.

When I tried a really huge value (the theoretical limit for a 64bit integer) like: 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368

It quit working and would only display odd looking characters in the elements attached to the parameter. The simple 5 integer Focus parameter obviously was broken as well.

The smaller integers in the example script above work just fine....but it's possible if I were to leave the rig running for a long time without relaunching things...it'll eventually choke and one will have a jumpy erratic macro at best, and possible crashes at worst. I can and will experiment, but hoped someone might know.

AposMus
Member
Posts: 236
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Best way to get the status of megatrigs for a Macro Page?

Post by AposMus »

Did some experimenting and Halion parameters uses 32bit integers.
These are signed integers though, so strictly speaking it's a 31 bit number with the most significant bit of the 32bit value used for the sign.

This will give you a positive max of 2147483647. If Megatrig gets triggered an average of once a second, that's enough room for just over 68 years. So you should be alright.

A little trick for brevity is that you can set large values using hexadecimal numbers.

This wil look a lot neater:

Code: Select all

defineParameter('YourParamHere', nil, 0, 0, 0x7FFFFFFF, 1)
Windows 10 Pro
Cubase Pro 11
Halion 6.4
HSO
Dark Planet

Brian Roland
Senior Member
Posts: 1104
Joined: Fri Jun 19, 2015 5:24 pm
Contact:

Re: Best way to get the status of megatrigs for a Macro Page?

Post by Brian Roland »

AposMus wrote:
Wed Oct 02, 2019 4:37 pm
Did some experimenting and Halion parameters uses 32bit integers.
These are signed integers though, so strictly speaking it's a 31 bit number with the most significant bit of the 32bit value used for the sign.

This will give you a positive max of 2147483647. If Megatrig gets triggered an average of once a second, that's enough room for just over 68 years. So you should be alright.

A little trick for brevity is that you can set large values using hexadecimal numbers.

This wil look a lot neater:

Code: Select all

defineParameter('YourParamHere', nil, 0, 0, 0x7FFFFFFF, 1)
Excellent...and thank you. You've helped reduce my worries.

I ultimately went with a value of: 9223372036854775807

I'd read somewhere that it's the largest integer for 64bit. Even if this version of LUA stores this stuff on 32bit scales, It seems to be working just fine with that value.

I'm not sure where I came up with that HUGE number in the earlier post...lousy research on my part...maybe that must have been floating point stuff?

AposMus
Member
Posts: 236
Joined: Fri Nov 14, 2014 11:41 am
Contact:

Re: Best way to get the status of megatrigs for a Macro Page?

Post by AposMus »

Glad it worked out.

As a matter of interest :
I couldn't figure out how you got the 64bit max value to work. When I tried a higher value than a signed 32bit I got negative the max value displayed.

Catch is, if you supply an integer increment value, then the max value is 32bit. If you supply no increment or a decimal increment, it changes to a float and the 64bit max signed value can be used.
Windows 10 Pro
Cubase Pro 11
Halion 6.4
HSO
Dark Planet

Post Reply

Return to “Macro Page Design”

Who is online

Users browsing this forum: No registered users and 1 guest