| 1 |
#ifndef CASSETTEIMAGE_HH |
| 2 |
#define CASSETTEIMAGE_HH |
| 3 |
|
| 4 |
#include "EmuTime.hh" |
| 5 |
#include "sha1.hh" |
| 6 |
|
| 7 |
#include <cstdint> |
| 8 |
#include <span> |
| 9 |
#include <string> |
| 10 |
|
| 11 |
namespace openmsx { |
| 12 |
|
| 13 |
class Filename; |
| 14 |
|
| 15 |
class CassetteImage |
| 16 |
{ |
| 17 |
public: |
| 18 |
enum class FileType : uint8_t { ASCII, BINARY, BASIC, UNKNOWN }; |
| 19 |
|
| 20 |
virtual ~CassetteImage() = default; |
| 21 |
[[nodiscard]] virtual int16_t getSampleAt(EmuTime time) const = 0; |
| 22 |
[[nodiscard]] virtual EmuTime getEndTime() const = 0; |
| 23 |
[[nodiscard]] virtual unsigned getFrequency() const = 0; |
| 24 |
virtual void fillBuffer(unsigned pos, std::span<float*, 1> bufs, unsigned num) const = 0; |
| 25 |
[[nodiscard]] virtual float getAmplificationFactorImpl() const = 0; |
| 26 |
|
| 27 |
[[nodiscard]] FileType getFirstFileType() const { return firstFileType; } |
| 28 |
[[nodiscard]] std::string getFirstFileTypeAsString() const; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
[[nodiscard]] const Sha1Sum& getSha1Sum() const; |
| 38 |
|
| 39 |
protected: |
| 40 |
CassetteImage() = default; |
| 41 |
|
| 42 |
|
| 43 |
void setFirstFileType(FileType type, const Filename& fileName); |
| 44 |
void setSha1Sum(const Sha1Sum& sha1sum); |
| 45 |
|
| 46 |
private: |
| 47 |
FileType firstFileType = FileType::UNKNOWN; |
| 48 |
Sha1Sum sha1sum; |
| 49 |
}; |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
#endif |