开发者

Change Volume on Mac programmatically

开发者 https://www.devze.com 2023-03-12 00:20 出处:网络
I\'m looking for a not applescript way 开发者_开发知识库to change the system volume on Mac OS X programmatically.

I'm looking for a not applescript way 开发者_开发知识库to change the system volume on Mac OS X programmatically. I just couldn't find a solution. Anyone any ideas?


Take a look at this class:

https://github.com/InerziaSoft/ISSoundAdditions

It can change system volume and make use of CoreAudio API.

An example of usage should look like this:

[NSSound setSystemVolume:0.5]


In case anybody is still interested in this topic: I have adapted the great ISSoundAdditions to Swift 5 and have also made its design a bit cleaner by declaring a public interface (NSSound.systemVolume)through which you can super easily manage the system sound volume through getting and setting properties (NSSound.systemVolume and NSSound.systemVolumeIsMuted). Check it out: https://github.com/mabi99/NSSound_SystemVolumeExtension

0

精彩评论

暂无评论...
验证码 换一张
取 消