I am trying to put some music on my project, but it won’t allow me to access SimpleAudioEngine.h, I keep getting this error:
Error (active) “CocosDenshion::SimpleAudioEngine::SimpleAudioEngine()” (declared at line 256 of “c:\MyGame \cocos2d\cocos\audio\include\SimpleAudioEngine.h”) is inaccessible MyGame c:\MyGame \Classes\MyGame .cpp
I have included the header and namespace properly, I’m using visual studio and it showed me the definition so It knows where the file is, I have no idea what’s the problem.
Ok, VS is not happy about SimpleAudioEngine because it has it’s default constructor set to protected if I change it to public Visual Studio will compile it without error, but it does not work, because no music plays in the background.
Alright, after I noticed that getInstance is a static function and without modifying the SimpleAudioEngine files, I was able to get the Instance of SimpleAudioEngine, by using CocosDenshion::SimpleAudioEngine::getInstance() instead of the mistake I was doing of CocosDenshion::SimpleAudioEngine(), but I was able to access it by removing the protected keyword, in either case.
The only issue is that it’s not playing the background music. I noticed that some virtual function like preloadBackgroundMusic, setBackgroundMusicVolume and a few other are not implemented.
Could you post a code snippet? Maybe you missed something obvious. I’ve used SimpleAudioEngine in win32 projects and never had problems with background music. Maybe the music format?