应用程序间音频:甚至无法连接我的节点

时间:2014-01-16 20:16:13

标签: ios core-audio

好吧,我正在尝试将IAA应用到我的iOS应用程序中,并仔细研究了Apple“InterAppAudioSuite”以及WWDCXIII 602视频。我的应用程序就像Apple InterAppAudioSampler一样,我从这个例子中使用了尽可能多的代码。

我的应用程序启动,我在日志窗口中收到一条“AudioOutputUnitPublish stub”消息,上面写着 - 我想 - 事情还可以。然后,我从Apple启动“InterAppAudioHost”应用程序并尝试连接我的应用程序(充当音频远程仪器)。我的应用程序可在应用程序列表中找到。但后来它无法连接,我得到以下日志:

2014-01-16 11:10:27.556 DM1[141:60b] Could not search: {
    NSNetServicesErrorCode = "-72000";
    NSNetServicesErrorDomain = 10;
}
2014-01-16 11:10:27.558 DM1[141:60b] Could not publish service: {
    NSNetServicesErrorCode = "-72000";
    NSNetServicesErrorDomain = 10;
}

(我的应用程序中没有调用任何与IAA相关的方法。)

然后“InterAppAudioHost”退出,其日志显示:

2014-01-16 11:10:47.555 IAA Host[150:60b] 11:10:47.554 ERROR:     [0x3b2e718c] 168: Timed out waiting for app to launch
2014-01-16 11:10:47.557 IAA Host[150:60b] 11:10:47.557 ERROR:     [0x3b2e718c] >audiocomp> 59: null from factory proc
2014-01-16 11:10:47.559 IAA Host[150:60b] error -1 from AUGraphAddNode (hostGraph, &desc, &instrumentNode)

我仔细检查了我的plist,结果如下:

<plist version="1.0">
<dict>
    <key>AudioComponents</key>
    <array>
        <dict>
            <key>type</key>
            <string>aurg</string>
            <key>subtype</key>
            <string>fld1</string>
            <key>manufacturer</key>
            <string>fglb</string>
            <key>name</key>
            <string>appName<string>
            <key>version</key>
            <integer>1</integer>
        </dict>
        <dict>
            <key>type</key>
            <string>auri</string>
            <key>subtype</key>
            <string>fld1</string>
            <key>manufacturer</key>
            <string>fglb</string>
            <key>name</key>
            <string>appName</string>
            <key>version</key>
            <integer>1</integer>
        </dict>
    </array>

...

我的发布方法:

- (void) publishOutputAudioUnit {
    OSStatus result;
    const UInt32 version = 1;
    //-----------------------
    //    Publish as Remote Generator
    //-----------------------
    AudioComponentDescription IAAGeneratorDesc = { kAudioUnitType_RemoteGenerator,'fld1','fglb',0,0 };
    result = AudioOutputUnitPublish(&IAAGeneratorDesc, CFSTR("CompanyName : AppName"),version, auRemoteIO);
    if (result != noErr)
        NSLog(@"AudioOutputUnitPublish generator result: %d", (int)result);
    //-----------------------
    //    Publish as Remote Instrument
    //-----------------------
    AudioComponentDescription IAARemoteDesc = { kAudioUnitType_RemoteInstrument,'fld1','fglb',0,0 };
    result = AudioOutputUnitPublish(&IAARemoteDesc, CFSTR("CompanyName : AppName"),version,auRemoteIO);
    if (result != noErr)
         NSLog(@"AudioOutputUnitPublish instrument result: %d", (int)result);
}

看起来主机和节点之间存在一些URL问题,但我无法理解。

任何帮助将非常非常非常受欢迎,因为我真的被困住了。非常感谢。

安德烈

2 个答案:

答案 0 :(得分:2)

最终它奏效了。不知道我是怎么到那儿的。这是我目前的代码:

- (void) publishOutputAudioUnit {
    OSStatus result;
    const UInt32 version = 1;
    SoundEngine *se = [SoundEngine instance];
    //-----------------------
    //  Publish as Remote Instrument
    //-----------------------
    AudioComponentDescription remoteDesc = { kAudioUnitType_RemoteInstrument,IAA_SUB_TYPE,IAA_MANUFACTURER,0,0 };
    result = AudioOutputUnitPublish(&remoteDesc, CFSTR(IAA_NAME),version,se->auRemoteIO);
    if (result != noErr) NSLog(@"AudioOutputUnitPublish instrument result: %d", (int)result);
}

您现在也使用包含IAA连接的Audiobus SDK。这比做自己容易。

答案 1 :(得分:1)

我现在的帖子:

<plist version="1.0">
<dict>
    <key>AudioComponents</key>
    <array>
        <dict>
            <key>manufacturer</key>
            <string>fglb</string>
            <key>name</key>
            <string>DM1 - The Drum Machine</string>
            <key>subtype</key>
            <string>dm1a</string>
            <key>type</key>
            <string>auri</string>
            <key>version</key>
            <integer>1</integer>
        </dict>
    </array>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleDisplayName</key>
    <string>DM1</string>
    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>DM1 File</string>
            <key>LSHandlerRank</key>
            <string>Owner</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>net.fingerlab.beat.file</string>
            </array>
            <key>LSTypeIsPackage</key>
            <false/>
        </dict>
    </array>