如何更改 Xcode 应用程序中的音量级别?
我正在使用 Xcode 创建一个 Mac OSX、Objective-C、cocoa 应用程序。
我的应用程序中的声音效果音量非常高(这会伤害我的耳朵!)并且某些声音效果是如此之大低到我听不到它们...
这就是我的代码的样子:
- (void)playSound {
NSSound *sound = [NSSound soundNamed:@"Start-up-sound-1"];
//This is where I want to turn the volume up
[sound play];
NSSound *sound2 = [NSSound soundNamed:@"Start-up-sound-2"];
//This is where I want to turn the volume down
[sound2 play];
}
如何在不使用 Mac 的情况下更改 Mac 上的音量按键盘上的音量键?
请帮忙并谢谢大家:D
I am using Xcode to create a Mac OSX, Objective-C, cocoa app.
I have sound effects in my app that have a very high volume (it hurts my hears!) And some sound effects are so low that I can't hear them...
This is what my code looks like:
- (void)playSound {
NSSound *sound = [NSSound soundNamed:@"Start-up-sound-1"];
//This is where I want to turn the volume up
[sound play];
NSSound *sound2 = [NSSound soundNamed:@"Start-up-sound-2"];
//This is where I want to turn the volume down
[sound2 play];
}
How can I change the volume on my mac without pressing the volume keys on my keyboard?
Please help and thanks guys :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做几件事,
您可以使用 Audacity 这样的应用程序并更改样本的音量(更好),或者您可以使用其他一些具有音量控制的库,例如 CocosDenshion。
据我所知,NSSound 没有音量控制,我确实认为最简单的解决方案就是编辑您的实际样本。
谢伊。
You can do a couple of things ,
Either you can just take an app like Audacity and change the volume of the samples (better), or you can use some other library like CocosDenshion that has volume controls.
As far as i'm aware, NSSound doesn't have a volume control, and I do think the easiest solution would just be to edit your actual samples.
Shai.