alaphate Posted March 9, 2009 Posted March 9, 2009 (edited) I can use mciSendCommand to play midi music from disk.I'd like to embed midi file into .rc (resource).How to play midi from resource or memory?Thank you very much in advance.// c, cpp languages are preferred.I have found a example using directX, but I don't want directX in my progam.http://www.codeguru.com/cpp/g-m/multimedia/print.php/c1573 Edited March 9, 2009 by alaphate
enhzflep Posted April 30, 2009 Posted April 30, 2009 I have found a example using directX, but I don't want directX in my progam.http://www.codeguru.com/cpp/g-m/multimedia/print.php/c1573Just wondering, I couldn't find any dependancies on DirectSound in the supplied example code,I did notice the reference to the DirectX examples, though nothing to suggest they're needed for thiscode.Although it uses mmsystem.lib, though this is separate and distinct to DirectSound.Here's what MS has to say about MIDI: http://msdn.microsoft.com/en-us/library/ms712058(VS.85).aspx
alaphate Posted May 1, 2009 Author Posted May 1, 2009 (edited) enhzflep, Thank you for great help mciSendCommand() can play midi with ease, but it cannot play midi from resource. I googled, and found someone suggested using Hook to Windows' OpenFile() API And provide the midi filename with a plus sign to the end, i.e. "hello.mid+" However, I don't know how to hook OpenFile(). Again, Thank you very much! Edited May 1, 2009 by alaphate
enhzflep Posted May 1, 2009 Posted May 1, 2009 enhzflep,Thank you for great help mciSendCommand() can play midi with ease, but it cannot play midi from resource. I googled, and found someone suggested using Hook to Windows' OpenFile() API And provide the midi filename with a plus sign to the end, i.e. "hello.mid+" However, I don't know how to hook OpenFile(). Again, Thank you very much! Holy f%*!, that seems like a hell of a lot of work to me. Why don't you give this project a try? It's the source code from the example you linked to - with the MFC dependency removed. I've compiled this program using minGW and Code::Blocks Enjoy! midi.rar
alaphate Posted May 1, 2009 Author Posted May 1, 2009 enhzflep,Thank you for the attachment, the problem is resolved.Hook to OpenFile is very useful, it's used not only for embedding midi, but also for other files,such as play .swf in resource using ActiveX.90% of my questions in this forum are resolved by you.Great thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now