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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_SelectedMidiEvents.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
19{
20public:
23 ~SelectedMidiEvents() override;
24
25 Edit& getEdit();
26
27 //==============================================================================
28 MidiClip* clipForEvent (MidiNote*) const;
29 MidiClip* clipForEvent (MidiSysexEvent*) const;
30 MidiClip* clipForEvent (MidiControllerEvent*) const;
31
32 //==============================================================================
33 void addSelectedEvent (MidiNote*, bool addToCurrent);
34 void addSelectedEvent (MidiSysexEvent*, bool addToCurrent);
35 void addSelectedEvent (MidiControllerEvent*, bool addToCurrent);
36 void removeSelectedEvent (MidiNote*);
37 void removeSelectedEvent (MidiSysexEvent*);
38 void removeSelectedEvent (MidiControllerEvent*);
39 void setSelected (SelectionManager&, const juce::Array<MidiNote*>&, bool addToSelection, bool allowMixedSelection = false);
40 void setSelected (SelectionManager&, const juce::Array<MidiSysexEvent*>&, bool addToSelection, bool allowMixedSelection = false);
41 void setSelected (SelectionManager&, const juce::Array<MidiControllerEvent*>&, bool addToSelection, bool allowMixedSelection = false);
42 bool isSelected (const MidiNote*) const;
43 bool isSelected (const MidiSysexEvent*) const;
44 bool isSelected (const MidiControllerEvent*) const;
45
46 int getNumSelected() const { return selectedNotes.size() + selectedSysexes.size() + selectedControllers.size(); }
47 bool anythingSelected() const { return getNumSelected() != 0; }
48
49 const juce::Array<MidiNote*>& getSelectedNotes() const noexcept { return selectedNotes; }
50 const juce::Array<MidiSysexEvent*>& getSelectedSysexes() const noexcept { return selectedSysexes; }
51 const juce::Array<MidiControllerEvent*>& getSelectedControllers() const noexcept { return selectedControllers; }
52
53 //==============================================================================
54 void moveEvents (TimeDuration deltaStart, TimeDuration deltaLength, int deltaNote);
55 void setNoteLengths (BeatDuration newLength);
56 void setVelocities (int newVelocity);
57 void changeColour (uint8_t newColour);
58
59 void nudge (TimecodeSnapType, int leftRight, int upDown);
60
61 TimeRange getSelectedRange() const;
62
63 //==============================================================================
65 void selectionStatusChanged (bool isNowSelected) override;
66
67 const juce::Array<MidiClip*>& getClips() { return clips; }
68
69 void setClips (juce::Array<MidiClip*> clips);
70
74 static void moveControllerData (const juce::Array<MidiClip*>& clips, const juce::Array<MidiControllerEvent*>* onlyTheseEvents,
75 BeatDuration deltaBeats, TimePosition startTime, TimePosition endTime, bool makeCopy);
76
81
82private:
84
85 juce::Array<MidiNote*> selectedNotes;
86 juce::Array<MidiSysexEvent*> selectedSysexes;
87 juce::Array<MidiControllerEvent*> selectedControllers;
88
89 void sendSelectionChangedMessage (SelectionManager*);
90
91 bool contains (const MidiNote&) const noexcept;
92 bool contains (const MidiSysexEvent&) const noexcept;
93 bool contains (const MidiControllerEvent&) const noexcept;
94
96};
97
98}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
Base class for things that can be selected, and whose properties can appear in the properties panel.
Represents a set of selected MIDI notes.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
static void moveControllerData(const juce::Array< MidiClip * > &clips, const juce::Array< MidiControllerEvent * > *onlyTheseEvents, BeatDuration deltaBeats, TimePosition startTime, TimePosition endTime, bool makeCopy)
Moves all controller data in 'clips' between edit times.
std::function< bool()> shouldLockControllerToNotes
Host should set this callback to specify if it wants MIDI CC locked to MIDI notes when nudging.
void selectionStatusChanged(bool isNowSelected) override
Can be overridden to tell this object that it has just been selected or deselected.
Manages a list of items that are currently selected.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
typedef uint8_t
Represents a duration in beats.
Represents a duration in real-life time.
Represents a position in real-life time.