【问题标题】:System sound effect for copy, paste and delete operations复制、粘贴、删除操作的系统音效
【发布时间】:2012-05-31 01:20:34
【问题描述】:

有人知道如何在 OS X 上播放(拖动)复制、粘贴和删除操作的系统音效吗?我的意思是 Finder 在移动文件时使用的声音。我没有找到任何 API 来做到这一点。有人可能知道这些声音文件的位置吗?我只发现系统警报声(青蛙、潜艇等)。

【问题讨论】:

    标签: objective-c cocoa audio copy-paste finder


    【解决方案1】:

    SystemSounds

    中可用

    /System/Library/Components/CoreAudio.component/Contents/Resources/SystemSounds/ 位置。

    NSSound *systemSound = [[NSSound alloc] initWithContentsOfFile:@"/System/Library/Components/CoreAudio.component/Contents/Resources/SystemSounds/finder/move\ to\ trash.aif" byReference:YES];
    if (systemSound) {
        [systemSound play];
    }  
    
    /System/Library/Components/CoreAudio.component/Contents/Resources/CoreAudioAUUI.bundle/Contents/Resources
    

    【讨论】:

    • /System/Library/Components/CoreAudio.component/Contents/Resources/ 中没有 SystemSounds 文件夹或 CoreAudioAUII 包。只有很多带有字符串的 .lproj 文件夹和一些其他文件。你在用狮子吗?
    • 我在/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds 中找到了它们。谢谢!
    • 请注意:您不需要 if 语句来检查 systemSound 是否为 nil,因为在这种情况下甚至不会执行该方法。
    猜你喜欢
    • 2011-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多