Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
6.4 KiB

  1. /****************************************************************************
  2. MODULE: MIDI.HPP
  3. Tab settings: 5 9
  4. Copyright 1995, 1996, Microsoft Corporation, All Rights Reserved.
  5. PURPOSE: Header for MIDI.CPP
  6. Author(s): Name:
  7. ---------- ----------------
  8. MEA Manolito E. Adan
  9. Revision History:
  10. -----------------
  11. Version Date Author Comments
  12. 1.0 03-Apr-96 MEA original
  13. ****************************************************************************/
  14. #ifndef _MIDI_SEEN
  15. #define _MIDI_SEEN
  16. #define MMNODRV
  17. #define MMNOSOUND
  18. #define MMNOWAVE
  19. // #define MMNOMIDI // we need the MIDI definitions
  20. #define MMNOAUX
  21. #define MMNOTIMER
  22. #define MMNOJOY
  23. #define MMNOMMIO
  24. #define MMNOMCI
  25. #include <winuser.h>
  26. #include <mmsystem.h>
  27. //////////////////////////////////////////////////////////////////////////////
  28. //
  29. // manifest constants and macros for MIDI message protocol
  30. //
  31. //////////////////////////////////////////////////////////////////////////////
  32. // MIDI Status Bytes for Channel Voice Messages
  33. #define MIDI_NOTE_OFF 0x80
  34. #define MIDI_NOTE_ON 0x90
  35. #define MIDI_POLY_PRESSURE 0xA0
  36. #define MIDI_CONTROL_CHANGE 0xB0
  37. #define MIDI_PROGRAM_CHANGE 0xC0
  38. #define MIDI_CHANNEL_PRESSURE 0xD0
  39. #define MIDI_AFTERTOUCH 0xD0 // synonym for channel pressure
  40. #define MIDI_PITCH_WHEEL 0xE0
  41. // MIDI Status Bytes for System Common Messages
  42. #define MIDI_SYSEX 0xF0 // beginning of system exclusive message
  43. #define MIDI_MTC_QTR_FRAME 0xF1
  44. #define MIDI_SONG_POSITION_PTR 0xF2
  45. #define MIDI_SONG_SELECT 0xF3
  46. #define MIDI_TUNE_REQUEST 0xF6
  47. #define MIDI_EOX 0xF7 // marks end of system exclusive message
  48. // MIDI Status Bytes for System Real-Time Messages
  49. #define MIDI_TIMING_CLOCK 0xF8
  50. #define MIDI_START 0xFA
  51. #define MIDI_CONTINUE 0xFB
  52. #define MIDI_STOP 0xFC
  53. #define MIDI_ACTIVE_SENSING 0xFE
  54. #define MIDI_SYSTEM_RESET 0xFF
  55. // control numbers for MIDI_CONTROL_CHANGE (MIDI status byte 0xB0)
  56. // note: not a complete list
  57. #define MIDI_MOD_WHEEL 0x01
  58. #define MIDI_BREATH_CONTROL 0x02
  59. #define MIDI_FOOT_CONTROL 0x04
  60. #define MIDI_PORTAMENTO_TIME 0x05
  61. #define MIDI_DATA_ENTRY_SLIDER 0x06
  62. #define MIDI_VOLUME 0x07
  63. #define MIDI_BALANCE 0x08
  64. #define MIDI_PAN 0x0A
  65. #define MIDI_EXPRESSION 0x0B
  66. #define MIDI_GENERAL_PURPOSE_1 0x10
  67. #define MIDI_GENERAL_PURPOSE_2 0x11
  68. #define MIDI_GENERAL_PURPOSE_3 0x12
  69. #define MIDI_GENERAL_PURPOSE_4 0x13
  70. #define MIDI_SUSTAIN 0x40
  71. #define MIDI_PORTAMENTO 0x41
  72. #define MIDI_SOSTENUTO 0x42
  73. #define MIDI_SOFT 0x43
  74. #define MIDI_HOLD_2 0x45
  75. #define MIDI_GENERAL_PURPOSE_5 0x50
  76. #define MIDI_GENERAL_PURPOSE_6 0x51
  77. #define MIDI_GENERAL_PURPOSE_7 0x52
  78. #define MIDI_GENERAL_PURPOSE_8 0x53
  79. #define MIDI_EXTERNAL_EFFECTS_DEPTH 0x5B
  80. #define MIDI_TREMELO_DEPTH 0x5C
  81. #define MIDI_CHORUS_DEPTH 0x5D
  82. #define MIDI_CELESTE_DEPTH 0x5E
  83. #define MIDI_PHASER_DEPTH 0x5F
  84. #define MIDI_DATA_INCREMENT 0x60
  85. #define MIDI_DATA_DECREMENT 0x61
  86. #define MIDI_NONREG_PARAM_NUM_MSB 0x62
  87. #define MIDI_NONREG_PARAM_NUM_LSB 0x63
  88. #define MIDI_REG_PARAM_NUM_MSB 0x64
  89. #define MIDI_REG_PARAM_NUM_LSB 0x65
  90. #define MIDI_RESET_ALL_CONTROLLERS 0x79
  91. #define MIDI_LOCAL_CONTROL 0x7A
  92. #define MIDI_ALL_NOTES_OFF 0x7B
  93. #define MIDI_OMNI_MODE_OFF 0x7C
  94. #define MIDI_OMNI_MODE_ON 0x7D
  95. #define MIDI_MONO_MODE_ON 0x7E
  96. #define MIDI_POLY_MODE_ON 0x7F
  97. // macro to pack a MIDI short message
  98. #define MAKEMIDISHORTMSG(cStatus, cChannel, cData1, cData2) \
  99. cStatus | cChannel | (((UINT)cData1) << 8) | (((DWORD)cData2) << 16)
  100. // macros to unpack a MIDI short message
  101. #define MIDI_STATUS(dwMsg) ((LOBYTE(LOWORD(dwMsg)) < MIDI_SYSEX) ? \
  102. LOWORD(dwMsg) & 0xF0 : LOBYTE(LOWORD(dwMsg)))
  103. #define MIDI_CHANNEL(dwMsg) ((LOBYTE(LOWORD(dwMsg)) < MIDI_SYSEX) ? \
  104. LOWORD(dwMsg) & 0x0F : 0)
  105. #define MIDI_DATA1(dwMsg) (HIBYTE(LOWORD(dwMsg)))
  106. #define MIDI_DATA2(dwMsg) (LOBYTE(HIWORD(dwMsg)))
  107. //////////////////////////////////////////////////////////////////////////////
  108. //
  109. // declarations for MIDI wrapper functions
  110. //
  111. //////////////////////////////////////////////////////////////////////////////
  112. #define MIDI_IN 0x0001 // specifies MIDI input device
  113. #define MIDI_OUT 0x0002 // specifies MIDI output device
  114. #define NO_MIDI 0xFF00 // MIDI device unavaible or not selected
  115. #define MIDI_OPEN 0x0001 // uActivateMode parameter for MidiActivate
  116. #define MIDI_CLOSE 0x0010 // uActivateMode parameter for MidiActivate
  117. #define MIDI_ABANDON 0x0011 // uActivateMode parameter for MidiActivate
  118. #define MIDI_BUSY 0xFF01 // possible MidiActivate return value
  119. #define MIDI_ERRMSG_SIZE 128 // for MidiShowError string buffer
  120. typedef struct _MIDIINFO // MIDI device information block
  121. {
  122. UINT uDeviceType; // either MIDI_IN, MIDI_OUT or NO_MIDI
  123. UINT uDeviceID; // ID of device chosen by user or NO_MIDI
  124. union
  125. {
  126. HMIDIIN hMidiIn; // input device handle used if MIDI_IN device
  127. HMIDIOUT hMidiOut; // output device handle used if MIDI_OUT device
  128. };
  129. MIDIHDR MidiHdr; // required for system exclusive
  130. BOOL fAlwaysKeepOpen; // access level requested by application
  131. UINT uDeviceStatus; // current status of device
  132. } MIDIINFO, *LPMIDIINFO;
  133. // defines for MIDIINFO uDeviceStatus member
  134. #define MIDI_DEVICE_IDLE 0x0000 // device is not in use
  135. #define MIDI_DEVICE_BUSY 0x0001 // device is busy
  136. #define MIDI_DEVICE_ABANDONED 0x0002 // device was reset while busy
  137. BOOL MidiInit(LPMIDIINFO, LPMIDIINFO);
  138. MMRESULT MidiGetDeviceName(UINT, UINT, LPWORD, LPWORD, LPSTR);
  139. UINT MidiActivateDevice(LPMIDIINFO, UINT);
  140. UINT MidiSendShortMsg(LPMIDIINFO, BYTE, BYTE, BYTE, BYTE);
  141. UINT MidiSendLongMsg(LPMIDIINFO, BOOL);
  142. UINT MidiRecord(LPMIDIINFO, BOOL);
  143. BOOL MidiExit(LPMIDIINFO, LPMIDIINFO);
  144. #endif // of ifdef _MIDI_SEEN