Skip to content

Commit

Permalink
Correct estimated capture time in C8 format (#1330)
Browse files Browse the repository at this point in the history
* Correct capture time remaining for C8 format

* Removed unsupported RawS32 type

* Clang
  • Loading branch information
NotherNgineer committed Jul 31, 2023
1 parent 91c6e3f commit a24b3ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 6 additions & 1 deletion firmware/application/ui_record_view.cpp
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions firmware/application/ui_record_view.hpp
Expand Up @@ -42,8 +42,7 @@ class RecordView : public View {
enum FileType {
RawS8 = 1,
RawS16 = 2,
RawS32 = 3,
WAV = 4,
WAV = 3,
};

RecordView(
Expand Down

0 comments on commit a24b3ad

Please sign in to comment.