Home AMX User Forum AMXForums Archive Threads Tips and Tricks

Discrete and Feedback on the same channel in Netlinx

Up until now I thought it was not possible to do as we not have control of to/from/feed back (that I know of) from inside a self programmed module (outside of Duet). Recently I got some tko files for a job that someone wanted me to look at from 3 years ago and it seems that it is possible. Anyone know how to do it?

Comments

  • ericmedleyericmedley Posts: 4,177
    If I'm understanding you correctly...
    If you are referring to how some SNAPI channels in Duet serve both as feedback and will also force something to a discrete state based upon the main program turning on or off the same channel. Case In Point: Channel 199 is the feedback for audio mute and turning that channel on or off forces the audio to mute and unmute.

    There is nothing particularly magical about doing this in Netlinx. The two Netlinx-based elements needed to make it happen are

    The issue has more to do with avoiding a programming loop which the channel event that results from a change in feedback status is also causing an action to do whatefver the feedback said. example: The mute coming on from a device causes the feedback of channel 199 to come on, which then causes a channel event:ON to happen on channel 199, which then causes the module to mute the device, which the device responds by muting the audio, which then causes the feedbck channel to turn on (again) - wash rinse repeat.

    What you need to do in programming is just make sure to track the state of the channel in a global variable via a channel event. Then when the feedback occurs, first check the status of the channel. If it's already in the ON state, don't bother turning it on again. Same with OFF. That breaks the loop

    I've always felt that the SNAPI channels and LEVELs in Netlinx were kind of a half-baked cookie.

    We've always had a good understanding and implementation of how they work. A button's feedback (channel) was a clean break in the functionality. A push of a button causes a BUTTON_EVENT and does nothing with the button's channel. changing a button's feedback (it's channel) does not then generate a button_event.

    However, the level/fader on a device breaks this. I'm an old recording studio engineer. We've always understood the difference between a level meter and a fader. The fader does stuff, the level tells you stuff. Action/Feedback. But, in Netlinx the two things are intertwined. If I send a feedback update to a volume level on a TP, it then generates a new LEVEL_EVENT. I've always felt that in Netlinx we need to SEND_LEVEL for feedback, but we need a FADER_EVENT for stuff that is strictly for feedback.
  • NZRobNZRob Posts: 70
    Thanks for the response Eric - it was more to do with changing the feedback channel status without using the output channel. On closer inspection, they are just doing as you talked about.
  • If I understand correctly what you are trying to achieve, there are two undocumented NetLinx commands for use in a module that wil help you do this, while 'breaking' the feedback loop that Eric mentioned.

    If you use:

    CREATE_DYNAMIC_DEVICE

    and

    TRANSLATE_DEVICE


    you effectively create two devices as seen from inside the module: one that receives the input from the main program and another on which you can set the output to the main program. Outside from the module it acts like one device.

    Although Duet modules are programmed by AMX in Java (I guess), they use the same sort of mechanism for this. Take the example that Eric mentioned, channel 199 for audio mute, or 211 for video mute, or 255 for power.

    AMX has no further documentation on these commands but there are a couple of forum posts about it:

    http://www.amxforums.com/forum/technical-forum/netlinx-studio/2012-the-not-documentary-function

    http://www.amxforums.com/forum/technical-forum/10058-?_=1455568805410

    and probably a few more, but it's hard to find a good explanation


    Good luck, Richard

  • NZRobNZRob Posts: 70
    awesome - that is exactly what I was looking for - thank you very much!
  • ericmedleyericmedley Posts: 4,177
    Just fond out the next version of NS will have the ability to emulate custom events.
Sign In or Register to comment.