Skip to content

Commit 4c67031

Browse files
committed
Enable Record Node subprocessor fifo monitors
1 parent 9f2ffa2 commit 4c67031

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

Source/Processors/RecordNode/DataQueue.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void DataQueue::fillTimestamps(int channel, int index, int size, int64 timestamp
134134
}
135135
}
136136

137-
void DataQueue::writeSynchronizedTimestampChannel(double start, double step, int destChannel, int64 nSamples)
137+
float DataQueue::writeSynchronizedTimestampChannel(double start, double step, int destChannel, int64 nSamples)
138138
{
139139

140140
int index1, size1, index2, size2;
@@ -169,6 +169,8 @@ void DataQueue::writeSynchronizedTimestampChannel(double start, double step, int
169169

170170
m_FTSFifos[destChannel]->finishedWrite(size1 + size2);
171171

172+
return 1.0f - (float)m_FTSFifos[destChannel]->getFreeSpace() / (float)m_FTSFifos[destChannel]->getTotalSize();
173+
172174
}
173175

174176

Source/Processors/RecordNode/DataQueue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class DataQueue
5050
//Only the methods after this comment are considered thread-safe.
5151
//Caution must be had to avoid calling more than one of the methods above simulatenously
5252
void writeChannel(const AudioSampleBuffer& buffer, int srcChannel, int destChannel, int nSamples, int64 timestamp);
53-
void writeSynchronizedTimestampChannel(double start, double step, int destChannel, int64 nSamples);
53+
float writeSynchronizedTimestampChannel(double start, double step, int destChannel, int64 nSamples);
5454
bool startRead(Array<CircularBufferIndexes>& indexes, Array<int64>& timestamps, int nMax);
5555
bool startSynchronizedRead(Array<CircularBufferIndexes>& dataIndexes, Array<CircularBufferIndexes>& ftsIndexes, Array<int64>& timestamps, int nMax);
5656
const AudioSampleBuffer& getAudioBufferReference() const;

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ void RecordNode::updateSubprocessorMap()
302302
ch++;
303303
}
304304
ch--;
305+
306+
fifoUsage[sourceID][subProcID] = 0.0f;
305307
}
306308

307309
}
@@ -642,7 +644,7 @@ void RecordNode::process(AudioSampleBuffer& buffer)
642644
{
643645
double first = synchronizer->convertTimestamp(sourceID, subProcIdx, timestamp);
644646
double second = synchronizer->convertTimestamp(sourceID, subProcIdx, timestamp + 1);
645-
dataQueue->writeSynchronizedTimestampChannel(first, second - first, ftsChannelMap[ch], numSamples);
647+
fifoUsage[sourceID][subProcIdx] = dataQueue->writeSynchronizedTimestampChannel(first, second - first, ftsChannelMap[ch], numSamples);
646648
}
647649

648650
dataQueue->writeChannel(buffer, channelMap[ch], ch, numSamples, timestamp);

Source/Processors/RecordNode/RecordNode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class RecordNode : public GenericProcessor, public FilenameComponentListener
115115
std::map<int, std::map<int, int>> syncChannelMap;
116116
std::map<int, std::map<int, int>> syncOrderMap;
117117

118+
std::map<int, std::map<int, float>> fifoUsage;
119+
118120
Array<int> channelMap; //Map from record channel index to source channel index
119121
Array<int> ftsChannelMap; // Map from recorded channel index to recorded source processor idx
120122
std::vector<std::vector<int>> subProcessorMap;

Source/Processors/RecordNode/RecordNodeEditor.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -667,22 +667,16 @@ void FifoMonitor::componentBeingDeleted(Component &component)
667667

668668
void FifoMonitor::timerCallback()
669669
{
670-
671-
if (recordNode->recordThread->isThreadRunning())
672-
{
673-
//TODO: Get metric from recordThread
674-
setFillPercentage(0.0f);
675-
}
676-
else
677-
{
678-
setFillPercentage(0.0f);
679-
}
680670

681-
if (srcID < 0)
671+
if (srcID < 0) /* Disk space monitor */
682672
{
683673
float diskSpace = (float)recordNode->getDataDirectory().getBytesFreeOnVolume() / recordNode->getDataDirectory().getVolumeTotalSize();
684674
setFillPercentage(1.0f - diskSpace);
685675
}
676+
else /* Subprocessor monitor */
677+
{
678+
setFillPercentage(recordNode->fifoUsage[srcID][subID]);
679+
}
686680

687681
}
688682

0 commit comments

Comments
 (0)