Applescript:检查计算机是否正在播放任何声音 [英] Applescript: Check if computer is playing any sound

查看:33
本文介绍了Applescript:检查计算机是否正在播放任何声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图为我的脚本找到一种方法来检查计算机上当前是否正在播放任何声音/音频.如果是这样,有什么方法可以找到哪个应用正在播放声音?

Trying to find a way for my script to check if there's any sound/audio being played currently on the computer. And if so, is there any way to find which app is playing sound?

推荐答案

也许这有帮助:

播放声音时发生的一件事是电源管理阻止计算机进入睡眠状态.使用 pmset -g 您可以看到所有正在发生的电源管理内容.

One thing that happens when a sound is played is that the power management blocks the computer to go to sleep. With pmset -g you can see all the Power Management stuff that is going on.

因此,当coreaudiod"阻止睡眠时,机器显然正在播放一些声音.

So, when sleep is prevented by "coreaudiod" the machine is playing obviously some sound.

这里是 pmset -g 在 iTunes 播放时吐出的内容:

Here what pmset -g spits out when iTunes is playing:

Currently in use:
 womp                 0
 halfdim              1
 sms                  1
 hibernatefile        /var/vm/sleepimage
 gpuswitch            2
 networkoversleep     0
 disksleep            10
 sleep                10 (sleep prevented by iTunes, coreaudiod)
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         10
 acwake               0
 lidwake              1


这篇关于Applescript:检查计算机是否正在播放任何声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆