3232#include " Renderer/TextureManager.hpp"
3333#include " Renderer/TransitionShaderManager.hpp"
3434
35- #if PROJECTM_USE_THREADS
36- #include " libprojectM/BackgroundWorker.hpp"
37- #endif
38-
3935namespace libprojectM {
4036
4137ProjectM::ProjectM ()
4238 : m_presetFactoryManager(std::make_unique<PresetFactoryManager>())
43- #if PROJECTM_USE_THREADS
44- , m_workerSync(std::make_unique<BackgroundWorkerSync>())
45- #endif
4639{
4740 Initialize ();
4841}
4942
5043ProjectM::~ProjectM ()
5144{
52- #if PROJECTM_USE_THREADS
53- m_workerSync->FinishUp ();
54- m_workerThread.join ();
55- #endif
45+ // Can't use "=default" in the header due to unique_ptr requiring the actual type declarations.
5646}
5747
5848void ProjectM::PresetSwitchRequestedEvent (bool ) const
@@ -113,22 +103,6 @@ void ProjectM::ResetTextures()
113103 m_textureManager = std::make_unique<Renderer::TextureManager>(m_textureSearchPaths);
114104}
115105
116- #if PROJECTM_USE_THREADS
117-
118- void ProjectM::ThreadWorker ()
119- {
120- while (true )
121- {
122- if (!m_workerSync->WaitForWork ())
123- {
124- return ;
125- }
126- m_workerSync->FinishedWork ();
127- }
128- }
129-
130- #endif
131-
132106void ProjectM::RenderFrame ()
133107{
134108 // Don't render if window area is zero.
@@ -137,10 +111,6 @@ void ProjectM::RenderFrame()
137111 return ;
138112 }
139113
140- #if PROJECTM_USE_THREADS
141- std::lock_guard<std::recursive_mutex> guard (m_presetSwitchMutex);
142- #endif
143-
144114 // Update FPS and other timer values.
145115 m_timeKeeper->UpdateTimers ();
146116
@@ -181,12 +151,6 @@ void ProjectM::RenderFrame()
181151
182152 if (m_timeKeeper->IsSmoothing () && m_transitioningPreset != nullptr )
183153 {
184- #if PROJECTM_USE_THREADS
185- m_workerSync->WakeUpBackgroundTask ();
186- // FIXME: Instead of waiting after a single render pass, check every frame if it's done.
187- m_workerSync->WaitForBackgroundTaskToFinish ();
188- #endif
189-
190154 // ToDo: check if new preset is loaded.
191155
192156 if (m_timeKeeper->SmoothRatio () >= 1.0 )
@@ -256,11 +220,6 @@ void ProjectM::Initialize()
256220
257221 LoadIdlePreset ();
258222
259- #if PROJECTM_USE_THREADS
260- m_workerSync->Reset ();
261- m_workerThread = std::thread (&ProjectM::ThreadWorker, this );
262- #endif
263-
264223 m_timeKeeper->StartPreset ();
265224}
266225
0 commit comments