Reputation: 131
Using the latest Monogame source 06/03/13 from GitHub, my game is playing sound effects just fine when run in the ipad/iPhone simulators (in OSX on VMWare), but when i deploy/debug it to an iPad 4 there is no sound at all. In the application output window, occasionally i see Failed to get buffer attributes: when performing an ingame action that should play a sound. As sound plays in the simulators i'm assuming i've compiled the xnbs correctly using the monogame sound processor. fwiw I compiled these using a visual studio 2012 Windows Phone Game library project. And heres how im playing my intro sound when the game loads.
public override void Activate(bool instancePreserved)
{
if (!instancePreserved)
{
if (content == null)
content = new ContentManager(ScreenManager.Game.Services, "Content");
backgroundTexture = content.Load<Texture2D>(MyGame.Settings.Assets.SplashBackground);
introSound = content.Load<SoundEffect>(MyGame.Settings.Assets.IntroSound);
}
introSound.CreateInstance().Play();
}
Anyone know what would cause this and how to fix it?
Upvotes: 4
Views: 681
Reputation: 131
For anyone else scratching there head over this I solved it by configuring the AudioSession by doing this as suggested in a comment from miguel.de.icaza Sound not working in iOS for iPad
MonoTouch.AudioToolbox.AudioSession.Initialize();
MonoTouch.AudioToolbox.AudioSession.Category = MonoTouch.AudioToolbox.AudioSessionCategory.MediaPlayback;
MonoTouch.AudioToolbox.AudioSession.SetActive(true);
I don't know the reason why the Simulator would play and a real device wouldn't, or why this isnt taking care of by monogame.
Upvotes: 3