fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
MidiEvent.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic synthesis toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include <juce_audio_basics/juce_audio_basics.h>
24
25namespace fsh::synth
26{
31{
32public:
34 enum class Type
35 {
36 NoteOff = 0x80,
37 NoteOn = 0x90,
38 PitchBend = 0xE0,
39 };
40
42 explicit MidiEvent(const juce::MidiMessageMetadata&);
43
45 auto type() const -> Type;
46
48 auto data1() const -> uint8_t;
49
51 auto data2() const -> uint8_t;
52
54 auto fullData() const -> uint16_t;
55
56private:
57 Type _type;
58 uint8_t _lsb = 0;
59 uint8_t _msb = 0;
60};
61} // namespace fsh::synth
Represents a MIDI event, such as a note on/off or pitch bend.
Definition MidiEvent.h:31
auto type() const -> Type
Returns the MIDI event type. This may not necessarily be a valid enum element.
Definition MidiEvent.cpp:36
auto data1() const -> uint8_t
Returns the first data byte (7 bits) of the MIDI event.
Definition MidiEvent.cpp:41
Type
MIDI event type.
Definition MidiEvent.h:35
@ NoteOn
Note on event. data1() = note value, data2() = velocity.
@ NoteOff
Note off event. data1() = note value, data2() = velocity.
@ PitchBend
Pitch bend event. fullData() = pitch bend value.
MidiEvent(const juce::MidiMessageMetadata &)
Create a MIDI event from a juce::MidiMessageMetadata object.
Definition MidiEvent.cpp:26
auto fullData() const -> uint16_t
Returns both data1() and data2() as a single 14-bit value.
Definition MidiEvent.cpp:51
auto data2() const -> uint8_t
Returns the second data byte (7 bits) of the MIDI event.
Definition MidiEvent.cpp:46