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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_MidiNoteDispatcher.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 ~MidiNoteDispatcher() override;
19
20 //==============================================================================
21 void setMidiDeviceList (const juce::OwnedArray<MidiOutputDeviceInstance>&);
22
23 void dispatchPendingMessagesForDevices (TimePosition editTime);
24
25 void masterTimeUpdate (TimePosition editTime);
26 void prepareToPlay (TimePosition editTime);
27
28 void hiResTimerCallback() override;
29
30private:
31 //==============================================================================
32 struct DeviceState
33 {
34 DeviceState (MidiOutputDeviceInstance& d) : device (d) {}
35
37 MidiMessageArray buffer;
38 };
39
40 //==============================================================================
42 mutable RealTimeSpinLock timeLock;
43 std::shared_mutex deviceMutex;
44 TimePosition masterTime;
45 double hiResClockOfMasterTime = 0;
46
47 TimePosition getCurrentTime() const;
48 void dispatchPendingMessages (DeviceState&, TimePosition editTime);
49
51};
52
53}} // namespace tracktion { inline namespace engine
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)
Represents a position in real-life time.