From b96ad25575d6bd38a104d4c4d86d2898255e97a7 Mon Sep 17 00:00:00 2001
From: ferrari <maxence.ferrari@gmail.com>
Date: Thu, 5 May 2022 12:15:05 +0200
Subject: [PATCH] update additional datablock size

---
 src/recorder.cpp | 4 ++--
 src/recorder.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/recorder.cpp b/src/recorder.cpp
index bae6592..b16869b 100644
--- a/src/recorder.cpp
+++ b/src/recorder.cpp
@@ -176,8 +176,8 @@ void JasonRecorder::get_samples(std::vector<std::uint8_t> &samples, bool planar,
             else if ((((std::uint16_t) buffer[1] << 8 )|(buffer[2])) == DATA_ID) {
                 // find the beginning and length of the samples in the buffer
                 size_t start = this->addtional_data_size + 6;
-                size_t num_samples = (received - start) /this->depth;
-                num_samples = (num_samples / num_channels) * num_channels * this->depth;
+                size_t num_samples = (received - start);
+                num_samples = (num_samples / (num_channels * this->depth)) * num_channels * this->depth;
                 // copy data to provided vector
                 if (planar || (num_channels == 1)) {
                     // copy out directly
diff --git a/src/recorder.h b/src/recorder.h
index a1654aa..0979cd1 100644
--- a/src/recorder.h
+++ b/src/recorder.h
@@ -65,7 +65,7 @@ private:
     size_t receive_message(uint8_t *buffer, size_t max_wait = 0);
 
     // device state, as far as known
-    size_t addtional_data_size = 1024;
+    size_t addtional_data_size = 730;
     std::uint8_t num_channels = 0;
     std::uint8_t depth = 0;
     std::uint8_t num_filter = 0;
-- 
GitLab