I am trying to execute this answer to add some audio files to the Windows Phone emulator library. But I get an error
The type or name of the PhoneExtensions namespace does not exist in the Microsoft.Xna.Framework.Media namespace (do you miss the assembly reference?)
I can not reference the microsoft.xna.framework.media.phoneextensions.dll file because it is not in the location
C: \ Program Files \ Reference Assemblies \ Microsoft \ Framework \ Silverlight \ v4.0 \ Profile \ WindowsPhone71
I installed Microsoft XNA Game Studio 4.0, but still could not find the dll in the system folders.
I tried, but could not get the dll anywhere on the internet.
Here is my code (if that matters)
Uri file = new Uri("files/a_wink.mp3", UriKind.Relative); var myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication(); var fileStream = myIsolatedStorage.CreateFile("a_wink.mp3"); var resource = Application.GetResourceStream(file); int chunkSize = 2000000; 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 );
Edit: I am using the Windows Phone SDK 7.1 in Vista Home Basic.
source share