Applescript:检查计算机是否正在播放任何声音

编程入门 行业动态 更新时间:2024-10-26 18:30:08
本文介绍了Applescript:检查计算机是否正在播放任何声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

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

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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 14:48:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/915705.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:正在播放   声音   计算机   Applescript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!