File tree Expand file tree Collapse file tree
Source/Processors/RecordNode
Tests/TestHelpers/include Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -946,7 +946,7 @@ void RecordNode::notifyRecordThreadFilesOpened()
946946// called by GenericProcessor::setRecording() and CoreServices::setRecordingStatus()
947947void RecordNode::stopRecording ()
948948{
949- if (! isRecording)
949+ if (! isRecording && !recordThread-> isThreadRunning () )
950950 return ;
951951
952952 isRecording = false ;
Original file line number Diff line number Diff line change @@ -153,6 +153,8 @@ void RecordThread::run()
153153 wait (1 );
154154 }
155155
156+ LOGD (" RecordThread received first block, starting main loop..." );
157+
156158 // 3 - Get initial sample numbers from each stream's queue
157159 int globalChan = 0 ;
158160 for (int streamIdx = 0 ; streamIdx < numStreams; streamIdx++)
Original file line number Diff line number Diff line change 55
66#include < Audio/AudioComponent.h>
77#include < Processors/ProcessorGraph/ProcessorGraph.h>
8+ #include < Processors/RecordNode/RecordNode.h>
89#include < Processors/SourceNode/SourceNode.h>
910#include < UI/ControlPanel.h>
1011#include < juce_audio_processors/juce_audio_processors.h>
@@ -162,6 +163,30 @@ class ProcessorTester
162163 {
163164 // Do it this way to ensure the GUI elements (which apparently control logic) are set properly
164165 controlPanel->setRecordingState (true , forceRecording);
166+
167+ // RecordNode::notifyRecordThreadFilesOpened() sets isRecording=true via
168+ // MessageManager::callAsync. Since tests run on the message thread, that callback
169+ // is only dispatched when we explicitly pump the message loop. Pump until all
170+ // record nodes report they are actively recording before returning.
171+ const int timeoutMs = 5000 ;
172+ for (int elapsed = 0 ; elapsed < timeoutMs; elapsed += 10 )
173+ {
174+ juce::MessageManager::getInstance ()->runDispatchLoopUntil (10 );
175+
176+ bool allReady = true ;
177+ for (auto * rn : processorGraph->getRecordNodes ())
178+ {
179+ if (! rn->getRecordingStatus ())
180+ {
181+ allReady = false ;
182+ break ;
183+ }
184+ }
185+ if (allReady)
186+ {
187+ break ;
188+ }
189+ }
165190 }
166191 else
167192 {
You can’t perform that action at this time.
0 commit comments