diff --git a/AdidatCLI/AdidatCLI/NativeWriter.cpp b/AdidatCLI/AdidatCLI/NativeWriter.cpp index e5843cb633c2029c9c613ffcad1ce9fc104f6c48..4d8aee818afa07e460efe3bac248cd8398739226 100644 --- a/AdidatCLI/AdidatCLI/NativeWriter.cpp +++ b/AdidatCLI/AdidatCLI/NativeWriter.cpp @@ -78,14 +78,16 @@ void NativeWriter::AddRecord(std::vector<std::vector<float>> data) { chunkSize = OPTIMAL_CHUNK_SIZE; } + long samplesAddedInStep = 0; for (size_t channel = 0; channel < data.size(); channel++) { // Write it long writtenSamples = 0; checkResult(ADI_AddChannelSamples(_writerHandle, static_cast<long>(channel), data[channel].data() + samplesAdded, chunkSize, &writtenSamples)); // Weird but once the chunk is written to the first channel, all other channels will retunr writtenSamples = 0 :( - samplesAdded += writtenSamples; + samplesAddedInStep += writtenSamples; } + samplesAdded += samplesAddedInStep; } // Close the record