This project is read-only.

PlayBackgroundMusic gives ContentLoadException on Windows Phone 8

Topics: Windows Phone 8
Jan 25, 2014 at 8:18 PM
I've loaded up an MP3 in my project via the Content/sounds folder, set as Build Action = Content, do not copy.
 CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic("sounds\\theme.mp3", true);
This line throws a ContentLoadException with "failed to load content"

The mp3 is in the same folder as two WAVs that I've already processed as XNBs (click.xnb and gameover.xnb)

These lines right above that line:
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds\\click");
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds\\gameover");
...execute just fine.

Am I missing a step to prepare the MP3 to be loaded?
Jan 27, 2014 at 7:08 AM
Can you dig out the inner exception on the ContentLoad exception? MonoGame throws a standard ContentLoad exception and passes along the inner exception. That inner exception is important as it will tell you why the content is not loading.
Jan 28, 2014 at 2:28 AM
Unfortunately, the innerexception is null.

Here's the full detail:

Microsoft.Xna.Framework.Content.ContentLoadException was unhandled by user code
HResult=-2146233088
Message=Failed to load the asset file from sounds\theme.mp3
Source=cocos2d-xna
StackTrace:
   at Cocos2D.CCContentManager.Load[T](String assetName, Boolean weakReference)
   at Cocos2D.CCContentManager.Load[T](String assetName)
   at CocosDenshion.CCMusicPlayer.Open(String pFileName, Int32 uId)
   at CocosDenshion.CCSimpleAudioEngine.PlayBackgroundMusic(String pszFilePath, Boolean bLoop)
   at DGame.Game1.LoadContent()
   at Microsoft.Xna.Framework.Game.Initialize()
   at Microsoft.Xna.Framework.Game.DoInitialize()
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
   at MonoGame.Framework.WindowsPhone.SurfaceUpdateHandler.Draw(Device device, DeviceContext context, RenderTargetView renderTargetView)
   at MonoGame.Framework.WindowsPhone.XamlGame`1.DrawingSurfaceBackgroundContentProvider.Draw(Device device, DeviceContext context, RenderTargetView renderTargetView)
   at SharpDX.Direct3D11.DrawingSurfaceBackgroundContentProviderShadow.DrawingSurfaceBackgroundContentProviderVtbl.Draw(IntPtr thisPtr, IntPtr hostDevice, IntPtr hostDeviceContext, IntPtr hostRenderTargetView)
InnerException:
Jan 28, 2014 at 3:09 AM
Nevermind, I figured it out. Didn't realize I needed the raw file AND the xnb for the MP3.

Thanks!