更改声音(或其他)的Mac OS X系统preferences [英] Change Sound (or other) System Preferences in Mac OS X

查看:939
本文介绍了更改声音(或其他)的Mac OS X系统preferences的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够切换在Mac OS X的声音输出源没有任何GUI交互。

I'd like to be able to switch the sound output source in Mac OS X without any GUI interaction.

有工具来完成控制声音的输出,如 SoundSource 和的applescript打开preferences对话框

There are tools to do control the sound output, such as SoundSource and an applescript to open the preferences dialog.

我要寻找的东西,瞬间切换preference,如 SoundSource ,但它必须是脚本化。目标是与键击我的数字和模拟输出之间进行切换。我有一个帮助应用程序,将启动一个程序或在的AppleScript一键preSS。所有我现在需要的是快速切换音源,无需任何用户交互的AppleScript或应用程序。

What I am looking for is something that switches the preference instantly, like SoundSource but it has to be scriptable. The goal is to switch between my digital and analog output with one keystroke. I have a helper application that will launch a program or applescript on one keypress. All I need now is the applescript or application that switches the sound source quickly without any user interaction.

我愿意写一些Objective-C的,如果这是什么需要,但我pretty多在Cocoa开发一个新手。

I'm willing to write some Objective-C if that is what it takes, but I'm pretty much a newbie at Cocoa development.

你有一个一键式的解决方案,也可以指向我一个很好的教程从一个可可应用程序或命令行控制音响系统preferences?

Do you have a one-click solution or can point me to a good tutorial on controlling sound system preferences from a Cocoa App or command line?

修改:我创建了一个命令行应用程序做正是这一点。你可以在下载<一个href=\"http://$c$c.google.com/p/switchaudio-osx/downloads\">http://$c$c.google.com/p/switchaudio-osx/downloads.来源$ C ​​$ C可在该项目的网站。

EDIT: I created a command-line application to do exactly this. You may download it at http://code.google.com/p/switchaudio-osx/downloads. Source code is available on the project site as well.

推荐答案

不要在preferences方面想它。有对这种事情没有集中系统preference框架。我相信你需要做的就是用核心音频设置<$ C $的 kAudioHardwarePropertyDefaultOutputDevice kAudioHardwarePropertyDefaultSystemOutputDevice 性质是什么C> AudioSystemObject (使用 AudioHardwareSetProperty())。

Don’t think of it in terms of preferences; there’s no centralized system preference framework for this sort of thing. I believe what you need to do is use Core Audio to set the kAudioHardwarePropertyDefaultOutputDevice and kAudioHardwarePropertyDefaultSystemOutputDevice properties of the AudioSystemObject (using AudioHardwareSetProperty()).

这篇关于更改声音(或其他)的Mac OS X系统preferences的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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