OpenShot Audio Library | OpenShotAudio: juce_MidiRPN.h Source File

OpenShot Audio Library | OpenShotAudio 0.6.0

Loading...
Searching...
No Matches
juce_MidiRPN.h
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//==============================================================================
32 struct MidiRPNMessage
33{
35 int channel;
36
38 int parameterNumber;
39
44 int value;
45
47 bool isNRPN;
48
52 bool is14BitValue;
53};
54
55//==============================================================================
67 class 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
123 JUCE_LEAK_DETECTOR (MidiRPNDetector)
124};
125
126//==============================================================================
135 class 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
juce::MidiBuffer
Definition juce_MidiBuffer.h:145
juce::MidiRPNDetector
Definition juce_MidiRPN.h:68
juce::MidiRPNDetector::parseControllerMessage
bool parseControllerMessage(int midiChannel, int controllerNumber, int controllerValue, MidiRPNMessage &result) noexcept
Definition juce_MidiRPN.cpp:26
juce::MidiRPNDetector::reset
void reset() noexcept
Definition juce_MidiRPN.cpp:51
juce::MidiRPNDetector::tryParse
std::optional< MidiRPNMessage > tryParse(int midiChannel, int controllerNumber, int controllerValue)
Definition juce_MidiRPN.cpp:40
juce::MidiRPNDetector::MidiRPNDetector
MidiRPNDetector() noexcept=default
juce::MidiRPNGenerator
Definition juce_MidiRPN.h:136
juce::MidiRPNGenerator::generate
static MidiBuffer generate(MidiRPNMessage message)
Definition juce_MidiRPN.cpp:114
juce::MidiRPNMessage
Definition juce_MidiRPN.h:33
juce::MidiRPNMessage::isNRPN
bool isNRPN
Definition juce_MidiRPN.h:47
juce::MidiRPNMessage::is14BitValue
bool is14BitValue
Definition juce_MidiRPN.h:52
juce::MidiRPNMessage::channel
int channel
Definition juce_MidiRPN.h:35
juce::MidiRPNMessage::parameterNumber
int parameterNumber
Definition juce_MidiRPN.h:38
juce::MidiRPNMessage::value
int value
Definition juce_MidiRPN.h:44