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 "span.hh"
7 #include <vector>
8 
9 namespace openmsx {
10 
11 class CliComm;
12 class Filename;
13 class FilePool;
14 
18 class CasImage final : public CassetteImage
19 {
20 public:
21  CasImage(const Filename& fileName, FilePool& filePool, CliComm& cliComm);
22 
23  // CassetteImage
24  int16_t getSampleAt(EmuTime::param time) override;
25  EmuTime getEndTime() const override;
26  unsigned getFrequency() const override;
27  void fillBuffer(unsigned pos, int** bufs, unsigned num) const override;
28 
29 private:
30  void write0();
31  void write1();
32  void writeHeader(int s);
33  void writeSilence(int s);
34  void writeByte(byte b);
35  bool writeData(span<byte> buf, size_t& pos);
36  void convert(const Filename& filename, FilePool& filePool, CliComm& cliComm);
37 
38  std::vector<signed char> output;
39 };
40 
41 } // namespace openmsx
42 
43 #endif
Code based on "cas2wav" tool by Vincent van Dam.
Definition: CasImage.hh:18
Definition: span.hh:34
uint8_t byte
8 bit unsigned integer
Definition: openmsx.hh:26
int16_t getSampleAt(EmuTime::param time) override
Definition: CasImage.cc:58
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:77
EmuTime getEndTime() const override
Definition: CasImage.cc:65
unsigned getFrequency() const override
Definition: CasImage.cc:72
CasImage(const Filename &fileName, FilePool &filePool, CliComm &cliComm)
Definition: CasImage.cc:52