Solved

Play midi sound directly from memory

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

743 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

13 Experts available now in Live!

Get 1:1 Help Now