WP7 XNA Music and Sound Issue on Nokia Lumia 800 - windows-phone-7

I am almost done developing my first game for the Windows Phone 7 OS. Unfortunately, I've ran into a rather nasty problem. A simple task of just playing background music and a sound effect at the same time creates a serious distorsion in the sound effect play and the overall result is awful. This is when the sound comes out of the phone's speaker.
If, however, I use the headphones, all the problems go away (i.e., no distorsions whatsoever). I am also using the same code on an HTC HD7 and I don't see the problem either on the speaker or on the headphones.
The sound effect is an MP3 # 48kbps and the music is also an MP3 # 96 kbps.
All I do is the following:
In the LoadContent:
backgroundMusic = Content.Load<Song>("Music");
soundEffect = Content.Load<SoundEffect>("SoundEffect");
soundInst = soundEffect.CreateInstance(); / I am using a SoundEffectInstance to play the sound effect
MediaPlayer.Play(backgroundMusic);
MediaPlayer.IsRepeating = true;
Laster on, I just issue a soundInst.Play().
If, however, I do not play any music, the sound effect plays just fine.
Again, this only seems to happen on my Nokia Lumia 800 as it seems ok on the HTC HD7. However, the funny thing is that in the majority of the games that I play on the Lumia 800, I am not noticing this music/sound effect problem (I've only noticed it in one other game).
I have tried to play w/ the volume as well but it doesn't help. Even if the music has a volume of 0, the sound effect is not played correctly.
In conclusion, if and only if I stop the music from playing completly, regardless of the volume, the sound effect plays correctly.
Any ideas?
Thanks in advance!

Related

Loading many images simultaneously causes Activity/Fragment to lag

I'm new to developping android TV applications. I am building a quizz game which needs a lot of images, videos, mp3 and gifs to show up simultaneously at a given time depending on the business logic of the game. I am using:
glide to show images / gifs (images are High Definition);
android Async and Handler / Thread / Runnable pattern to play sounds;
android video player to play videos (videos are High Definition);
nested RelativeLayout / LinearLayout to display the views;
View.setVisibility(GONE) to hide views and View.setVisibility(VISIBLE) to show it.
My problem is this:
On a Samsung galaxy tab 4 device, the game is smooth! But on a TV device, TCL 1920x1080 40dpi that should run the game, it is laggy.
I have read a lot of blog posts about how to optimize code ; like using ConstraintLayout instead of nested layouts, using View.setVisibility(INVISIBLE) instead of View.setVisibility(GONE) and I am also planning to use Picasso instead of Glide to get some fps but I'm not confident about all those. Can anyone give me advices on how to optimise my code to get some more fps (I mean getting like 10 or 15 fps not just 2 or 3)? Thanks in advance guys, cheer up!
in android manifest I added:
android:hardwareAccelerated="true"
solved the problem got 15fps higher.

WP7 simultaneous recording and playing sound

I need to play a short sound repeatedly (simulating metronome) while recording sound.
What I did for the metronome was basically setting a DispatcherTimer with specific Interval, and every tick firing a SoundEffect. For the recorder I call the XNA's FrameworkDispatcher.Update method every 33 milisec (also using DispatcherTimer for that).
I run the metronome, it works fine, and then when I begin to record - there's a short break in playing sound (hard to say if it delays the Interval or just mutes the sound), and after a while (when already recording), the metronome continues to tick, but with more 'flatten' sound.
Is this a hardware limitation, or am I doing something wrong?
I thinkt this is connected with hardware. I was making an app to modify sound when it is captured. When I was using headset (with mic) connected to device there was big echo on playback. When I was using only headphones (and device mic) everything was ok. It was tested on HTC and Nokia - same results but HTC was little bit better :)

why volume property doesn't work on ZUNE objects in WP7?

I'm facing a very odd problem here, it seems like reducing or any action taken on the Volume property of the MediaPlayer static class doesn't make any difference. I've heard somewhere that microsoft protected it but it doesn't make any sense that in iPhone & Android you can do it, but in windows phone 7 it's impossible.
MediaPlayer.Volume = 0.2F;
what am i doing wrong?
Thanks!
You can't control the phone's global volume. Actually it makes difference, you just haven't notice it - it behaves as a scale for your music, so this goes like this:
System sound * MediaPlayer.Volume * What you are playing.
One does not simply look into MSDN: http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.volume.aspx

HTML5 Fullscreen API & performance

I'm coding an app around video content and am currently playing around with HTML5's fullscreen API (I know it is still in very early stage).
Because of what my application does, the video itself isn't the only part that goes fullscreen: several elements alongside go fullscreen too, and I have noticed a great drop in performance there. The video streams ok, but other graphical elements suddenly get painfully slow. For example, a hover style typically takes about a good half second before showing up. A simple change in subtitles (I use popcorn.js) causes the video to freeze for a fraction of a second.
Any one knows why this is so? Do you experience the same? Thanks for your precious feedback.

Mediaplayer.play method taking time

We are developing a XNA game with high interactivity. The game includes some background music.
We are trying to play the background music through the MEdiaplayer.play method. But this seems to block the smooth gameplay for a while. How can this be overcome?
Had tried using the soundeffect instance for this initially and it worked fine. But that approach doesn't seem to go well with the certification requirements. Pls help
Thank You
I think this is normal for large music files. You could however try to put
IsFixedTimeStep = false;
after
TargetElapsedTime = TimeSpan.FromTicks(???);
I have found that that makes a smoother gamepay. At least back in 7.0 - but I still use it.
I of course assume that you use elapsed time for all animations.

Resources