Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Tutorial - MCI
Author:Arkon
Category:Win32API
Uploaded at:29-May-03
Views:9726
The MCI which stands for Media Control Interface is very easy to use.
In this tutorial I'll show you how to load a .MID and play it.
Most of the MCI calls are done through the mciSendCommand(...) function,
whenever we use this function we need an ID for the device player,
so if we want to stop the playing for instance we need to pass the
device ID that plays the MIDI and tell it to stop...So we'll save this ID.
Let's start then:
We tell the MCI to load a MIDI off a file and to start playing(once).
MCI_OPEN_PARMS mciOpenParms;
// "sequencer" - means we want to play a MIDI.
mciOpenParms.lpstrDeviceType = "sequencer";
// The MIDI file name.
mciOpenParms.lpstrElementName = strFileName;
// We open the MIDI for playing.
mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, 
               (DWORD)&mciOpenParms);
MIDI_Device = mciOpenParms.wDeviceID;
// Getting the Device ID which will play the MIDI.

MCI_PLAY_PARMS mciPlayParms;
// This struct is for the playing parameters we want. 
// We pass the handle of the window because when the MIDI
// will be finished playing, it will notify us (then we may
// play it again[looped]).
mciPlayParms.dwCallback = (DWORD)hWnd;
mciSendCommand(MIDI_Device, MCI_PLAY, MCI_NOTIFY, (DWORD)&mciPlayParms);

OK that was it for loading and playing, MCI does life easy, HUH? :)
Now let's see how to close the device player(this will free the MIDI too):
// Closing the MIDI.
if (MIDI_Device) mciSendCommand(MIDI_Device, MCI_CLOSE, 0, NULL);
MIDI_Device = NULL;

Well you gotta see the source code, it has a REAL nice GUI,
and you may learn how to use dialog boxes....Check it out!

Source Code:
Visual C++ 6 - MIDI.zip

User Contributed Comments(18)
 [1] Peter | 2007-08-24 12:30:32

Finally! Great!
 [2] lux | 2010-04-30 10:18:02

Woah!
Finally found something that works for me.
Excellent job :)
 [3] Csukpo MWONGHI | 2013-05-30 16:19:20

Nice thought but, would not work for me..... needs some extra worm files?
THIS IS INFECTED SCRAPWARE........


Do not download, you have been warned
 [4] Paul Gauthier | 2013-08-15 11:03:17

Hi, I need to write an app that plays a MIDI file but it needs the ability to "silence" one or more of the MIDI channels. This is to make a "Music-minus-one" type application for people to play along with. Does the Media Control Interface have the ability to do that with MIDI playback? Also, can it modify the playback tempo of a MIDI file? Thanks.
 [5] sakura | 2014-05-07 03:27:36

I discovered exactly what I was looking for. Thank you for a great article!
http://www.kizi4game.com
 [6] Yepi 10 | 2014-07-04 04:24:15

Thank you for a great article! Here's the problem I'm interested. http://www.kizilove.in | http://www.frivlove.in | http://www.yepi10hot.com
 [7] Y8Y8 | 2014-10-01 01:55:28

Thanks for your sharing settings I call MCI After reading your article it is very useful thank you much. http://www.y8y8y8y8.net/
 [8] Jai Singh | 2015-12-23 01:14:52

Very well written and explained. Enjoyed reading - Please visit for More information about -
Packers and Movers Pune @
http://www.expert5th.in/packers-and-movers-pune/
Packers and Movers Hyderabad @
http://www.expert5th.in/packers-and-movers-hyderabad/
Packers and Movers Mumbai @
http://www.expert5th.in/packers-and-movers-mumbai/
 [9] Rohit Kumar | 2015-12-23 01:15:08

I love this post. Keep on posting more like this.
Packers and Movers Gurgaon @
http://www.expert5th.in/packers-and-movers-gurgaon/
Packers and Movers Bangalore @
http://www.expert5th.in/packers-and-movers-bangalore/
Packers and Movers Delhi @
http://www.expert5th.in/packers-and-movers-delhi/
Packers and Movers Noida @
http://www.expert5th.in/packers-and-movers-noida/
 [10] Jai Singh | 2015-12-23 01:15:21

How do you make this kind of article, this was not just detailed it is also resourceful.
Packers and Movers Chennai @
http://www.expert5th.in/packers-and-movers-chennai/
Packers and Movers Thane @
http://www.expert5th.in/packers-and-movers-thane/
Packers and Movers Navi Mumbai @
http://www.expert5th.in/packers-and-movers-navimumbai/
Packers and Movers Faridabad @
http://www.expert5th.in/packers-and-movers-faridabad/
Packers and Movers Ghaziabad @
http://www.expert5th.in/packers-and-movers-ghaziabad/
 [11] romina fiume | 2016-01-12 11:29:54

The best Weight Loss Supplements in Best Sellers. Find the top products most popular items in weight loss opinion http://www.weightlossopinion.com/
 [12] Legal Steroids | 2016-02-15 08:51:02

Extreme Nutritions Selling Bodybuilding,Weightloss,Women's health and Sexual Products for All and Get the Best Prices on Extreme Nutritions Supplements <a href="http://extreme-nutritions.com/ ">Legal Steroids </a>
 [13] buy phenq | 2016-02-19 09:40:02

 Nice one.Read these PhenQ customer reviews to find out does it work? Review of side ... It is not available at any local store close to you and not at any retailer. www.phenqreviewstore.com <a href="www.phenqreviewstore.com ">buy phenq </a>    
 [14] Phenq Reviews | 2016-03-10 13:18:31

PhenQ is the newest weight loss pill that has been proven by legitimate and smart science. http://www.phenq-pills.com/
 [15] RAVI VAGHEL | 2016-04-21 02:17:36


Packers and Movers in Hyderabad @
http://www.movers5th.in/packers-and-movers-hyderabad/
Packers and Movers in Bangalore @
http://www.movers5th.in/packers-and-movers-bangalore/
Packers and Movers in Pune @
http://www.movers5th.in/packers-and-movers-pune/
 [16] RAVI VAGHEL | 2016-04-21 02:18:18

Packers and Movers in Mumbai @
http://www.movers5th.in/packers-and-movers-mumbai/
Packers and Movers in Delhi @
http://www.movers5th.in/packers-and-movers-delhi/
Packers and Movers in Gurgaon @
http://www.movers5th.in/packers-and-movers-gurgaon/
 [17] RAVI VAGHEL | 2016-04-21 02:19:10




Packers and Movers in Chennai @
http://www.movers5th.in/packers-and-movers-chennai/
Packers and Movers in Noida @        
http://www.movers5th.in/packers-and-movers-noida/
Packers and Movers in Navi Mumbai @
http://www.movers5th.in/packers-and-movers-navimumbai/
Packers and Movers in Thane @
http://www.movers5th.in/packers-and-movers-thane/
Packers and Movers in Ghaziabad @
http://www.movers5th.in/packers-and-movers-ghaziabad/
Packers and Movers in Faridabad @
http://www.movers5th.in/packers-and-movers-faridabad/
 [18] RAVI VAGHEL | 2016-04-21 02:19:53


For Packers and Movers Pune click at
http://www.moveby5th.in/packers-and-movers-pune.html
For Packers and Movers Bangalore click at
http://www.moveby5th.in/packers-and-movers-bangalore.html
For Packers and Movers Hyderabad click at
http://www.moveby5th.in/packers-and-movers-hyderabad.html
For Packers and Movers Mumbai click at
http://www.moveby5th.in/packers-and-movers-mumbai.html
For Packers and Movers Gurgaon click at
http://www.moveby5th.in/packers-and-movers-gurgaon.html
For Packers and Movers Delhi click at
http://www.moveby5th.in/packers-and-movers-delhi.html
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[105389]
2D Rotated Rectangles Collision Detection[78700]
Keyboard Hook[68403]
UDP[52487]
HTTP Proxy[35813]

::Top 5 Samples::
2D ColDet Rotated Rectangles[10558]
PS2 Mouse Driver[6060]
Wave Format Player[4945]
Reading FAT12[4826]
CodeGuru[4521]


All rights reserved to RageStorm © 2009