×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

I recently got an inquiry to my Microsoft Translator sample on if this would work with the Silverlight in the Windows Phone 7 SDK.  I hadn’t tried it before, so I created a sample Windows Phone 7 application and copied the code over.  I used a basic UI to mock up the similarities:

Translator phone sample screenshot

And then clicked the button.  The text translated fine, but no audio.  I didn’t get any warnings that the WaveMSS code sample I was using wouldn’t work.  Then I remembered about XNA.

NOTE: I actually think this is a bug in PCM audio and MediaStreamSource and have been having a dialog with the team about it.

In Windows Phone 7 your Silverlight applications can use some XNA Game Framework APIs.  A big component of games is audio!  Enter SoundEffect.  I added a reference to Microsoft.Xna.Frameowkr and changed my OnSpeakCompleted from:

   1: void OnSpeakCompleted(object sender, TimHeuer.Silverlight.SpeakCompletedEventArgs e)
   2: {
   3:     WaveMSS.WaveMediaStreamSource mss = new WaveMSS.WaveMediaStreamSource(e.AudioTranslation);
   4:     PlayMe.SetSource(mss);
   5: }

to:

   1: void OnSpeakCompleted(object sender, TimHeuer.Silverlight.SpeakCompletedEventArgs e)
   2: {
   3:     SoundEffect se = SoundEffect.FromStream(e.AudioTranslation);
   4:     se.Play();
   5: }

Notice it is still 2 lines of code :-).  I don’t need a MediaElement for the audio palyback because I can use the same libraries that XNA uses for audio (and in some instances this will be better for you for looping audio, etc.).

Very cool that Silverlight and XNA can share some libraries in a single application!


This work is licensed under a Creative Commons Attribution By license.


4/9/2010 2:28 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Sergey - since I'm not an XNA expert, I'm didn't want to explicitly claim 'all' of them here -- I don't even know what 'all' means in XNA world. I'd check the creator's club forums to see if this is already covered in an FAQ somewhere.
4/9/2010 2:36 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Hey Tim you wrote about new Silverlight themes coming some time back, have those been released yet as I'm having a hard time finding them.
Gravatar
4/15/2010 7:52 AM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
I thought Silverlight 4 was releasing today? Where is the download?!
Gravatar
4/15/2010 12:15 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Finally Silverlight 4 is here! Yeye!
4/20/2010 4:42 AM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Hi Tim,

What is exactly included in the .NET Framework for Windows Phone 7? Is it the present Compact Framework 3.5, or is it only a subset of Silverlight, or something more ? In the MSDN Documentation one finds only the specific phone API's. Can you spread some light on this? Thanks, Brian
4/20/2010 7:16 AM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Brian -- WP7 has .NET Compact Framework, but with regard to Silverlight, it is essentially Silverlight 3+ at the moment. The application model is either Silverlight or XNA -- even though there is compact framework running, it is not a direct application target model.
5/18/2010 12:17 AM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
How can i play mp3 audio file in WP7, i am able to play .wav file with SoundEffect but when i m trying to play mp3 it is giving exception, could you please tell me how can i play mp3 in wp7.


Thanks
Santosh
7/18/2010 5:18 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Can you update this site for the WP7 Beta? I tried my CTP code and it doesn't work anymore.

Thanks!!
9/22/2010 11:16 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
When i add Microsoft.Xna.Framework reference in silverlight application i am getting error as "The type or namespace name "Xna" does not exist in the namespace "Microsoft"
Any thing else to be added before adding Microsoft.Xna.Framework reference in silverlight application.

Thanks!!!
4/5/2011 4:56 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Im a beginner too and love to read your blogentrys. its easy for me to learn silverlight, which i realy love . my tipp: Sexanzeigen und vieles mehr findest Du hier.
I know, my English ist bad - but i know, your spanish is not better ;;)
by amigo
Gravatar
4/20/2011 2:01 AM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
I think the OLA Superconference could be so much more. Let’s pump in some excitement, some music, some buzz. More interaction…more things to touch…large screens projecting whoever is speaking at the back of the room wood pellet manufacturing equipment
6/20/2011 1:07 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
This Windows Phone feature has certification requirements that must be met for an application to be eligible for listing in the Windows Phone Marketplace. You should consider these requirements as you design and test your application. dream house credit
6/22/2011 1:16 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
I'm always searching for informative information like this! Write more informative news like this, and we stop nottingham letting agent dreaming Start Action!
6/24/2011 11:39 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Thanks for your post. I want to play a simple sound after pressing a button on the XNA Framework Silverlight. I realize this with the code snippet, but do not work. The program told me that there was no definition for ApplicationLifetimeObjects. Where did I put that? I put it in the constructor of my MainPage is wrong?Used BMW prices
6/29/2011 5:04 AM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Your net site is very nice, i like it very much ! I will must check it out !
feliz aniversario
7/25/2011 11:40 PM | # re: Using XNA libraries in your Silverlight Windows Phone 7 applications
Thank you so much for your work on keeping the site together and keeping these flowing.donna cerca uomo

 
Please add 2 and 8 and type the answer here:

All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.