Midi.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Midi.h - constants, structs etc. concerning MIDI
  3. *
  4. * Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef MIDI_H
  25. #define MIDI_H
  26. #include "lmms_basics.h"
  27. enum MidiEventTypes
  28. {
  29. // messages
  30. MidiNoteOff = 0x80,
  31. MidiNoteOn = 0x90,
  32. MidiKeyPressure = 0xA0,
  33. MidiControlChange = 0xB0,
  34. MidiProgramChange = 0xC0,
  35. MidiChannelPressure = 0xD0,
  36. MidiPitchBend = 0xE0,
  37. // system exclusive
  38. MidiSysEx= 0xF0,
  39. // system common - never in midi files
  40. MidiTimeCode= 0xF1,
  41. MidiSongPosition = 0xF2,
  42. MidiSongSelect = 0xF3,
  43. MidiTuneRequest = 0xF6,
  44. MidiEOX= 0xF7,
  45. // system real-time - never in midi files
  46. MidiSync = 0xF8,
  47. MidiTick = 0xF9,
  48. MidiStart = 0xFA,
  49. MidiContinue = 0xFB,
  50. MidiStop = 0xFC,
  51. MidiActiveSensing = 0xFE,
  52. MidiSystemReset = 0xFF,
  53. // meta event - for midi files only
  54. MidiMetaEvent = 0xFF
  55. } ;
  56. enum MidiMetaEventTypes
  57. {
  58. MidiMetaInvalid = 0x00,
  59. MidiCopyright = 0x02,
  60. MidiTrackName = 0x03,
  61. MidiInstName = 0x04,
  62. MidiLyric = 0x05,
  63. MidiMarker = 0x06,
  64. MidiCuePoint = 0x07,
  65. MidiPortNumber = 0x21,
  66. MidiEOT = 0x2f,
  67. MidiSetTempo = 0x51,
  68. MidiSMPTEOffset = 0x54,
  69. MidiTimeSignature = 0x58,
  70. MidiKeySignature = 0x59,
  71. MidiSequencerEvent = 0x7f,
  72. MidiMetaCustom = 0x80,
  73. MidiNotePanning
  74. } ;
  75. typedef MidiMetaEventTypes MidiMetaEventType;
  76. enum MidiStandardControllers
  77. {
  78. MidiControllerBankSelect = 0,
  79. MidiControllerModulationWheel = 1,
  80. MidiControllerBreathController = 2,
  81. MidiControllerFootController = 4,
  82. MidiControllerPortamentoTime = 5,
  83. MidiControllerDataEntry = 6,
  84. MidiControllerMainVolume = 7,
  85. MidiControllerBalance = 8,
  86. MidiControllerPan = 10,
  87. MidiControllerEffectControl1 = 12,
  88. MidiControllerEffectControl2 = 13,
  89. MidiControllerSustain = 64,
  90. MidiControllerPortamento = 65,
  91. MidiControllerSostenuto = 66,
  92. MidiControllerSoftPedal = 67,
  93. MidiControllerLegatoFootswitch = 68,
  94. MidiControllerRegisteredParameterNumberLSB = 100,
  95. MidiControllerRegisteredParameterNumberMSB = 101,
  96. // Channel Mode Messages are controllers too...
  97. MidiControllerAllSoundOff = 120,
  98. MidiControllerResetAllControllers = 121,
  99. MidiControllerLocalControl = 122,
  100. MidiControllerAllNotesOff = 123,
  101. MidiControllerOmniOn = 124,
  102. MidiControllerOmniOff = 125,
  103. MidiControllerMonoOn = 126,
  104. MidiControllerPolyOn = 127,
  105. };
  106. enum MidiControllerRegisteredParameterNumbers
  107. {
  108. MidiPitchBendSensitivityRPN = 0x0000,
  109. MidiChannelFineTuningRPN = 0x0001,
  110. MidiChannelCoarseTuningRPN = 0x0002,
  111. MidiTuningProgramChangeRPN = 0x0003,
  112. MidiTuningBankSelectRPN = 0x0004,
  113. MidiModulationDepthRangeRPN = 0x0005,
  114. MidiNullFunctionNumberRPN = 0x7F7F
  115. };
  116. const int MidiChannelCount = 16;
  117. const int MidiControllerCount = 128;
  118. const int MidiProgramCount = 128;
  119. const int MidiMaxVelocity = 127;
  120. const int MidiDefaultVelocity = MidiMaxVelocity / 2;
  121. const int MidiMaxControllerValue = 127;
  122. const int MidiMaxKey = 127;
  123. const int MidiMaxPanning = 127;
  124. const int MidiMinPanning = -128;
  125. const int MidiMinPitchBend = 0;
  126. const int MidiMaxPitchBend = 16383;
  127. #endif