Macros that remember previous state

The Virtual Audio Mixer discussions and support...
thusup
Posts: 18
Joined: Mon Mar 26, 2018 10:54 pm

Macros that remember previous state

Postby thusup » Sun Apr 22, 2018 8:57 pm

I have two sets of hardware outputs: speakers and a pair of headphones. I toggle between them by muting one or the other. I'd like to have a system-wide mute button that mutes both when in ON state but returns them to their previous state when in OFF state.

I'm trying to figure out if there's a way to do that in VoiceMeeter's macro buttons.

brickviking
Posts: 45
Joined: Sat Jan 30, 2016 11:07 am
Location: Here, of course!

Re: Macros that remember previous state

Postby brickviking » Mon Apr 23, 2018 11:03 am

The only way I can get that to work is to have a button that toggles between the headset or the speakers (I needed EndPointController being executed by System.command() to get this to work), and another button that mutes the primary Output bus. As you can see, it's still two buttons rather than the one button you're asking about.

Sorry I'm not of much help on this question.

(Post 27)

Vincent Burel
Site Admin
Posts: 1274
Joined: Sun Jan 17, 2010 12:01 pm

Re: Macros that remember previous state

Postby Vincent Burel » Wed Apr 25, 2018 9:00 am

MAcroButtons can define a 2 position buttons.

then you just have to mute related busses in script:

Button Push
bus(0).mute = 1;
bus(1).mute = 1;

Button Release
bus(0).mute = 0;
bus(1).mute = 0;

you can even define an initial state, on MacroButton startup
bus(0).mute = 0;
bus(1).mute = 0;

does it reply to the question?.

brickviking
Posts: 45
Joined: Sat Jan 30, 2016 11:07 am
Location: Here, of course!

Re: Macros that remember previous state

Postby brickviking » Thu Apr 26, 2018 12:22 am

I think what he's more after is:

Switch Outputs button:
Button Push
bus(0).mute = 1; # A1 muted
bus(1).mute = 0; # B1 live

Button Release
bus(0).mute = 0; # A1 live
bus(1).mute = 1; # B1 muted

His initial state, on MacroButton startup would look like this:
bus(0).mute = 0; # A1 live
bus(1).mute = 1; # B1 muted
(the # comments should be stripped before inclusion)

Mute All Outputs button:
Button Push:
bus(0).mute=1;
bus(1).mute=1;

Please correct me if I'm wrong.

Muting all relevant devices is easy. The trick here for the Button Release is that MacroButtons doesn't have a way of checking what state ANOTHER button is in before toggling that state. I did it another way, I merely pointed A1 at whatever I wanted my primary device to be, and by definition, the other device wouldn't then receive any sound. But that requires another program that swaps hardware output devices (EndPointController), which is a bit tricky to use.

Perhaps a MacroButtons command could be added to provide for swapping hardware devices on the primary output.


(Post 28)

Vincent Burel
Site Admin
Posts: 1274
Joined: Sun Jan 17, 2010 12:01 pm

Re: Macros that remember previous state

Postby Vincent Burel » Thu Apr 26, 2018 7:24 am

brickviking wrote:Perhaps a MacroButtons command could be added to provide for swapping hardware devices on the primary output.


This synthax could be implemented to change the current state (i note it)
bus(0).mute += 1;

brickviking
Posts: 45
Joined: Sat Jan 30, 2016 11:07 am
Location: Here, of course!

Re: Macros that remember previous state

Postby brickviking » Fri Apr 27, 2018 11:53 pm

Vincent Burel wrote:
brickviking wrote:Perhaps a MacroButtons command could be added to provide for swapping hardware devices on the primary output.


This synthax could be implemented to change the current state (i note it)
bus(0).mute += 1;


That'd be great! That would probably answer his question.

uhm... how does it work for restoring both his outputs to previous state? Let's say bus(0) was mute=1 and bus(1) was mute=0, then both got muted, then the button gets pressed and this command got used, what would be the outputs for bus(0).mute and bus(1).mute?

Sorry if I'm asking something that seems obvious, I just don't know how it works in this scenario. The thing I've loved about MacroButtons syntax so far is that it's understandable to me, as my coding skills aren't that great.

(Post 29)

thusup
Posts: 18
Joined: Mon Mar 26, 2018 10:54 pm

Re: Macros that remember previous state

Postby thusup » Tue May 08, 2018 12:25 am

I realize I should have showed the buttons in question.

    Bus 0 is the front channel speakers
    Bus 1 is the rear channel speakers
    Bus 2 is the headphones
All of these devices can be messed with simultaneously in Voicemeeter at this time. The speakers are plugged into the onboard sound ports, the headphones are plugged into a USB sound card.

Mute:

Code: Select all

On:
Bus[0].mute = 1
Bus[1].mute = 1
Bus[2].mute = 1

Off:
Bus[0].mute = 0
Bus[1].mute = 0
Bus[2].mute = 1


Headphone Toggle:

Code: Select all

Initial State:
Bus[0].mute = 0
Bus[1].mute = 0
Bus[2].mute = 1

On:
Bus[0].mute = 1
Bus[1].mute = 1
Bus[2].mute = 0

Off:
Bus[0].mute = 0
Bus[1].mute = 0
Bus[2].mute = 1


This means if I am on speakers (or headphones as applicable) and I hit mute, switching to headphones (or speakers as applicable) will unmute whatever I switched to. However the mute macro button will still be pressed. That means I now have to hit the macro mute button two times to actually mute the system. Hopefully that makes sense. I'm not sure how to approach correcting that (admittedly minor) UI/UX issue.


Return to “Voicemeeter”

Who is online

Users browsing this forum: No registered users and 7 guests