JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_TimeSliceThread.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26class TimeSliceThread;
27
28
29//==============================================================================
43class JUCE_API TimeSliceClient
44{
45public:
47 virtual ~TimeSliceClient() = default;
48
64 virtual int useTimeSlice() = 0;
65
66
67private:
68 friend class TimeSliceThread;
69 Time nextCallTime;
70};
71
72
73//==============================================================================
82class JUCE_API TimeSliceThread : public Thread
83{
84public:
85 //==============================================================================
92 explicit TimeSliceThread (const String& threadName);
93
101 ~TimeSliceThread() override;
102
103 //==============================================================================
108 void addTimeSliceClient (TimeSliceClient* clientToAdd, int millisecondsBeforeStarting = 0);
109
114 void moveToFrontOfQueue (TimeSliceClient* clientToMove);
115
120 void removeTimeSliceClient (TimeSliceClient* clientToRemove);
121
126 void removeAllClients();
127
129 int getNumClients() const;
130
132 TimeSliceClient* getClient (int index) const;
133
135 bool contains (const TimeSliceClient*) const;
136
137 //==============================================================================
138 #ifndef DOXYGEN
139 void run() override;
140 #endif
141
142 //==============================================================================
143private:
144 CriticalSection callbackLock, listLock;
146 TimeSliceClient* clientBeingCalled = nullptr;
147
148 TimeSliceClient* getNextClient (int index) const;
149
151};
152
153} // namespace juce
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
The JUCE String class!
Definition juce_String.h:53
Encapsulates a thread.
Definition juce_Thread.h:43
Used by the TimeSliceThread class.
virtual int useTimeSlice()=0
Called back by a TimeSliceThread.
virtual ~TimeSliceClient()=default
Destructor.
A thread that keeps a list of clients, and calls each one in turn, giving them all a chance to run so...
Holds an absolute date and time.
Definition juce_Time.h:37
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.