1#ifndef CASSETTEPLAYER_HH
2#define CASSETTEPLAYER_HH
36 void setMotor(
bool status, EmuTime::param time)
override;
37 int16_t
readSample(EmuTime::param time)
override;
38 void setSignal(
bool output, EmuTime::param time)
override;
41 std::string_view
getName()
const override;
53 template<
typename Archive>
54 void serialize(Archive& ar,
unsigned version);
59 [[nodiscard]]
State getState()
const {
return state; }
60 [[nodiscard]] std::string getStateString()
const;
63 void setImageName(
const Filename& newImage);
64 const Filename& getImageName()
const {
return casImage; }
65 void checkInvariants()
const;
69 void playTape(
const Filename& filename, EmuTime::param time);
70 void insertTape(
const Filename& filename, EmuTime::param time);
74 void removeTape(EmuTime::param time);
79 void recordTape(
const Filename& filename, EmuTime::param time);
85 void rewind(EmuTime::param time);
89 void setMotorControl(
bool status, EmuTime::param time);
94 bool isRolling()
const;
100 void updateLoadingState(EmuTime::param time);
104 double getTapePos(EmuTime::param time);
110 double getTapeLength(EmuTime::param time);
112 void sync(EmuTime::param time);
116 void fillBuf(
size_t length,
double x);
121 int signalEvent(
const Event& event)
override;
127 void executeUntil(EmuTime::param time)
override {
129 cp.execEndOfTape(time);
135 void executeUntil(EmuTime::param time)
override {
137 cp.execSyncAudioEmu(time);
141 void execEndOfTape(EmuTime::param time);
142 void execSyncAudioEmu(EmuTime::param time);
143 EmuTime::param getCurrentTime()
const {
return syncEndOfTape.getCurrentTime(); }
145 std::array<uint8_t, 1024> buf;
150 double partialInterval;
153 EmuTime tapePos = EmuTime::zero();
157 EmuTime prevSyncTime = EmuTime::zero();
160 unsigned audioPos = 0;
163 MSXMotherBoard& motherBoard;
165 struct TapeCommand final : RecordedCommand {
166 TapeCommand(CommandController& commandController,
167 StateChangeDistributor& stateChangeDistributor,
169 void execute(std::span<const TclObject> tokens, TclObject& result,
170 EmuTime::param time)
override;
171 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
172 void tabCompletion(std::vector<std::string>& tokens)
const override;
173 [[nodiscard]]
bool needRecord(std::span<const TclObject> tokens)
const override;
176 LoadingIndicator loadingIndicator;
177 BooleanSetting autoRunSetting;
178 std::unique_ptr<Wav8Writer> recordImage;
179 std::unique_ptr<CassetteImage> playImage;
183 bool lastOutput =
false;
184 bool motor =
false, motorControl =
true;
185 bool syncScheduled =
false;
void plugHelper(Connector &connector, EmuTime::param time) override
float getAmplificationFactorImpl() const override
Get amplification/attenuation factor for this device.
std::string_view getName() const override
Name used to identify this pluggable.
std::string_view getDescription() const override
Description for this pluggable.
~CassettePlayer() override
void setSignal(bool output, EmuTime::param time) override
Sets the cassette output signal false = low true = high.
void unplugHelper(EmuTime::param time) override
void generateChannels(std::span< float * > buffers, unsigned num) override
Abstract method to generate the actual sound data.
void setMotor(bool status, EmuTime::param time) override
Sets the cassette motor relay false = off true = on.
CassettePlayer(const HardwareConfig &hwConf)
void serialize(Archive &ar, unsigned version)
int16_t readSample(EmuTime::param time) override
Read wave data from cassette device.
void getMediaInfo(TclObject &result) override
This method gets called when information is required on the media inserted in the media slot of the p...
Represents something you can plug devices into.
const EmuDuration & param
T length(const vecN< N, T > &x)
This file implemented 3 utility functions:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
#define OUTER(type, member)