openMSX
CasImage.hh
Go to the documentation of this file.
1 #ifndef CASIMAGE_HH
2 #define CASIMAGE_HH
3 
4 #include "CassetteImage.hh"
5 #include "openmsx.hh"
6 #include <vector>
7 
8 namespace openmsx {
9 
10 class CliComm;
11 class Filename;
12 class FilePool;
13 
17 class CasImage final : public CassetteImage
18 {
19 public:
20  CasImage(const Filename& fileName, FilePool& filePool, CliComm& cliComm);
21 
22  // CassetteImage
23  int16_t getSampleAt(EmuTime::param time) override;
24  EmuTime getEndTime() const override;
25  unsigned getFrequency() const override;
26  void fillBuffer(unsigned pos, int** bufs, unsigned num) const override;
27 
28 private:
29  void write0();
30  void write1();
31  void writeHeader(int s);
32  void writeSilence(int s);
33  void writeByte(byte b);
34  bool writeData(const byte* buf, size_t size, size_t& pos);
35  void convert(const Filename& filename, FilePool& filePool, CliComm& cliComm);
36 
37  std::vector<signed char> output;
38 };
39 
40 } // namespace openmsx
41 
42 #endif
Code based on "cas2wav" tool by Vincent van Dam.
Definition: CasImage.hh:17
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
size_t size(string_view utf8)
int16_t getSampleAt(EmuTime::param time) override
Definition: CasImage.cc:57
This class represents a filename.
Definition: Filename.hh:17
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void fillBuffer(unsigned pos, int **bufs, unsigned num) const override
Definition: CasImage.cc:76
EmuTime getEndTime() const override
Definition: CasImage.cc:64
unsigned getFrequency() const override
Definition: CasImage.cc:71
CasImage(const Filename &fileName, FilePool &filePool, CliComm &cliComm)
Definition: CasImage.cc:51