OpenShot Audio Library | OpenShotAudio  0.3.0
juce_MPENote.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
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 
23 namespace juce
24 {
25 
26 //==============================================================================
39 struct JUCE_API MPENote
40 {
41  //==============================================================================
43  enum KeyState
44  {
45  off = 0,
46  keyDown = 1,
47  sustained = 2,
48  keyDownAndSustained = 3
49  };
50 
51  //==============================================================================
72  MPENote (int midiChannel,
73  int initialNote,
74  MPEValue velocity,
75  MPEValue pitchbend,
76  MPEValue pressure,
77  MPEValue timbre,
78  KeyState keyState = MPENote::keyDown) noexcept;
79 
86  MPENote() noexcept;
87 
89  bool isValid() const noexcept;
90 
91  //==============================================================================
92  // Invariants that define the note.
93 
98  uint16 noteID = 0;
99 
103  uint8 midiChannel = 0;
104 
108  uint8 initialNote = 0;
109 
110  //==============================================================================
111  // The five dimensions of continuous expressive control
112 
116  MPEValue noteOnVelocity { MPEValue::minValue() };
117 
129 
134 
138  MPEValue initialTimbre { MPEValue::centreValue() };
139 
145 
152  MPEValue noteOffVelocity { MPEValue::minValue() };
153 
154  //==============================================================================
165 
169  KeyState keyState { MPENote::off };
170 
171  //==============================================================================
175  double getFrequencyInHertz (double frequencyOfA = 440.0) const noexcept;
176 
178  bool operator== (const MPENote& other) const noexcept;
179 
181  bool operator!= (const MPENote& other) const noexcept;
182 };
183 
184 } // namespace juce
static MPEValue centreValue() noexcept
double totalPitchbendInSemitones
Definition: juce_MPENote.h:164
static MPEValue minValue() noexcept