tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_MidiControllerEvent.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
15{
16public:
17 static juce::ValueTree createControllerEvent (BeatPosition, int controllerType, int controllerValue);
18 static juce::ValueTree createControllerEvent (BeatPosition, int controllerType, int controllerValue, int metadata);
19 static juce::ValueTree createControllerEvent (const MidiControllerEvent&, BeatPosition);
20
23
24 //==============================================================================
25 int getControllerValue() const noexcept { return value; }
26 void setControllerValue (int newValue, juce::UndoManager*);
27
28 static int getControllerDefautValue (int type);
29
30 int getMetadata() const noexcept { return metadata; }
31 void setMetadata (int metaValue, juce::UndoManager*);
32
33 //==============================================================================
34 BeatPosition getBeatPosition() const noexcept { return beatNumber; }
35 void setBeatPosition (BeatPosition, juce::UndoManager*);
36
38 BeatPosition getEditBeats (const MidiClip&) const;
39 TimePosition getEditTime (const MidiClip&) const;
40
41 juce::String getLevelDescription (MidiClip*) const;
42
43 //==============================================================================
45 int getType() const noexcept { return type; }
46 void setType (int type, juce::UndoManager* um);
47
48 enum ExtraControllerTypes
49 {
50 programChangeType = 0x1001,
51 noteVelocities = 0x1003,
52 aftertouchType = 0x1004,
53 pitchWheelType = 0x1005,
54 sysExType = 0x1006, //< Really just here for MidiStrip editing
55 channelPressureType = 0x1007,
56
57 UnknownType = 0x7fffffff
58 };
59
60 static juce::String getControllerTypeName (int type) noexcept;
61
62 static int bankIDToCoarse (int id) { return (id & 0xff00) >> 8; }
63 static int bankIDToFine (int id) { return id & 0xff; }
64
65 juce::ValueTree state;
66
67private:
68 //==============================================================================
69 friend class MidiList;
70
71 BeatPosition beatNumber;
72 int type, value, metadata;
73
74 void updatePropertiesFromState() noexcept;
75
76 MidiControllerEvent() = delete;
77 MidiControllerEvent (const MidiControllerEvent&) = delete;
78
79 JUCE_LEAK_DETECTOR (MidiControllerEvent)
80};
81
82}} // namespace tracktion { inline namespace engine
int getType() const noexcept
Controller type, from the list below.
BeatPosition getEditBeats(const MidiClip &) const
This takes into account quantising, groove templates, clip offset, etc.
Represents a position in beats.
Represents a position in real-life time.