Solved

Play midi sound directly from memory

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

636 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