Solved

Play midi sound directly from memory

Posted on 2000-04-07
4
799 Views
Last Modified: 2008-03-04
I have a midi file stored as a resource in the .exe. I can play it by loading the resource, saving it to a temporary file, and calling mciSendCommand with mci_Open and mci_Open_Element, specifying the temporary file.

How can I play the sound directly from memory, without having to save it in a  file?
0
Comment
Question by:doorframe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 2694919
0
 

Author Comment

by:doorframe
ID: 2695707
The Sample MIDI Player link reads from a file (unless I've missed something). I didn't see how to associate the memory pointer I have after reading the resource, with the midi parameters.  
0
 
LVL 23

Expert Comment

by:chensu
ID: 2696569
Yes, you are right, it does read the MIDI information from a file. It then stores the information into memory buffers. The MIDI functions read the MIDI messages from memory buffers.

There are actually two kinds of MIDI files. One of them (.rmi) is a RIFF file, in which case, you can still use MCI commands. See

HOWTO: Use MCI to Play AVI/WAVE Files from Memory
http://support.microsoft.com/support/kb/articles/Q155/3/60.asp

If the MIDI file (.mid) is not a RIFF file, you have to use the MIDI functions.
0
 

Author Comment

by:doorframe
ID: 2696661
Thank you, I will try to work with this information. (BTW it is a .mid file that I am using).
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question