Skip to content

Commit d91f441

Browse files
committed
Fix 4096 sample discrepancy between binary data and timestamp files
1 parent e659df5 commit d91f441

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

Source/Processors/RecordNode/BinaryFormat/FileMemoryBlock.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,30 @@ class FileMemoryBlock
88
m_data(blockSize, true),
99
m_file(file),
1010
m_blockSize(blockSize),
11-
m_offset(offset)
11+
m_offset(offset),
12+
m_finalFlushSamples(blockSize)
1213
{};
1314

1415
~FileMemoryBlock() {
1516
if (~m_flushed)
1617
{
17-
m_file->write(m_data, m_blockSize*sizeof(StorageType));
18+
m_file->write(m_data, m_finalFlushSamples*sizeof(StorageType));
1819
}
1920
};
2021

2122
inline uint64 getOffset() { return m_offset; }
2223
inline StorageType* getData() { return m_data.getData(); }
23-
void partialFlush(size_t size, bool markFlushed = true)
24+
void partialFlush(size_t size)
2425
{
25-
//std::cout << "[RN] flushing last block " << size << std::endl;
26-
m_file->write(m_data, size*sizeof(StorageType));
27-
if (markFlushed)
28-
m_flushed = true;
26+
m_finalFlushSamples = size;
2927
}
3028

3129
private:
3230
HeapBlock<StorageType> m_data;
3331
FileOutputStream* const m_file;
3432
const int m_blockSize;
3533
const uint64 m_offset;
34+
size_t m_finalFlushSamples;
3635
bool m_flushed{ false };
3736
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FileMemoryBlock);
38-
};
37+
};

0 commit comments

Comments
 (0)