Cesar
Cesar

Reputation: 2057

Exception thrown when loading sound- but things work anyway

I have the following lines to preload a couple of (short) sounds in a sound-storing singleton (from which they can then be grabbed when need to play arises)

_successSound = [SKAction playSoundFileNamed:@"success2.wav" waitForCompletion:NO];
_failureSound = [SKAction playSoundFileNamed:@"failure2.mp3" waitForCompletion:NO];

When i run my application with an exception breakpoint (which I tend to always do), it breaks on the second line. Removing the breakpoint, everything instead works as expected. I had previously done this 'loading' only when the sound was to be played (which caused a slowdown the first time it had to be played), and it never caused any exceptions.

Edit: should also add that there aren't any exception if I change the failure2 sound to some other sound in my soundfolder- perhaps it's something to do with it being mp3?

Upvotes: 0

Views: 34

Answers (2)

gnasher729
gnasher729

Reputation: 52530

OS code can throw exceptions that are caught and never visible to the outside, and that's inconvenient if you set a breakpoint on exceptions but nothing to worry about and not something that you need to avoid, as long as there are no uncaught exceptions.

It happens a lot with APIs that are implemented in C++ - throwing and catching exceptions is much more common in C++.

Upvotes: 1

Cesar
Cesar

Reputation: 2057

Ok, so I got rid of the exception by converting the mp3 to wav. If anyone knows why this was a problem in the first place though, I'd be very interested.

Upvotes: 0

Related Questions