Solved

Play midi sound directly from memory

Posted on 2000-04-07
4
762 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

932 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now