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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_PhysicalMidiInputDevice.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:
18 ~PhysicalMidiInputDevice() override;
19
21
22 void setReadingMidiTimecode (bool);
23 void setIgnoresHours (bool);
24 bool isIgnoringHours() const noexcept { return ignoreHours; }
25
26 void setAcceptingMMC (bool);
27 void setReadingControllerMessages (bool);
28 bool isAvailableToEdit() const override;
29
32 void removeExternalController (ExternalController*);
33
34 bool isUsedForExternalControl() const { return externalController != nullptr; }
35
36 using MidiInputDevice::handleIncomingMidiMessage;
37 void handleIncomingMidiMessage (const juce::MidiMessage&) override;
38
39 void loadProps() override;
40 void saveProps() override;
41
42 DeviceType getDeviceType() const override { return InputDevice::physicalMidiDevice; }
43
44 bool isTakingControllerMessages = true;
45
47 {
48 public:
49 virtual ~Listener() {}
50
51 virtual void handleIncomingMidiMessage (const juce::MidiMessage&) {}
52 };
53
54 void addListener (Listener* l)
55 {
56 const std::scoped_lock sl (listenerLock);
57 listeners.add (l);
58 }
59
60 void removeListener (Listener* l)
61 {
62 const std::scoped_lock sl (listenerLock);
63 listeners.remove (l);
64 }
65
66 juce::String openDevice() override;
67 void closeDevice() override;
68
69private:
70 void handleIncomingMidiMessageInt (const juce::MidiMessage&);
71
73 juce::MidiDeviceInfo deviceInfo;
75
77 ExternalController* externalController = nullptr;
78 bool isReadingMidiTimecode = false, isAcceptingMMC = false, ignoreHours = false;
79
80 bool tryToSendTimecode (const juce::MidiMessage&);
81
82 ActiveNoteList activeNotes;
83
84 RealTimeSpinLock listenerLock;
86
88};
89
90}} // namespace tracktion { inline namespace engine
The Engine is the central class for all tracktion sessions.
Acts as a holder for a ControlSurface object.
An instance of an InputDevice that's available to an Edit.
DeviceType
enum to allow quick querying of the device type.
void setExternalController(ExternalController *)
sets the external controller to send the messages to.
InputDeviceInstance * createInstance(EditPlaybackContext &) override
Creates an instance to use for a given playback context.
A basic spin lock that uses an atomic_flag to store the locked state so should never result in a syst...
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)