views:

224

answers:

3

I'm calling AudioSessionInitialize like so

OSStatus result = AudioSessionInitialize(NULL,NULL,interruptionListener,NULL);

and getting the result 0xbfffde94 (i.e. -1073750040) which doesn't match anything in the documentation, which are all readable 4CC's like '!ini' and so forth.

The good news is that it seems like the call worked. Nevertheless, can anyone shed light on this error code?

EDIT: The above error code is returned in the simulator. On the device the error code is 2fffe810.

A: 

Convert result to a 4 char code for your error translation.

Justin
Well, this answer certainly is generally correct - BUT - in this case the translated values are not of any use. Not one of those bytes translates to an ASCII value below 128 -> its nothing readable at all. The result Grumdrig is getting certainly is VERY odd.
Till
ah, details :) (it's 3am)
Justin
+1  A: 

Since these results are bogus and not defined or described by Apple, I am left with only but one assumption; you have a weird mix of Frameworks installed - possibly old versions mixed with newer ones. So all I could recommend is to reinstall the entire iPhone SDK.

Till
I built and ran on a different machine, and got sort of the same thing, `0xbfffdf54` in the simulator. Then in my project I replaced the AudioToolbox.framework in /System/Library/Frameworks with the one in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.2.sdk/System/Library/Frameworks (sure that this would solve it) but got the same problem, different error code `0xbfffe0a4`. Still, maybe you're right, somehow.
Grumdrig
Did you try any of Apple's examples using sound output? If not, go ahead test something like e.g.MusicCube. Do they receive proper values from the AudioSessionInitialize?
Till
A: 

I figured it out. I'm an idiot. There was an error in the macro I had wrapping the call & reporting the error, which called the AudioSessionInitialize twice. That doesn't quite explain the error code I saw, but it sure isn't worth wondering about.

UPDATE: Actually this is pretty slapstick so I'm going to explain.

The offending macro was originally:

#define CHECK(S) { OSStatus err = (S); if (S) printf("Error %x at \"%s\"\n", err, #S);}

so bug #1 is the if (S) which should be if if (err). Hence I'm repeating every call to the audio system, which explains various other weird things, so I'm very happy I tried to figure out what had seemed like a harmless anomaly. In this case the second call complained that the audio session was already initialized.

But why the weird error code? I wanted to see the 4CC's so I changed the macro to this, carrying the error along:

#define CHECK(S) { OSStatus err[2] = {S,0}; if (S) printf("Error %x '%4s' at \"%s\"\n", err, &err, #S); }

(The second OSStatus of 0 terminates the string defined by the 4CC first OSStatus, so I can print it with format %s.) But I forgot to change err to err[0], so it was indeed printing the address of the err array. This I'm pretty sure is correct now:

#define CHECK(S) { OSStatus err[2] = {S,0}; if (*err) printf("Error %x '%4s' at \"%s\"\n", *err, err, #S); }
Grumdrig
hehe - great :) ... With the words of Forest Gump: shit happens, I guess. Happy Coding!
Till