iPhone 中的 ObjectAL 音频流?
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在尝试类似的事情,但无法解决它。
只是想问,我认为以下代码
行有一些错误?:为什么要调用 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?:
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