JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_MidiRPN.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
33{
36
39
44 int value;
45
47 bool isNRPN;
48
53};
54
55//==============================================================================
67class JUCE_API MidiRPNDetector
68{
69public:
71 MidiRPNDetector() noexcept = default;
72
74 ~MidiRPNDetector() noexcept = default;
75
79 void reset() noexcept;
80
81 //==============================================================================
83 [[deprecated ("Use tryParse() instead")]]
84 bool parseControllerMessage (int midiChannel,
85 int controllerNumber,
86 int controllerValue,
87 MidiRPNMessage& result) noexcept;
88
103 std::optional<MidiRPNMessage> tryParse (int midiChannel,
104 int controllerNumber,
105 int controllerValue);
106
107private:
108 //==============================================================================
109 struct ChannelState
110 {
111 std::optional<MidiRPNMessage> handleController (int channel, int controllerNumber,
112 int value) noexcept;
113 void resetValue() noexcept;
114 std::optional<MidiRPNMessage> sendIfReady (int channel) noexcept;
115
116 uint8 parameterMSB = 0xff, parameterLSB = 0xff, valueMSB = 0xff, valueLSB = 0xff;
117 bool isNRPN = false;
118 };
119
120 //==============================================================================
121 ChannelState states[16];
122
124};
125
126//==============================================================================
135class JUCE_API MidiRPNGenerator
136{
137public:
138 //==============================================================================
140 static MidiBuffer generate (MidiRPNMessage message);
141
142 //==============================================================================
159 static MidiBuffer generate (int channel,
160 int parameterNumber,
161 int value,
162 bool isNRPN = false,
163 bool use14BitValue = true);
164};
165
166} // namespace juce
Holds a sequence of time-stamped midi events.
Parses a stream of MIDI data to assemble RPN and NRPN messages from their constituent MIDI CC message...
MidiRPNDetector() noexcept=default
Constructor.
Generates an appropriate sequence of MIDI CC messages to represent an RPN or NRPN message.
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
JUCE Namespace.
bool isNRPN
True if this message is an NRPN; false if it is an RPN.
bool is14BitValue
True if the value uses 14-bit resolution (LSB + MSB); false if the value is 7-bit (MSB only).
int channel
Midi channel of the message, in the range 1 to 16.
int parameterNumber
The 14-bit parameter index, in the range 0 to 16383 (0x3fff).
int value
The parameter value, in the range 0 to 16383 (0x3fff).
unsigned char uint8
A platform-independent 8-bit unsigned integer type.
Represents a MIDI RPN (registered parameter number) or NRPN (non-registered parameter number) message...