简体   繁体   中英

ObjectAL audio streaming in iphone?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM