Author Topic: Implementing the InPunch function  (Read 586 times)

Offline norfolkmastering

  • Full Member
  • ***
  • Posts: 191
Implementing the InPunch function
« on: August 01, 2023, 12:02:28 PM »
Hi Alexey

Some time ago you helped me to implement the InPunch function so that I was able to trigger a feedback MIDI output whose value was either 0 or 127 depending on whether the Cakewalk NOW time was outside or within the punch region.  This works fine.

I have an additional use for InPunch.
I want to use it to determine whether some transport related SysEx messages are allowed to be output from AZ.
This is related to using Cakewalk to control one of my external tape machines to enter RECORD PLAY mode but only when within the punch region.

The test AZ preset I created is called MTC-1 and is attached.  You will see that the 'Punch Region' MIDI feedback output on CH8 CC 0, works correctly.

However the preset is not actually changing the Software State of 'In-Punch' when the NOW time enters or leaves the punch region.  This is what I actually require for the new use.  (I don't need the MIDI feedback output in this case).

Could you help me to modify the preset please so this is possible.

Regards
Robert

Offline azslow3

  • Administrator
  • Hero Member
  • *****
  • Posts: 1679
Re: Implementing the InPunch function
« Reply #1 on: August 01, 2023, 01:39:07 PM »
I have reversed Yes/No to match InPunch meaning (if "Time in punch" has failed, we are NOT in Punch).

But important addition is in Feedback, "Set monitored InPunch to engine".

Any changes done during monitor evaluation (so in Logic before the Monitor Action) are "temporary". Inside Monitor (Feedback) state changes are still "temporary", till explicitly asked to be saved (into engine). Note that "Set engine state" flag meaning during Monitor evaluation is different, marked by that flag Action will be ignored during evaluation. So that is not the right way to do this (I know, from common sense it should be... but sorry, there was good reason to introduce such ugly logic...).

AZ Controller has 3(!) different execution contexts and many Actions do different things in different contexts:
* "direct" execution, when Logic control is executed as the reaction on incoming MIDI (OSC, game controller), including loop-back .
* "monitor evaluation", actions in the Logic control before Monitor in question are executed every time Monitor should be evaluated
* "monitor" execution, when the Monitor is triggered, corresponding Feedback Actions are executed.
 
As an example for the difference, "Set state" Action:
* change the state permanently in "direct" execution
* change the state temporary in "monitor evaluation" execution when "Set engine state" is unset
* ignored in "monitor evaluation" when "Set engine state" is set
* change the state temporary in "monitor" execution when "Set engine state" is unset
* change the state permanently in "monitor" execution when "Set engine state" is set (from what I remember, it also set temporary state).

"monitor" execution still "see" temporary changes done during evaluation.

Offline norfolkmastering

  • Full Member
  • ***
  • Posts: 191
Re: Implementing the InPunch function
« Reply #2 on: August 01, 2023, 06:02:40 PM »
Hi Alexey
Your preset modifications work perfectly!
Thanks very much.
Regards
Robert