Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d-Swift : Playing Sound Crashed

I used below code to play sound in Cocos2d-Swift, its crashed.

 OALSimpleAudio.sharedInstanceWithSources(32).playEffect("buttonUp_1.caf")

How to resolve crash in swift code(not ObjC) ?

Or

Is there any other way to play sound in cocos2d-swift using SimpleAudio engine ?

Crash LOG:

OAL Error: -[OALSimpleAudio initWithSources:]: : Could not create OpenAL device fatal error: unexpectedly found nil while unwrapping an Optional value

like image 287
iPhoneProcessor Avatar asked Nov 09 '22 16:11

iPhoneProcessor


1 Answers

For me this worked:

   OALSimpleAudio.sharedInstance().playEffect("buttonUp_1.caf")
like image 154
Guru Avatar answered Jan 04 '23 03:01

Guru