OpenAL WAV Playback
Supposedly the OpenAL API is real simple and one can learn it in less than a day. I feel like I understand everything, yet nothing I put together works. What I'm trying to do is play a WAV file every time my method is called. I think my real problem is loading the WAV file into a buffer. Could somebody please explain how this is done? I hate to ask people to do things for me, but I just can't get OpenAL to work.
If you're on 10.4.6 or earlier, you have OpenAL 1.0, which has a function called alutLoadWAVFile() which will do all the hard work for you.
If you're on 10.4.7 or later, you have OpenAL 1.1, which doesn't have [a header for] that function. You can write the prototype yourself and call it anyway, or you can implement your own WAV loading.
If you're going to attempt the latter, you might like to use ogg/vorbis instead, since there's a nice library to do it for you.
Other than that, it should be a simple matter of making a source, a listener and a buffer, and telling the source to play the buffer.
If you're on 10.4.7 or later, you have OpenAL 1.1, which doesn't have [a header for] that function. You can write the prototype yourself and call it anyway, or you can implement your own WAV loading.
If you're going to attempt the latter, you might like to use ogg/vorbis instead, since there's a nice library to do it for you.
Other than that, it should be a simple matter of making a source, a listener and a buffer, and telling the source to play the buffer.
Oh great. I'm on 10.4.8, and I've been trying to use alutLoadWAVFile(). No wonder I couldn't make it work. Thanks, I'll look into ogg/vorbis.
EDIT: You mention there's a "nice library" for working with ogg/vorbis. Googling is doing me no good, could you perhaps point me in the right direction with a link?
EDIT 2: Nevermind, got it. Thanks.
EDIT: You mention there's a "nice library" for working with ogg/vorbis. Googling is doing me no good, could you perhaps point me in the right direction with a link?
EDIT 2: Nevermind, got it. Thanks.
Okay, so I downloaded the source to the Ogg.framework, compiled it, and placed it in /System/Library/Frameworks. Then I downloaded the source to the Vorbis.framework, compiled it, and put it in /System/Library/Frameworks.
I added Vorbis.framework to my project, then added #import <Vorbis/vorbisfile.h> to my source, tried to compile just to check that it worked and got an error. It tells me "error: Vorbis/vorbisfile.h: No such file or directory". Any ideas why it isn't seeing my framework?
I added Vorbis.framework to my project, then added #import <Vorbis/vorbisfile.h> to my source, tried to compile just to check that it worked and got an error. It tells me "error: Vorbis/vorbisfile.h: No such file or directory". Any ideas why it isn't seeing my framework?
Is there a Headers folder within those frameworks?
You should *never* modify /System. /Library/Frameworks is an appropriate place to put these.
You should *never* modify /System. /Library/Frameworks is an appropriate place to put these.
I've moved them to /Library/Frameworks. Thanks for that tip.
There isn't a "Headers" folder, but an alias that points to ./Versions/A/Headers
Any idea?
There isn't a "Headers" folder, but an alias that points to ./Versions/A/Headers
Any idea?
As there should be. Look in the folder the alias points too, and make sure all the headers are there. If so, it's likely not added to your project/target correctly.
Everything looks right, all the headers are there. I guess I'm just an idiot and I'm missing something obvious. I'll look through my project.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| 24 Bit Audio Playback | TREMS | 2 | 2,784 |
Sep 29, 2006 06:00 PM Last Post: Jones |
|
| no ogg sound playback | GryphonClaw | 1 | 2,303 |
Jan 9, 2006 06:32 PM Last Post: OneSadCookie |
|
| Dynamic sound playback? | napthali | 6 | 2,861 |
Dec 7, 2003 10:38 PM Last Post: kelvin |
|

