What's wrong with this code?
a_riot42
Posts: 1,624
button_event[dvTP, 3] { push: { if(audioSwStatus.isMuted[cnKitchen]) { off[vdvAudioOutputs[cnKitchen], cnMute] } else { on[vdvAudioOutputs[cnKitchen], cnMute] } } }
0
Comments
If that doesn't do it, can you post the variable declarations as well?
Jeff
If the latter then you might be getting an array error in that cnKitchen is equal to zero when you push the button.
You could add a condition in the IF statement to catch it.
It was a trick question It compiles and runs fine. But it seems to me that it would be easier and less bug prone to just do this:
Won't they accomplish the same thing? I have seen others write it the first way and I am not grokking why.
That code will not do the same thing as the original code because the original code is using the actual mute state to set the channel feedback, where this code is just simply toggling the feedback based on the feedbacks current state. That said, you could do this:
Jeff
Still not grokking. The feedback is determined by the actual mute state of the virtual. The audioSwStatus[cnKitchen].isMuted variable will get updated by the module depending on whether the mute is on or not. So when you do this:
that tells the virtual device to toggle the mute state doesn't it? The feedback will get taken care of automagically.
Paul
Jeff
Yes I should have been more clear as to what these things were. It's an autopatch switch so I have an array of virtual outputs. The audioSwStatus is just a structure to store volume/mute etc. I don't really need one for mute since I can tell if an output is muted this way, if([vdvAudioOutputs[cnKitchen], cnMute]) but I haven't found a way to determine the level of a virtual level, only if its channel is on or off. Is there a way to do that? I would think there should be, other than keeping a record of it and constantly updating it.
Paul
'Cause we get paid by the line.
Paul