From a24b3ad3dec9e81dec830b646898743437c27d8b Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Mon, 31 Jul 2023 10:02:11 -0500 Subject: [PATCH] Correct estimated capture time in C8 format (#1330) * Correct capture time remaining for C8 format * Removed unsupported RawS32 type * Clang --- firmware/application/ui_record_view.cpp | 7 ++++++- firmware/application/ui_record_view.hpp | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/firmware/application/ui_record_view.cpp b/firmware/application/ui_record_view.cpp index 3ce95fb4..8b7bf626 100644 --- a/firmware/application/ui_record_view.cpp +++ b/firmware/application/ui_record_view.cpp @@ -269,7 +269,12 @@ void RecordView::update_status_display() { if (sampling_rate) { const auto space_info = std::filesystem::space(u""); - const uint32_t bytes_per_second = file_type == FileType::WAV ? (sampling_rate * 2) : (sampling_rate / 8 * 4); // TODO: Why 8/4?? + const uint32_t bytes_per_second = + // - Audio is 1 int16_t per sample or '2' bytes per sample. + // - C8 captures 2 (I,Q) int8_t per sample or '2' bytes per sample. + // - C16 captures 2 (I,Q) int16_t per sample or '4' bytes per sample. + // Dividing to get actual sample rate because of decimation in proc_capture. + file_type == FileType::WAV ? (sampling_rate * 2) : (sampling_rate * ((file_type == FileType::RawS8) ? 2 : 4) / 8); const uint32_t available_seconds = space_info.free / bytes_per_second; const uint32_t seconds = available_seconds % 60; const uint32_t available_minutes = available_seconds / 60; diff --git a/firmware/application/ui_record_view.hpp b/firmware/application/ui_record_view.hpp index 16d00e38..9a3dc6f0 100644 --- a/firmware/application/ui_record_view.hpp +++ b/firmware/application/ui_record_view.hpp @@ -42,8 +42,7 @@ class RecordView : public View { enum FileType { RawS8 = 1, RawS16 = 2, - RawS32 = 3, - WAV = 4, + WAV = 3, }; RecordView(