Skip to content

Commit cea2144

Browse files
committed
Merge branch 'development' into channel-map-fix
2 parents 86da866 + 2a80471 commit cea2144

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

Source/Processors/DataThreads/DataBuffer.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ DataBuffer::DataBuffer (int chans, int size)
3030
{
3131
timestampBuffer.malloc (size);
3232
eventCodeBuffer.malloc (size);
33+
34+
lastTimestamp = 0;
3335
}
3436

3537

@@ -40,6 +42,7 @@ void DataBuffer::clear()
4042
{
4143
buffer.clear();
4244
abstractFifo.reset();
45+
lastTimestamp = 0;
4346
}
4447

4548

@@ -50,6 +53,8 @@ void DataBuffer::resize (int chans, int size)
5053
timestampBuffer.malloc (size);
5154
eventCodeBuffer.malloc (size);
5255

56+
lastTimestamp = 0;
57+
5358
numChans = chans;
5459
}
5560

@@ -65,6 +70,9 @@ int DataBuffer::addToBuffer (float* data, int64* timestamps, uint64* eventCodes,
6570
int idx = 0;
6671
int blkIdx;
6772

73+
if (numItems > 0)
74+
lastTimestamp = timestamps[numItems-1];
75+
6876
for (int i = 0; bs[i] != 0; ++i)
6977
{ // for each of the dest blocks we can write to...
7078
blkIdx = 0;
@@ -89,6 +97,8 @@ int DataBuffer::addToBuffer (float* data, int64* timestamps, uint64* eventCodes,
8997
}
9098
}
9199

100+
101+
92102
// finish write
93103
abstractFifo.finishedWrite (idx);
94104

@@ -133,7 +143,7 @@ int DataBuffer::readAllFromBuffer (AudioSampleBuffer& data, uint64* timestamp, u
133143
}
134144
else
135145
{
136-
memcpy (timestamp, timestampBuffer + startIndex2, 8);
146+
memcpy(timestamp, &lastTimestamp, 8);
137147
}
138148

139149
if (blockSize2 > 0)

Source/Processors/DataThreads/DataBuffer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class PLUGIN_API DataBuffer
7272
HeapBlock<int64> timestampBuffer;
7373
HeapBlock<uint64> eventCodeBuffer;
7474

75+
int64 lastTimestamp;
76+
7577
int numChans;
7678

7779
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DataBuffer);

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ float RecordNode::getFreeSpace() const
448448

449449
void RecordNode::handleEvent(const EventChannel* eventInfo, const MidiMessage& event, int samplePosition)
450450
{
451-
if (isRecording)
451+
if (true)
452452
{
453453

454454
if ((*(event.getRawData()+0) & 0x80) == 0) // saving flag > 0 (i.e., event has not already been processed)
@@ -459,7 +459,8 @@ void RecordNode::handleEvent(const EventChannel* eventInfo, const MidiMessage& e
459459
eventIndex = getEventChannelIndex(Event::getSourceIndex(event), Event::getSourceID(event), Event::getSubProcessorIdx(event));
460460
else
461461
eventIndex = -1;
462-
m_eventQueue->addEvent(event, timestamp, eventIndex);
462+
if (isRecording)
463+
m_eventQueue->addEvent(event, timestamp, eventIndex);
463464
}
464465
}
465466
}

Source/Processors/RecordNode/RecordThread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void RecordThread::run()
8080
//1-Wait until the first block has arrived, so we can align the timestamps
8181
while (!m_receivedFirstBlock && !threadShouldExit())
8282
{
83-
wait(100);
83+
wait(1);
8484
}
8585

8686
//2-Open Files
@@ -145,7 +145,7 @@ void RecordThread::writeData(const AudioSampleBuffer& dataBuffer, int maxSamples
145145
uint16 sourceID = SystemEvent::getSourceID(event);
146146
uint16 subProcIdx = SystemEvent::getSubProcessorIdx(event);
147147
int64 timestamp = SystemEvent::getTimestamp(event);
148-
EVERY_ENGINE->writeTimestampSyncText(sourceID, subProcIdx, timestamp,
148+
EVERY_ENGINE->writeTimestampSyncText(sourceID, subProcIdx, timestamp,
149149
AccessClass::getProcessorGraph()->getRecordNode()->getSourceTimestamp(sourceID, subProcIdx),
150150
SystemEvent::getSyncText(event));
151151
}

Source/Processors/SourceNode/SourceNode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,15 @@ void SourceNode::process(AudioSampleBuffer& buffer)
356356
{
357357
int nSubs = dataThread->getNumSubProcessors();
358358
int copiedChannels = 0;
359+
359360
for (int sub = 0; sub < nSubs; sub++)
360361
{
361362
int channelsToCopy = getNumOutputs(sub);
363+
362364
int nSamples = inputBuffers[sub]->readAllFromBuffer(buffer, &timestamp, static_cast<uint64*>(eventCodeBuffers[sub]->getData()), buffer.getNumSamples(), copiedChannels, channelsToCopy);
363365
copiedChannels += channelsToCopy;
364366

365-
setTimestampAndSamples(timestamp, nSamples, sub);
367+
setTimestampAndSamples(timestamp, nSamples, sub);
366368

367369
if (ttlChannels[sub])
368370
{

0 commit comments

Comments
 (0)