Problem to find the SimpleAudioEngine.h to windows phone 8 project

I try to use the SimpleAudioEngine in my Windows Phone 8 project with cocos2s-x 2.2.0.
But dn’t know how I can add the SimpleAudioEngine to my project.

How I cand add the cocosdenshion to my wp8 project.

@Fabio
I believe that .dll file for cocosdenshion are missing. Add cocosDenshion project to your solution present in Cocos2dDension/proj.wp8. Build this project alone in your solution your .dll for this will be generated but problem that i am facing is where to provide correct path in your current project properties. We need to link them with our project so that it can access those methods I am getting this linking error I am sure you are facing this same problem

Yes, You are right, I face this same problem.
Don’t know how to resolve it.

Nice work excellent day, I did it yay ho ho.

So I am gonna summarize them in the following steps for windows phone 8
* If your create a fresh project through create-project.py you will have your multi platform project created in projects folder. Goto proj.wp8 in your current project.
* Open up your project in Visual Studio (I am using 2012). In solution explorer on left you will see only two projects under your solution. One by your project name given during script creation. And the other will be libcocos2d.
* So the point is CocosDenshion is not added to your solution by default you need to add it manually. Same goes for Box2D if you want to integerate. So here it is
* Goto your cocos2dx2.2 folder. You will see CocosDenshion folder. In that you will see proj.wp8. There is your CocosDenshion.vcxproj. Add it to your solution as a project by right clicking.
* So in order to generate its dll and lib we need to connect them in the solution. So right click on your solution and choose properties. Goto CommonProperties/ProjectDependencies. Check CocosDenshion or libBox2d (if you want to add Box2d to your app) and click apply and ok. Now If you tap on “Device” to run your libraries will be generated.
* Next question how to link them to your project. Easy pesi through Linker.
* Now first you need to give the path where your .lib are present. In order to do them goto your current project properties. Goto ConfigurationProperties\Linker\General\additionalLibraryDirectories. tap on edit and add these as in my case

C:\software\cocos2d-x-2.2.0\cocos2d-x-2.2.0\projects\HungryFish\proj.wp8\WP8\ARM\Release\CocosDenshion; C:\software\cocos2d-x-2.2.0\cocos2d-x-2.2.0\projects\HungryFish\proj.wp8\WP8\ARM\Release\Box2D;%(AdditionalLibraryDirectories)

So your paths are set.

  • Now to add .lib files. Goto Linker\Input\AdditionalDependencies and add libBox2D.lib;CocosDenshion.lib;.

thats it compile and it will work. Worked for me. If you want to use extensions follow the same steps. Also change path for debug configuration.

Saud Ahmed, I don’t understand one thing.

I run the CocosDenshion.vcxproj to create the lib, then I add it(CocosDenshion.vcxproj) in my game project, but when I try to build the app, the CocosDenshion.lib is deleted by VisualStudio.

Do you have any idea if I made some mistake to add CocosDenshion in my project?

Same thing is happening with me. When I try to allocate an object an object Object Simple audio engine it says that some libs are missing. I really dont whats wrong with because. when I commented out Simple Audio engine everything worked fine. Box2D and extensions were working perfectly now. Did you come up with anything different to work with.

Oh sorry I mistook it when it tries to compile again it deletes the previous one and creates a new lib instead. first build them collectively and see there names as the path in red add them to linker. Recompile again and it should work. I am getting the above problem when I try to run my code.

Did you try to take a look in the solution Properties\Configuration Properties\C/C++. The additional include directories don’t have the CocosDenshion and CocosDenshion\include folders. Try to add it.

Were you able to play any sound effect or background music.

No, I still can’t play any sound in my game.

Am getting a run-time exception while playing / preloading sound effect in WP8, VS2012 Express Edition with Cocos2d-x 2.2 version:

SimpleAudioEngine::sharedEngine()->playEffect(“click.wav”);
SimpleAudioEngine::sharedEngine()->preloadEffect(“click.wav”);

First-chance exception at 0x77521ECF in Temp.exe: Microsoft C++ exception: Platform::FailureException ^ at memory location 0x00E4F638. HRESULT:0x80004005

I checked, the path is also correct:

“…installAssetsResourcesclick.wav”

I checked the call-stack, the exception is in the ReadData method of MediaStreamer class.

Wrappers::FileHandle file(
CreateFile2(
filename->Data(),
GENERIC_READ,
FILE_SHARE_READ,
OPEN_EXISTING,
&extendedParams
)
);
if (file.Get()==INVALID_HANDLE_VALUE)
{
throw ref new Platform::FailureException;
}

It seems, file.Get() returns the INVALID_HANDLE_VALUE.

Can you help to fix it?

Finally I found the correct path of audio files.
In solution explorer, the file is at this path “/Assets/Resources/click.wav”; but in fact in the package it is at this path “Install/click.wav”.

This conflict was due to adding assets to Resources folder using drag-n-drop way.
If we add same assets using “Add Existing Items” option which appears while right clicking on the Resources folder, the conflict will be resolved.

Cheers.