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, float** bufs, unsigned num) const override;
28  float getAmplificationFactorImpl() const override;
29 
30 private:
31  void write0();
32  void write1();
33  void writeHeader(int s);
34  void writeSilence(int s);
35  void writeByte(byte b);
36  bool writeData(span<byte> buf, size_t& pos);
37  void convert(const Filename& filename, FilePool& filePool, CliComm& cliComm);
38 
39  std::vector<signed char> output;
40 };
41 
42 } // namespace openmsx
43 
44 #endif
openmsx.hh
openmsx::CassetteImage
Definition: CassetteImage.hh:12
openmsx::CasImage::getEndTime
EmuTime getEndTime() const override
Definition: CasImage.cc:65
span
Definition: span.hh:34
openmsx::filename
constexpr const char *const filename
Definition: FirmwareSwitch.cc:10
openmsx::CasImage::getAmplificationFactorImpl
float getAmplificationFactorImpl() const override
Definition: CasImage.cc:92
CassetteImage.hh
span.hh
openmsx::CasImage::fillBuffer
void fillBuffer(unsigned pos, float **bufs, unsigned num) const override
Definition: CasImage.cc:77
openmsx::Filename
Filename
Definition: Filename.cc:50
openmsx::CliComm
Definition: CliComm.hh:11
openmsx::FilePool
Definition: FilePool.hh:26
openmsx::CasImage::getFrequency
unsigned getFrequency() const override
Definition: CasImage.cc:72
openmsx::CasImage::getSampleAt
int16_t getSampleAt(EmuTime::param time) override
Definition: CasImage.cc:58
openmsx::Filename
This class represents a filename.
Definition: Filename.hh:18
openmsx::CasImage
Code based on "cas2wav" tool by Vincent van Dam.
Definition: CasImage.hh:19
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::CasImage::CasImage
CasImage(const Filename &fileName, FilePool &filePool, CliComm &cliComm)
Definition: CasImage.cc:52