07/08/09

SoundEngine.cpp building errors in SDK 3.0

Filed under: iPhone Dev SDK by Marc @ 17:52

Hi everyone,

I’m back with another fix that is usefull if you are using the SoundEngine.cpp library combined with the 3.0 version of the iPhone OS.

This morning I needed to use this lib for one of the projects I’m working in, but when I added the library to the project and tried to compile, it came up with several understanding and anoying errors. I don’t know exactly why, but it stopped compiling since the version 3.0 came out.
I’ve tried and I can confirm that it still compiles perfectly with the 2.2 version of the SDK.

The solution I’m posting is simple, I’ve done some searches using Google, of course. I found several solutions to the problem, but only one of them is the easyest and simpliest to implement.

You just have to solve only two of the errors listed by the compiler to solve them all:

1. "crosses initialization of OSStatus err" in line 686:
OSStatus err = AudioFileGetPropertyInfo(inFileInfo->mAFID, kAudioFilePropertyChannelLayout, &size, NULL);

2. "crosses initialization of bool isFormatVBR" in line 722:
bool isFormatVBR = (inFileInfo->mFileFormat.mBytesPerPacket == 0 || inFileInfo->mFileFormat.mFramesPerPacket == 0);

You just have to move the initialization of these structures, just a few lines before.
If you take a look at the source, the line just before both initializations it’s an AssertNoError that redirects to the label end in case of no error. You just have to initialize this structures:

OSStatus err;
bool isFormatVBR;

Just before of that AssertNoError call, at the beginning of the method/function is a good place. It seems like the compiler doesn’t like the order of the labels, maybe it became more strict since the update.



No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.