Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want the midi that I'm playing when the application opens INSIDE of the application, NOT in a folder. You see what I'm doing now is this using DirectX 9.0b Audio/Video Playback:

 

Dim BackgroundMusic As Audio
BackgroundMusic = BackgroundMusic.FromFile("Data/Song.mid")
BackgroundMusic.Play

 

 

But I want the Midi to be inside of the .exe and call the midi from within the application. :confused:

"Reality is fake, Dreams are for real"
Posted

I couldn't find how to embed it as a resource because there was no option for the midi in its properties like I thought there would be. This is what it looked like before I started the program:

 

Midi Problem I

 

This is what it looked like after :(

 

Midi Problem II

 

I hope you can help mae!

"Reality is fake, Dreams are for real"
  • *Experts*
Posted
You'll need to use Assembly.GetExecutingAssembly.GetManifestResourceStream("projectname.filename.ext")to return a Stream (you can probably put it into a FileStream), which you can then save to disk and then load it like a normal file. Just delete it when you are done.
  • *Experts*
Posted

Actually, you may not need to do it that way. Look in your MSDN for 'resources samples' (search using the index) and you'll see some examples there. There is quite a lot of documentation in the MSDN if you just search around a bit.

 

Myself, I've never used resources much, so I can't really help you here.

  • *Experts*
Posted
Audio class doesnt accept Streams, which are returned as means to access the resources, as the location for the sound file. You will have better luck using DirectSound which accepts streams for sounds.
  • *Experts*
Posted
You may want to use StreamWriter or BinaryWriter at this point to save the retreived resource to a temporary file, and then pass that into the Audio class.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...