Rank: Member
Groups: Registered
Joined: 10/21/2020(UTC) Posts: 17 Location: Bulkington Thanks: 5 times
|
So i have been trying to create a simple volume up button (increase/decrease by 3% for example!) I'm most of the way there, but have hit a wall! The general idea is, put the current volume level into a variable, add/subtract "X" amount, done! However when you read the volume, it's looks like it is logarithmic, not linear! i.e. if set to 50%, it reads as 6.25% it also doesn't help that when i search for how to convert the two, most answers require the Log function, which I don't think is supported within vMix! So this is what i have so far; Quote: Dim vol as Double Dim newvol as integer Dim callerinput as integer = 1 Dim x as new system.xml.xmldocument Dim xml as string
'.... RUN SCRIPT
xml = API.XML() x.loadxml(xml)
'Get volume level
vol = x.selectsinglenode("//input[@number='" & callerinput & "']/@volume").value
'the maths that is missing!
newvol = vol-3
'set new volume level
API.Function("SetVolume",callerinput,newvol)
'to see if the maths works
Console.WriteLine (vol) Console.WriteLine (newvol)
it works, right up until I need to sent the new number, if you know of an easier way, or can fill in the maths blanks, it would be appreciated!
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/23/2017(UTC) Posts: 28 Was thanked: 10 time(s) in 6 post(s)
|
C#, but this is what we do in Central Control Quote:float logValue = (float)Math.Pow((e.Level * 1000000), 0.25) / 100;
|
1 user thanked joedemax for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 10/21/2020(UTC) Posts: 17 Location: Bulkington Thanks: 5 times
|
Originally Posted by: joedemax C#, but this is what we do in Central Control Quote:float logValue = (float)Math.Pow((e.Level * 1000000), 0.25) / 100;
Thanks Joe, I’ll try and see if I can work it out from this! I fear the biggest issue, is that the log maths function isn’t recognised by vMix! Although I may be using the wrong syntax... programming is certainly down on my list of skills
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/28/2015(UTC) Posts: 184
Thanks: 10 times Was thanked: 32 time(s) in 27 post(s)
|
|
1 user thanked pm for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 10/21/2020(UTC) Posts: 17 Location: Bulkington Thanks: 5 times
|
Originally Posted by: pm https://www.vmix.com/knowledgebase/article.aspx/144/vmix-api-audio-levels That’s the puppy!!!... many thanks for this!!
|
|
|
|
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