Audio plugin host https://kx.studio/carla
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.

117 lines
5.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. namespace juce
  18. {
  19. //==============================================================================
  20. /**
  21. This helper class contains the necessary helper functions to generate
  22. MIDI messages that are exclusive to MPE, such as defining the upper and lower
  23. MPE zones and setting per-note and master pitchbend ranges.
  24. You can then send them to your MPE device using MidiOutput::sendBlockOfMessagesNow.
  25. All other MPE messages like per-note pitchbend, pressure, and third
  26. dimension, are ordinary MIDI messages that should be created using the MidiMessage
  27. class instead. You just need to take care to send them to the appropriate
  28. per-note MIDI channel.
  29. Note: If you are working with an MPEZoneLayout object inside your app,
  30. you should not use the message sequences provided here. Instead, you should
  31. change the zone layout programmatically with the member functions provided in the
  32. MPEZoneLayout class itself. You should also make sure that the Expressive
  33. MIDI zone layout of your C++ code and of the MPE device are kept in sync.
  34. @see MidiMessage, MPEZoneLayout
  35. @tags{Audio}
  36. */
  37. class JUCE_API MPEMessages
  38. {
  39. public:
  40. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  41. MIDI device, will set the lower MPE zone.
  42. */
  43. static MidiBuffer setLowerZone (int numMemberChannels = 0,
  44. int perNotePitchbendRange = 48,
  45. int masterPitchbendRange = 2);
  46. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  47. MIDI device, will set the upper MPE zone.
  48. */
  49. static MidiBuffer setUpperZone (int numMemberChannels = 0,
  50. int perNotePitchbendRange = 48,
  51. int masterPitchbendRange = 2);
  52. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  53. MIDI device, will set the per-note pitchbend range of the lower MPE zone.
  54. */
  55. static MidiBuffer setLowerZonePerNotePitchbendRange (int perNotePitchbendRange = 48);
  56. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  57. MIDI device, will set the per-note pitchbend range of the upper MPE zone.
  58. */
  59. static MidiBuffer setUpperZonePerNotePitchbendRange (int perNotePitchbendRange = 48);
  60. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  61. MIDI device, will set the master pitchbend range of the lower MPE zone.
  62. */
  63. static MidiBuffer setLowerZoneMasterPitchbendRange (int masterPitchbendRange = 2);
  64. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  65. MIDI device, will set the master pitchbend range of the upper MPE zone.
  66. */
  67. static MidiBuffer setUpperZoneMasterPitchbendRange (int masterPitchbendRange = 2);
  68. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  69. MIDI device, will clear the lower zone.
  70. */
  71. static MidiBuffer clearLowerZone();
  72. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  73. MIDI device, will clear the upper zone.
  74. */
  75. static MidiBuffer clearUpperZone();
  76. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  77. MIDI device, will clear the lower and upper zones.
  78. */
  79. static MidiBuffer clearAllZones();
  80. /** Returns the sequence of MIDI messages that, if sent to an Expressive
  81. MIDI device, will reset the whole MPE zone layout of the
  82. device to the layout passed in. This will first clear the current lower and upper
  83. zones, then then set the zones contained in the passed-in zone layout, and set their
  84. per-note and master pitchbend ranges to their current values.
  85. */
  86. static MidiBuffer setZoneLayout (MPEZoneLayout layout);
  87. /** The RPN number used for MPE zone layout messages.
  88. Pitchbend range messages (both per-note and master) are instead sent
  89. on RPN 0 as in standard MIDI 1.0.
  90. */
  91. static const int zoneLayoutMessagesRpnNumber = 6;
  92. };
  93. } // namespace juce