Krotos Modules 3
Loading...
Searching...
No Matches
Convolver.cpp
Go to the documentation of this file.
1namespace krotos
2{
3 class ConvolverBackgroundThread : public Thread
4 {
5 public:
7 : Thread("ConvolverBackgroundThread"), m_convolver(convolver)
8 {
9 startThread(); // Use a priority higher than the priority of normal threads
10 }
11
13 {
14 signalThreadShouldExit();
15 notify();
16 stopThread(1000);
17 }
18
19 virtual void run()
20 {
21 while (!threadShouldExit())
22 {
23 wait(-1);
24 if (threadShouldExit())
25 {
26 return;
27 }
31 }
32 }
33
34 private:
36
37 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ConvolverBackgroundThread)
38 };
39
40 Convolver::Convolver() : m_backgroundProcessingFinished(1), m_backgroundProcessingFinishedEvent(true)
41 {
42 m_thread.reset(new ConvolverBackgroundThread(*this));
44 }
45
47
54
56} // namespace krotos
void doBackgroundProcessing()
Actually performs the background processing work.
Definition TwoStageFFTConvolver.cpp:198
Definition Convolver.cpp:4
ConvolverBackgroundThread(Convolver &convolver)
Definition Convolver.cpp:6
Convolver & m_convolver
Definition Convolver.cpp:35
virtual ~ConvolverBackgroundThread()
Definition Convolver.cpp:12
virtual void run()
Definition Convolver.cpp:19
Definition Convolver.h:4
WaitableEvent m_backgroundProcessingFinishedEvent
Definition Convolver.h:18
virtual void waitForBackgroundProcessing()
Called by the convolver if it expects the result of its previous call to startBackgroundProcessing()
Definition Convolver.cpp:55
friend class ConvolverBackgroundThread
Definition Convolver.h:14
std::unique_ptr< juce::Thread > m_thread
Definition Convolver.h:16
virtual void startBackgroundProcessing()
Method called by the convolver if work for background processing is available.
Definition Convolver.cpp:48
virtual ~Convolver()
Definition Convolver.cpp:46
Convolver()
Definition Convolver.cpp:40
std::atomic< uint32 > m_backgroundProcessingFinished
Definition Convolver.h:17
Definition AirAbsorptionFilter.cpp:2