English 中文(简体)
• 向Windows 电话7提供更多的音乐?
原标题:Adding more music to the Windows Phone 7 emulator?

作者有3个歌曲,这足以确保歌首选法Im的作品将管理超过3个歌曲。

因此,只是想知道它是否可行?

最佳回答

Unfortunately there is no way to add songs to the emulator.
You ll have to use a real device to test this.

问题回答

实际上,你可以使用这样的手法:

Uri file = new Uri("Assets/Happy.mp3", UriKind.Relative);

//copy file to isolated storage
var myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
var fileStream = myIsolatedStorage.CreateFile("someSong.mp3");
var resource = Application.GetResourceStream(file);
int chunkSize = 4096;
byte[] bytes = new byte[chunkSize];
int byteCount;
while ((byteCount = resource.Stream.Read(bytes, 0, chunkSize)) > 0)
{
    fileStream.Write(bytes, 0, byteCount);
}
fileStream.Close();
Microsoft.Xna.Framework.Media.PhoneExtensions.SongMetadata metaData = 
    new Microsoft.Xna.Framework.Media.PhoneExtensions.SongMetadata();
metaData.AlbumName = "Some Album name";
metaData.ArtistName = "Some Artist Name";
metaData.GenreName = "test";
metaData.Name = "someSongName";

var ml = new MediaLibrary();
Uri songUri = new Uri("someSong.mp3", UriKind.RelativeOrAbsolute);
var song = Microsoft.Xna.Framework.Media.PhoneExtensions.MediaLibraryExtensions.SaveSong(ml, songUri, metaData, Microsoft.Xna.Framework.Media.PhoneExtensions.SaveSongOperation.CopyToLibrary);            




相关问题
copying a texture in xna into another texture

I am loading a Texture2D that contains multiple sprite textures. I would like to pull the individual textures out when I load the initial Texture to store into separate Texture2D objects, but can t ...

XNA Antialias question!

I ve got problems with XNA and antialiasing. I can activate it using graphics.PreferMultiSampling = true; graphics.ApplyChanges(); however - it s only 2x antialiasing. Even if I set ...

Take screen shot in XNA

How can I take a screen shot of the screen in XNA? Is it possible without System.Drawing.Graphics.CopyFromScreen or Win32API? If it s not possible, Is there any way to draw a System.Drawing.Bitmap to ...

XNA .Fbx textures

I m using the standard .fbx importer with custom shaders in XNA. The .fbx model is UV wrapped properly and is textured appropriately when I use BasicEffect. However when I use my custom effect I have ...

Can t install XNA

I m trying to install XNA. When the installation starts I got an error that says "XNA GSE 1.0 refresh requires Visual C# 2005 express edition sp1..." I use Windows 7 and I have Visual Studio 2008 &...

Is there a 3D equivalant to clamp in XNA?

I m building a 3D game but i only plan on using a 2D perspective thus not taking the z axis into the equasion, i want to be able to limit the movement of one of my models so it doesn t move out of the ...

Fetching the vertices from the backbuffer (HLSL) on XNA

Hello and sorry for the obscure title :} I`ll try to explain the best i can. First of all, i am new to HLSL but i understand about the pipeline and stuff that are from the fairy world. What i`m ...

Simple XNA 2d physics library

Working on a 2D project and wanted some recommendations on a simple 2d physics library for use in C# with the XNA framework. I was looking at Farseer or physics2d. Anyone have any other suggestions? ...

热门标签