Re: OpenAL and OGG
Re: OpenAL and OGG
- Subject: Re: OpenAL and OGG
- From: Eric Wing <email@hidden>
- Date: Wed, 30 Jun 2010 01:10:02 -0700
On 6/29/10, Development <email@hidden> wrote:
> Can open al not read ogg files? I'm attempting to load a short ogg clip and
> I keep getting random errors.
>
> getOpenALAudioData: ExtAudioFileOpenURL FAILED, Error = 1954115647
> 2010-06-29 15:13:53.965 MixPad[12402:207] error attaching audio to buffer:
> a003
>
>
>
> this is the file loading code, it is directly from an apple example
>
> ALenum error = AL_NO_ERROR;
> ALenum format;
> ALsizei size;
> ALsizei freq;
>
> //NSBundle* bundle = [NSBundle mainBundle];
>
> // get some audio data from a wave file
> CFURLRef fileURL = (CFURLRef)[[NSURL fileURLWithPath:self.path] retain];
>
> if (fileURL)
> {
> data = getOpenALAudioData(fileURL, &size, &format, &freq);
> CFRelease(fileURL);
>
> if((error = alGetError()) != AL_NO_ERROR) {
> NSLog(@"error loading sound: %x\n", error);
> exit(1);
> }
>
> // use the static buffer data API
> alBufferDataStaticProc(self.alBufferID, format, data, size, freq);
>
> NSLog(@"Format %i",format);
> NSLog(@"Data %i",sizeof(data));
>
> if((error = alGetError()) != AL_NO_ERROR) {
> NSLog(@"error attaching audio to buffer: %x\n", error);
> }
> }
> else
> NSLog(@"Could not find
> file!\n");_______________________________________________
>
OpenAL is format agnostic. It doesn't know anything about file types.
It only accepts bytes of linear PCM.
Apple / Core Audio don't natively support Ogg.
Generally, if you want to use Ogg, you have to compile in the Ogg
Vorbis libraries from Xiph and use their APIs. ov_read() would be good
place to start looking.
-Eric
http://playcontrol.net/iphonegamebook
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden