vMix Forums
»
General
»
General Discussion
»
Possible to toggle between inputs on a layer using one button?
Rank: Advanced Member
Groups: Registered
Joined: 12/8/2022(UTC) Posts: 154  Thanks: 48 times Was thanked: 3 time(s) in 3 post(s)
|
Hi all! I'm looking into the possibility to toggle between a defined set of inputs on a layer on an input using a button on a streamdeck. So that a button press changes to the next input on that layer on a predefined list of inputs. Use case is to find an easy way to change input in a box on a splitview input without having to go into vMix settings or use up a lot of buttons on the streamdeck. I would prefer if this was possible using the Companion software. But I would also be happy to map a button to shortcuts in vmix and/or script.
Thanks in advance for any help with this!
|
|
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/8/2022(UTC) Posts: 154  Thanks: 48 times Was thanked: 3 time(s) in 3 post(s)
|
Update: Mr AI helped me create a script that seems to do what I want :-)! I will run some more testing and then post it in the scripting forum.
|
|
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/8/2022(UTC) Posts: 154  Thanks: 48 times Was thanked: 3 time(s) in 3 post(s)
|
Here is the script AI created for this function. It works with input names to instead of input numbers. Code:
' ==========================================
' SETTINGS
' ==========================================
' Change to your actual input numbers or names
Dim targetInput As String = "1"
Dim layerNumber As Integer = 1
Dim sourceInputs() As String = {"2", "3", "4"}
' ==========================================
Dim xml As String = API.XML()
Dim x As New System.Xml.XmlDocument
x.LoadXml(xml)
' The correct XML path for vMix Dynamic Values is //dynamic/value1
Dim currentIndexNode As System.Xml.XmlNode = x.SelectSingleNode("//dynamic/value1")
Dim currentIndexStr As String = ""
If currentIndexNode IsNot Nothing Then
currentIndexStr = currentIndexNode.InnerText
End If
Dim currentIndex As Integer = 0
' Attempt to convert the saved value to an integer
If Integer.TryParse(currentIndexStr, currentIndex) Then
' Move to the next input in the list
currentIndex = currentIndex + 1
Else
' If the value is empty (e.g., the very first time the script runs)
currentIndex = 0
End If
' If we have reached the end of the list, start over from zero
If currentIndex >= sourceInputs.Length Then
currentIndex = 0
End If
' Get the name/number of the next input from the list
Dim nextInput As String = sourceInputs(currentIndex)
' Print info in the vMix Scripting log for troubleshooting
Console.WriteLine("Found saved index: " & currentIndexStr)
Console.WriteLine("Changing to index: " & currentIndex & " (Which is Input: " & nextInput & ")")
' Build the SetLayer command and send it to vMix
Dim layerValue As String = layerNumber.ToString() & "," & nextInput
API.Function("SetLayer", Input:=targetInput, Value:=layerValue)
' Save the new index so vMix remembers it for the NEXT time the script is executed
API.Function("SetDynamicValue1", Value:=currentIndex.ToString())
|
|
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Possible to toggle between inputs on a layer using one button?
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