gpt4 book ai didi

ios - 等到 super 库中的文件加载

转载 作者:行者123 更新时间:2023-12-01 18:06:49 25 4
gpt4 key购买 nike

我正在寻找一些解决方案,等待 SuperpoweredAdvancedAudioPlayer 打开文件。我制作了 ios objective-c 应用程序,我想在其中同时播放多个轨道。但是当我尝试以这种方式开始轨道时:

    player1->open([[[NSBundle mainBundle] pathForResource:[[tracksNamesBigArray objectAtIndex:row] objectAtIndex:0]ofType:@"mp3"] fileSystemRepresentation]);
player1->play(true);

player2->open([[[NSBundle mainBundle] pathForResource:[[tracksNamesBigArray objectAtIndex:row] objectAtIndex:1] ofType:@"mp3"] fileSystemRepresentation]);
player2->play(true);

player3->open([[[NSBundle mainBundle] pathForResource:[[tracksNamesBigArray objectAtIndex:row] objectAtIndex:2] ofType:@"mp3"] fileSystemRepresentation]);
player3->play(true);

player4->open([[[NSBundle mainBundle] pathForResource:[[tracksNamesBigArray objectAtIndex:row] objectAtIndex:3] ofType:@"mp3"] fileSystemRepresentation]);
player4->play(true);

或者当我将其包装在函数中并制作如下内容时:
  [self openPlayers:row]
[self playAll];

它不会同时完美地开始播放,最后一首或 2 首轨道以 .5s-.8s 延迟开始(在第一个示例中,延迟大于秒)。如何等到打开成功再开始玩?我在 super 强大的文档中没有找到任何功能。

最佳答案

音频处理发生在音频处理回调中,音频堆栈在高优先级线程中定期调用该回调。

我猜你正在另一个线程中调用 play() 方法,也许是主线程。当您调用这些方法时,音频处理回调可能会在两者之间触发,从而延迟一个缓冲区大小。

解决方案是在音频处理回调开始时调用 play() 方法。

关于ios - 等到 super 库中的文件加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40870428/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com