Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 815
  • Last Modified:

Play midi sound directly from memory

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
doorframe
Asked:
doorframe
  • 2
  • 2
1 Solution
 
chensuCommented:
0
 
doorframeAuthor Commented:
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
 
chensuCommented:
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
 
doorframeAuthor Commented:
Thank you, I will try to work with this information. (BTW it is a .mid file that I am using).
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now