Loading...
Searching...
No Matches
juce_MPENote.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
struct JUCE_API MPENote
{
//==============================================================================
enum KeyState
{
off = 0,
keyDown = 1,
sustained = 2,
keyDownAndSustained = 3
};
//==============================================================================
MPENote (int midiChannel,
int initialNote,
MPEValue velocity,
MPEValue pitchbend,
MPEValue pressure,
MPEValue timbre,
KeyState keyState = MPENote::keyDown) noexcept;
MPENote() noexcept;
bool isValid() const noexcept;
//==============================================================================
// Invariants that define the note.
uint16 noteID = 0;
uint8 midiChannel = 0;
uint8 initialNote = 0;
//==============================================================================
// The five dimensions of continuous expressive control
MPEValue noteOnVelocity { MPEValue::minValue() };
MPEValue pitchbend { MPEValue::centreValue() };
MPEValue pressure { MPEValue::centreValue() };
MPEValue initialTimbre { MPEValue::centreValue() };
MPEValue timbre { MPEValue::centreValue() };
MPEValue noteOffVelocity { MPEValue::minValue() };
//==============================================================================
double totalPitchbendInSemitones;
KeyState keyState { MPENote::off };
//==============================================================================
double getFrequencyInHertz (double frequencyOfA = 440.0) const noexcept;
bool operator== (const MPENote& other) const noexcept;
bool operator!= (const MPENote& other) const noexcept;
};
} // namespace juce
juce::MPEValue
Definition juce_MPEValue.h:37
juce::MPEValue::centreValue
static MPEValue centreValue() noexcept
Definition juce_MPEValue.cpp:60
juce::MPEValue::minValue
static MPEValue minValue() noexcept
Definition juce_MPEValue.cpp:59
juce::MPENote
Definition juce_MPENote.h:40
juce::MPENote::KeyState
KeyState
Definition juce_MPENote.h:44
juce::MPENote::keyDown
@ keyDown
Definition juce_MPENote.h:46
juce::MPENote::off
@ off
Definition juce_MPENote.h:45
juce::MPENote::keyDownAndSustained
@ keyDownAndSustained
Definition juce_MPENote.h:48
juce::MPENote::sustained
@ sustained
Definition juce_MPENote.h:47
juce::MPENote::noteID
uint16 noteID
Definition juce_MPENote.h:98
juce::MPENote::noteOnVelocity
MPEValue noteOnVelocity
Definition juce_MPENote.h:116
juce::MPENote::timbre
MPEValue timbre
Definition juce_MPENote.h:144
juce::MPENote::pitchbend
MPEValue pitchbend
Definition juce_MPENote.h:128
juce::MPENote::initialNote
uint8 initialNote
Definition juce_MPENote.h:108
juce::MPENote::pressure
MPEValue pressure
Definition juce_MPENote.h:133
juce::MPENote::initialTimbre
MPEValue initialTimbre
Definition juce_MPENote.h:138
juce::MPENote::totalPitchbendInSemitones
double totalPitchbendInSemitones
Definition juce_MPENote.h:164
juce::MPENote::midiChannel
uint8 midiChannel
Definition juce_MPENote.h:103
juce::MPENote::noteOffVelocity
MPEValue noteOffVelocity
Definition juce_MPENote.h:152
juce::MPENote::keyState
KeyState keyState
Definition juce_MPENote.h:169
juce::MPENote::MPENote
MPENote(int midiChannel, int initialNote, MPEValue velocity, MPEValue pitchbend, MPEValue pressure, MPEValue timbre, KeyState keyState=MPENote::keyDown) noexcept
Definition juce_MPENote.cpp:38