On 5/27/10, Philip Mobley <p...@dreystone.com> wrote: > I have a question about the oalTouch example project. > > Specifically the sample code uses the exit( ) function after encountering an > error such as in the sample code below. > > I looked up the OpenAL documentation for alGetError( ) and no where does the > OpenAL documentation for alGetError( ) mention that an error returned is > considered fatal and the program must exit. > > So what I am wondering is if this is simply a "lazy" example from Apple > (without any "nice" UI warning errors), and should not actually affect the > performance of the app. Obviously if there is an error loading the sound > resource, the sound cannot play. > > But I am asking this here anyways in the case that there is actually an > issue where exit( ) is required.
Wow, I missed this message and it some how popped up in front of me today. But I'm going to answer this since I know a lot about this subject. Within the official OpenAL standard, generally speaking, an OpenAL error should only occur due to programmer error. So in a real world ready to ship app, you should never get an OpenAL error. For performance, some developers disable all checks to alGetError when they do the release build. (This is the same philosophy as OpenGL.) However, Apple has overloaded the use of alGetError in at least one instance for one of their extensions (alBufferDataStatic) and the information retrieved is not due to programmer error. However, this should not merit a fatal error forcing a call to exit. Thus I would put this example in your "lazy" category. > On May 27, 2010, at 2:40 PM, Luke the Hiesterman wrote: > >> That is most likely there for simplicity of the code example. Since Touch >> is in the name, I'm assuming this example is for iPhoneOS? If so, please >> remember that exit() should never be called in an iPhone program. Only the >> user should exit your program. > > Yes, it is for the iPhone, and oalTouch is the only sample project that I am > aware of to demonstrate OpenAL for iPhone. Actually, there are a few other examples. A really old one was in a lander game and the wrapper API was called SoundEngine, but it had a lot of problems and you should ignore that one. There is a newer one called MusicCube. And there used to be a great Mac example that shipped with the Developer examples named OpenALExample. Because it's relevant, I'm going to plug my new book I co-authored, "Beginning iPhone Games Development". It may have the most comprehensive amount of information for learning OpenAL ever written. (We are even mentioned on the official OpenAL website.) Find out more here: http://playcontrol.net/iphonegamebook/ -Eric _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com