#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#pragma comment(lib,"winmm.lib")
typedef union _midi {
DWORD dwData;
BYTE bData[4];
} MIDI;
void setInstruments(HMIDIOUT handle, unsigned long *result, unsigned long *device);
void printtable(unsigned long device);
int main()
{
unsigned long result, device=0;
HMIDIOUT handle;
unsigned char key;
printf("initlizing ...\n");
result=midiOutOpen(&handle,0,0,0,CALLBACK_NULL);
if(result)
{
printf("There is an error opening the default MIDI out device!\n");
exit(1);
}
setInstruments(handle, &result, &device);
// printf("current volume 0x%x\n",result);
while(TRUE)
{
key=getch();
midiOutReset(handle);
switch(key)
{
case 'a':
midiOutShortMsg(handle, 0x00603C90);
// Sleep(1000);
break;
case 's':
midiOutShortMsg(handle, 0x00603E90);
// Sleep(1000);
break;
case 'd':
midiOutShortMsg(handle, 0x00604090);
// Sleep(1000);
break;
case 'f':
midiOutShortMsg(handle, 0x00604190);
// Sleep(1000);
break;
case 'j':
midiOutShortMsg(handle, 0x00604390);
// Sleep(1000);
break;
case 'k':
midiOutShortMsg(handle, 0x00604590);
// Sleep(1000);
break;
case 'l':
midiOutShortMsg(handle, 0x00604790);
// Sleep(1000);
break;
case 'z':