c# - Make correct URI for WP Game Library -



c# - Make correct URI for WP Game Library -

i trying create library sounds in it, cant uris work, if utilize online uri like

new uri("http://www.archive.org/download/brahmsviolinconcerto-heifetz/03iii.allegrogiocosomanontroppovivace.mp3")

it works fine, issue linking correctly folders in project

my in wp game librarys folder have \sounds\letters , in folder sound named a.wma

my method loading

public void playletter(string letter) { seek { initialize(); frameworkdispatcher.update(); var uri = new uri(@"/sounds/letters/" + letter + ".wma", urikind.relative); var song = song.fromuri("sound", uri); mediaplayer.play(song); } catch(exception e) { console.writeline(e.tostring()); } }

and of course of study give string "a" parameter when fails

i have included sound file in project like

i

a first chance exception of type 'system.invalidoperationexception' occurred in microsoft.xna.framework.dll

but uri problem tried online uri worked fine

also in uncertainty of 2 things, mediaplayer right thing utilize in game? , can library play sounds (or contain them)

the typical thing in xna utilize soundeffectinstance:

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.audio.soundeffectinstance.aspx

unfortunately soundeffectinstance works wav files. if want play longer music files - can utilize mediaelement - allows playback of single compressed sound file @ time only. alternative might play compressed medialibrary using mediaplayer class. save own compressed sound file in medialibrary play there. see:

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.medialibrary.songs.aspx

c# .net windows-phone-7 xna

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -