Diablicolic Posted August 4, 2003 Posted August 4, 2003 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: Quote "Reality is fake, Dreams are for real"
aewarnick Posted August 4, 2003 Posted August 4, 2003 Add an existing item to your solution and make it an Embedded Resource. Quote C#
Diablicolic Posted August 4, 2003 Author Posted August 4, 2003 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! Quote "Reality is fake, Dreams are for real"
*Experts* Volte Posted August 4, 2003 *Experts* Posted August 4, 2003 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. Quote
Diablicolic Posted August 4, 2003 Author Posted August 4, 2003 I still can't figure out how to open the new midi, even when it's an embedded source... :confused: Midi Problem III Quote "Reality is fake, Dreams are for real"
*Experts* Volte Posted August 4, 2003 *Experts* Posted August 4, 2003 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. Quote
Diablicolic Posted August 4, 2003 Author Posted August 4, 2003 I will look into that right now! Thanks. Quote "Reality is fake, Dreams are for real"
*Experts* mutant Posted August 4, 2003 *Experts* Posted August 4, 2003 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. Quote
Diablicolic Posted August 4, 2003 Author Posted August 4, 2003 (edited) aaahhh jeez... Midi Problem 4 ----Edit---- But I thought DirectSound only deals with .wavs Edited August 4, 2003 by Diablicolic Quote "Reality is fake, Dreams are for real"
*Experts* mutant Posted August 4, 2003 *Experts* Posted August 4, 2003 Ah, sorry, forgot it doesnt play MIDIs, I just got back from 9 hour drive so I might not be in full programming strength :). Quote
*Experts* Volte Posted August 4, 2003 *Experts* Posted August 4, 2003 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. Quote
Diablicolic Posted August 4, 2003 Author Posted August 4, 2003 (edited) Ok I'll try that :p ---------Edit--------- Ahhhh this is too confusing Edited August 4, 2003 by Diablicolic Quote "Reality is fake, Dreams are for real"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.