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.
Macros that remember previous state
-
- Posts: 45
- Joined: Sat Jan 30, 2016 11:07 am
- Location: Here, of course!
Re: Macros that remember previous state
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)
Sorry I'm not of much help on this question.
(Post 27)
-
- Site Admin
- Posts: 2139
- Joined: Sun Jan 17, 2010 12:01 pm
Re: Macros that remember previous state
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?.
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?.
-
- Posts: 45
- Joined: Sat Jan 30, 2016 11:07 am
- Location: Here, of course!
Re: Macros that remember previous state
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)
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)
-
- Site Admin
- Posts: 2139
- Joined: Sun Jan 17, 2010 12:01 pm
Re: Macros that remember previous state
This synthax could be implemented to change the current state (i note it)brickviking wrote:Perhaps a MacroButtons command could be added to provide for swapping hardware devices on the primary output.
bus(0).mute += 1;
-
- Posts: 45
- Joined: Sat Jan 30, 2016 11:07 am
- Location: Here, of course!
Re: Macros that remember previous state
That'd be great! That would probably answer his question.Vincent Burel wrote:This synthax could be implemented to change the current state (i note it)brickviking wrote:Perhaps a MacroButtons command could be added to provide for swapping hardware devices on the primary output.
bus(0).mute += 1;
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)
-
- Posts: 20
- Joined: Mon Mar 26, 2018 10:54 pm
Re: Macros that remember previous state
I realize I should have showed the buttons in question.
Mute:
Headphone Toggle:
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.
- Bus 0 is the front channel speakers
Bus 1 is the rear channel speakers
Bus 2 is the headphones
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
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