mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-13 08:55:39 -04:00
C8 capture support (#1286)
* C8 conversion * C8 conversion * C8 support * C8 support * C8 support * C8 support * Don't auto-convert GPS C8 files * C8 support * C8 support * C8 support * Remove hang workaround (different PR) * Comment change * Clang * Clang * Clang * Merged change from PR #1287 * C8 support * C8 support * Improve bandwidth display * Merged minor optimization from PR 1289 * Merge change from PR 1289 * Use complex types for C8/C16 conversion * C8 support * C8 support * C8 support * C8 support * Roll back changes * Roll back C8 changes * C8 support * C8 support * C8 support * C8 support * C8 support * Don't transmit samples past EOF * Don't transmit samples past EOF * Clang * Clang attempt * Clang attempt * C8 support * Clang
This commit is contained in:
parent
8eafe27955
commit
d6b0173e7a
14 changed files with 300 additions and 44 deletions
81
firmware/application/io_convert.hpp
Normal file
81
firmware/application/io_convert.hpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (C) 2023 Mark Thompson
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "io_file.hpp"
|
||||
|
||||
#include "io.hpp"
|
||||
#include "file.hpp"
|
||||
#include "optional.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace file_convert {
|
||||
|
||||
void c8_to_c16(const void* buffer, File::Size bytes);
|
||||
void c32_to_c16(const void* buffer, File::Size bytes);
|
||||
void c16_to_c8(const void* buffer, File::Size bytes);
|
||||
|
||||
} /* namespace file_convert */
|
||||
|
||||
class FileConvertReader : public stream::Reader {
|
||||
public:
|
||||
FileConvertReader() = default;
|
||||
|
||||
FileConvertReader(const FileConvertReader&) = delete;
|
||||
FileConvertReader& operator=(const FileConvertReader&) = delete;
|
||||
FileConvertReader(FileConvertReader&& file) = delete;
|
||||
FileConvertReader& operator=(FileConvertReader&&) = delete;
|
||||
|
||||
Optional<File::Error> open(const std::filesystem::path& filename);
|
||||
|
||||
File::Result<File::Size> read(void* const buffer, const File::Size bytes) override;
|
||||
const File& file() const& { return file_; }
|
||||
|
||||
bool convert_c8_to_c16{};
|
||||
bool convert_c32_to_c16{};
|
||||
|
||||
protected:
|
||||
File file_{};
|
||||
uint64_t bytes_read_{0};
|
||||
};
|
||||
|
||||
class FileConvertWriter : public stream::Writer {
|
||||
public:
|
||||
FileConvertWriter() = default;
|
||||
|
||||
FileConvertWriter(const FileConvertWriter&) = delete;
|
||||
FileConvertWriter& operator=(const FileConvertWriter&) = delete;
|
||||
FileConvertWriter(FileConvertWriter&& file) = delete;
|
||||
FileConvertWriter& operator=(FileConvertWriter&&) = delete;
|
||||
|
||||
Optional<File::Error> create(const std::filesystem::path& filename);
|
||||
|
||||
File::Result<File::Size> write(const void* const buffer, const File::Size bytes) override;
|
||||
const File& file() const& { return file_; }
|
||||
|
||||
bool convert_c16_to_c8{};
|
||||
|
||||
protected:
|
||||
File file_{};
|
||||
uint64_t bytes_written_{0};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue