I am probably looking something very simple. I try to control the overall system audio from my application. Desktop and Mac only.
Trying to control volume and muting for starters. I tried with several declares but nothing seems to work. Sending keyboard-strokes for F12 (with system-permission) is also not working.
The user will push the button to increase / decrease or mute the sound of course.
A little background maybe: It is an in-house always on top sidebar application that the users have requested it would be very useful of they have these buttons. A variety of music or generated tones is being played by different applications on different systems. So to be able to control the system-volume is most applicable. Same as using the keys on a “multimedia” keyboard. But these are not connected.
So - these proposed buttons are to control the system volume, not the volume of the sounds your app generates.
Aren’t those already provided by the operating system, a multimedia keyboard, etc? Why does your app need to replicate this functionality? Perhaps I’m missing something here.
Although I agree with Eric (there already are many ways to control the sound volume either using the mouse or keyboard, so what’s the point of adding yet another one?), what you’re after can be achieved using the MBS plugins. Do you have them?
It is a highly controlled environment. Adding or changing a keyboard is not possible. Even a mouse is not always connected and the users do not have access to system controls. This does not apply to all users, but these are the most constricted I have to deal with. Think like kiosk mode.
For now I have a quick workaround by turning the following AppleScript into an app with Automator and launching that from a button.
tell application "System Settings"
set currentVolume to get volume settings
set isMuted to output muted of currentVolume
if isMuted then
set volume without output muted
else
set volume with output muted
end if
end tell