Question

I want to load on XNA SoundEffect. I have tried to use:

SoundEffect.FromStream(TitleContainer.OpenStream(XXX));

The XXX is the addres but it require the address from the content and I want to search from the whole computer. Address like:

C:\Users\PC\Desktop\programs

How do I do that?

Was it helpful?

Solution

Will this work?

SoundEffect.FromStream(new FileStream(path, FileMode.Open));

where path is the file path.

OTHER TIPS

You should have your custom files in your content folder or debug folder so they gets distributed properly on release. I am not sure what happens if i load a file from a completely different path since there was no reason to do that.

If you really want to load from a path far down you could type "../" to go a map down, depends on where you put the solution how much maps you need to go down to reach the "c:\" but you can see in the debug information where it is looking for the file so that should not be a problem.

But i really advice you to use the proper locations for your custom content or you might end up changing tons when you want to release.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top