Jump to content
  • Advertisement
Sign in to follow this  
shadowisadog

[XNA] Load MP3 file dynamically in XNA 3.0

This topic is 3543 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone, I have a bit of a problem. I am using XNA 3.0 and I have a test app for a rhythm game I am creating... I want to load the mp3 files dynamically. I have read up on custom content managers and all sorts of things but I am a bit lost on it all so if someone could point me in the right direction that would be a huge help. In essence I can do:
            mMediaSong = Content.Load<Song>(@"ch8_rescue");
But I want to load the ch8_rescue.mp3 file from another directory at runtime. Thanks for any help!

Share this post


Link to post
Share on other sites
Advertisement
The only way I could figure out how to do this natively in XNA would be to use a modified version of the XNB code: XNB Content Builder Assembly and it seems like too much work to do something so simple...

Bass or FMod would be nice choices but I worry about licenses and third party implementations that might have nasty surprises. SlimDX for DirectSound would have been nice but I think it might be too much overhead as I am already using XNA and the same for Tao and OpenAL.

EDIT: And yeah MCI would work but I got some sort of odd error with my code when doing things that way... Even though the exact same code works in my editor O_o so maybe XNA doesn't like MCI for some reason?

I ended up opting instead to use the windows media player using this reference: Creating the windows media player programmatically

Here is the code I used:


mMediaPlayer = new WindowsMediaPlayer();
mMediaPlayer.URL = mSong.MP3Filename;
mMediaPlayer.controls.play();




Just posting this incase anyone was curious as to what I ended up doing. I hate it when I read a thread that asks the same question that I want to know the answer to and no one has responded.

Good luck.

[Edited by - shadowisadog on January 8, 2009 5:52:14 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!