iPhone 中的 ObjectAL 音频流?

发布于 2024-11-18 12:35:41 字数 1009 浏览 4 评论 0原文

我正在使用 objectAL 传输 PCM 数据,

从我尝试过的示例代码或播放在线 CGI 流数据,

   ALSource *source = [[ALSource source] retain];

   ALBuffer *buffer = [[[OpenALManager sharedInstance] bufferFromUrl:[NSURL URLWithString:[[OpenALManager sharedInstance]bufferAsyncFromUrl:[NSURL URLWithString:@"someURL/somedata.cgi"] target:self selector:@selector(recievedBufferData:)]]] retain];

   source.position = alpoint(planet.position.x, planet.position.y, 0);
   source.referenceDistance = 50;
   [OpenALManager sharedInstance].currentContext.listener.position = alpoint(rocketShip.position.x, rocketShip.position.y, 0);

    self.isTouchEnabled = YES;
    [source play:buffer loop:YES];
}


-(void)recievedBufferData:(id)recievedData{
    NSLog(@"recieved");
}

我收到以下错误

OAL Error: -[OALAudioFile initWithUrl:reduceToMono:]: Could未打开 url some url/somefile.cgi (错误代码 0xffffffd5:未知的分机音频错误)

时调用

但是方法 receiveBufferData: 仅在我无法播放 .cgi 文件,谁能建议我如何在 iPhone 中播放 .cgi 文件。

I am using objectAL to stream PCM data,

from the sample code i have tried or play the online CGI streaming data,

   ALSource *source = [[ALSource source] retain];

   ALBuffer *buffer = [[[OpenALManager sharedInstance] bufferFromUrl:[NSURL URLWithString:[[OpenALManager sharedInstance]bufferAsyncFromUrl:[NSURL URLWithString:@"someURL/somedata.cgi"] target:self selector:@selector(recievedBufferData:)]]] retain];

   source.position = alpoint(planet.position.x, planet.position.y, 0);
   source.referenceDistance = 50;
   [OpenALManager sharedInstance].currentContext.listener.position = alpoint(rocketShip.position.x, rocketShip.position.y, 0);

    self.isTouchEnabled = YES;
    [source play:buffer loop:YES];
}


-(void)recievedBufferData:(id)recievedData{
    NSLog(@"recieved");
}

I am getting the following error

OAL Error: -[OALAudioFile initWithUrl:reduceToMono:]: Could not open url some url/somefile.cgi (error code 0xffffffd5: Unknown ext audio error)

But The method recievedBufferData: is called only once

I cannot able to play the .cgi file, can anyone suggest me how to play the .cgi file in iphone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小苏打饼 2024-11-25 12:35:41

我正在尝试类似的事情,但无法解决它。

只是想问,我认为以下代码

ALBuffer *buffer = [[[OpenALManager sharedInstance] bufferFromUrl:[NSURL URLWithString:[[OpenALManager sharedInstance]bufferAsyncFromUrl:[NSURL URLWithString:@"someURL/somedata.cgi"] target:self selector:@selector(recievedBufferData:)]]] retain];

行有一些错误?:为什么要调用 bufferFromUrl 和 bufferAsyncFromUrl?

顺便说一句,我可以使用本地文件来完成这项工作:

buffer = [[[OpenALManager shareInstance] bufferFromFile:@"ColdFunk.caf"] keep];ng

I'm trying somethign similar, but not able to solve it.

Just wanted to ask, i think there is some error in the following line of code?:

ALBuffer *buffer = [[[OpenALManager sharedInstance] bufferFromUrl:[NSURL URLWithString:[[OpenALManager sharedInstance]bufferAsyncFromUrl:[NSURL URLWithString:@"someURL/somedata.cgi"] target:self selector:@selector(recievedBufferData:)]]] retain];

Why are you calling bufferFromUrl and bufferAsyncFromUrl?

BTW i am able to make this work using a local file:

buffer = [[[OpenALManager sharedInstance] bufferFromFile:@"ColdFunk.caf"] retain];ng

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文