vMix Forums
»
General
»
General Discussion
»
vMix script, action based on current state.
Rank: Advanced Member
Groups: Registered
Joined: 6/26/2011(UTC) Posts: 30 Location: London
Was thanked: 8 time(s) in 4 post(s)
|
For IFB to vmix callers, I have a script that (amoung other things) changes a vMix callers audio source on press of a streamdeck button.
API.Function("VideoCallAudioSource",X,"BusD")
Then on release of the streamdeck button it switches it again.
API.Function("VideoCallAudioSource",X,"BusA")
This is all well and good when you know the caller will always originate on Bus A.
However I now have a production where they could originate from A or G.
Could someone possibly help me write a script, or point me in the right direction of how to. I know it's possible to call the current state of everything, but it's beyond my ability to save a state, then recall it later. My scripting ability is limited to simply sending functions, and I'm struggling to backwards engineer other similar examples found here on the forums.
Many thanks.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,219 Location: Belgium Thanks: 292 times Was thanked: 955 time(s) in 790 post(s)
|
While i don't use multiple calls and such i'm pretty sure one can check (API XML) the call's BUSses you assigned to it and go from there Quote:<input key="***********" number="12" type="VideoCall" title="Call ***" shortTitle="Call ***" state="Running" position="0" duration="0" loop="False" muted="False" volume="100" balance="0" solo="False" audiobusses="A" meterF1="0" meterF2="0">Call guy</input>
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 6/26/2011(UTC) Posts: 30 Location: London
Was thanked: 8 time(s) in 4 post(s)
|
Thanks doggy,
That's excellent, so we know the information is there :)
Now in scripting, how can I call that information, save it in memory somehow, change the bus on button down, then change it back to the previous state on button up!
I appreciate this is relatively specialist knowledge, and I'd be happy to pay someone to write this for me, along with a few other handy scripts I have in mind. Are there people here that offer custom vmix scripting as a service?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 6/26/2011(UTC) Posts: 30 Location: London
Was thanked: 8 time(s) in 4 post(s)
|
Success! (Mostly) Posting for the benefit of others who might need something similar. Firstly, I have now learnt how to read information from the XML and action based on it, very usefull :) https://forums.vmix.com/...86-Scripting-for-Dummiesdoggy's post is very handy but if you don't know vb.net you need to learn or find a friend who does before you can make any sense of it. So it turns out you cannot get the information you need from the XML. The "VideoCallAudioSource" is not shown anywhere in the XML, frankly very little output information is available. In the end I took a different approach. It's prone to error but it's good enough for me for now. In the specific case of my production I can infer which audio bus they are being sent, by reading other things like whether they are active, or on an overlay, or which audio busses their own audio is being sent to... I know that if a callers audio is being sent to BusG, they should also be recieving BusG. And if it's being sent to Busses M and A, they should be recieving BusA. So now I have the streamdeck button down will swap their audio source to my IFB bus as usual. Then on button up it runs a script to check which bus their audio is being sent to, and changes their return audio accordingly. Good luck!
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,219 Location: Belgium Thanks: 292 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: Andrew if you don't know vb.net you need to learn or find a friend who does before you can make any sense of it.
True but explaining how to code here would not fit here in the forum. There are tons of google searches explaining how to code in vb.net , or even c#.net and translate to vb.net The ability to use scripting with such code did open up a whole world within vMix
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 12/1/2020(UTC) Posts: 2
|
Originally Posted by: Andrew Success! (Mostly) Posting for the benefit of others who might need something similar. Firstly, I have now learnt how to read information from the XML and action based on it, very usefull :) https://forums.vmix.com/...86-Scripting-for-Dummiesdoggy's post is very handy but if you don't know vb.net you need to learn or find a friend who does before you can make any sense of it. So it turns out you cannot get the information you need from the XML. The "VideoCallAudioSource" is not shown anywhere in the XML, frankly very little output information is available. In the end I took a different approach. It's prone to error but it's good enough for me for now. In the specific case of my production I can infer which audio bus they are being sent, by reading other things like whether they are active, or on an overlay, or which audio busses their own audio is being sent to... I know that if a callers audio is being sent to BusG, they should also be recieving BusG. And if it's being sent to Busses M and A, they should be recieving BusA. So now I have the streamdeck button down will swap their audio source to my IFB bus as usual. Then on button up it runs a script to check which bus their audio is being sent to, and changes their return audio accordingly. Good luck! So glad I have finally found someone who has successfully implemented this! I've been searching the forums for hours trying to find anything remotely similar with little success (probably searching for the wrong thing). I'm just starting out with scripting and im stuck on this one so far. I can understand all the elements. But putting them together is where I'm falling apart! At the risk of sounding a bit cheeky, Would you be willing to share your final script for me to have a browse through. I just need something to get me on the right track. Thanks in advance!
|
|
|
|
Rank: Member
Groups: Registered
Joined: 8/7/2020(UTC) Posts: 14 Location: Philadelphia Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Add one more in this exact situation. Figured I'd share what I have so far in case you're still looking: Quote: dim xml = API.XML() dim x as new system.xml.xmldocument x.loadxml(xml)
dim call01 as string = "" call01 = (x.SelectSingleNode("//input[@title='Call_01']/@audiobusses").Value)
If call01 = "A" Then API.Function("VideoCallAudioSource",Input:="Call_01",Value:="BusA")
Else API.Function("VideoCallAudioSource",Input:="Call_01",Value:="BusG")
End If
To see how it works, add a Video Call, name it Call_01. Then run the script and you'll see different actions based on whether Audio Bus A on Call_01 is turned on or off; if A and nothing else is on Call_01 Audio return goes to Bus A. Otherwise it sets to Bus G. The first block is something to do with pointing the script at the local vMix XML. Someone else is welcome to explain that better than me. The second block creates a variable named call01, and tells it to dig into the XML and assign it the values of the Call_01 enabled audio buses. Thanks to Doggy for that part. Third block is your conditional; sub in whatever commands you want to run after the API.Function text. In this case switching the Call_01 Return Bus. This is probably similar to how Andrew's script worked; since we can't read the VideoCallAudioSource as a variable (at least not easily), I'm using the Audio Bus on the Call as a flag of sorts, given that where it's audio is routed is indicative of where the call is in the show (Green Room, On Deck, or On Air for me). I'm sure there are more elegant solutions, but this seems to do the trick and I get how it works without having to learn a whole new language ground up.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 6/26/2011(UTC) Posts: 30 Location: London
Was thanked: 8 time(s) in 4 post(s)
|
Sorry Banham I didn't spot your question a month ago. My script is very similar to TRMaCoy, a few differences. If you can reference your inputs by keys, do. Otherwise the script will break if you have other video engineers using the preset that don't know not to change the input names! And a slightly improved check. will only work if the callers audio is only going to A. Where as Quote:If StateOf.IndexOf("A") > -1 Will work if the callers audio is going to A, regardless of any other busses it may or may not be going to. And finally, I add a short sleep in there because users tend to lift the IFB button before they have quite finished what they are saying, made worse by the delay of vmix very large audio buffer. Quote:
'IFB Off Script. Is a callers audio going to A or G?
dim xml = API.XML() dim x as new system.xml.xmldocument x.loadxml(xml)
dim StateOf = (x.SelectSingleNode("//input[@key='b4a5e0e2-905e-416c-bd11-2bd3d2be54f5']/@audiobusses").Value)
If StateOf.IndexOf("A") > -1 'Console.WriteLine("Caller Live. Changing source back to A")
Sleep(300)
API.Function("VideoCallAudioSource","b4a5e0e2-905e-416c-bd11-2bd3d2be54f5","BusA")
Else If StateOf.IndexOf("G") > -1 'Console.WriteLine("Caller in GreenRoom. Changing source back to G")
Sleep(300)
API.Function("VideoCallAudioSource","b4a5e0e2-905e-416c-bd11-2bd3d2be54f5","BusG")
End If
Every time I write in a feature that does something like this, I also add a variation of it to a master "CheckAndRefresh" script, so if things ever get out of sync I can run that script to quickly fix it. Since doing this state saving workaround, I have now taken the method a step further and have hidden inputs that's sole purpose is to save the states of things. Silent wav files I send to audio busses, or even title inputs with text fields. Opened up a lot of possibilities. Good luck :)
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
vMix script, action based on current state.
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close