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;
61 void setState(
State newState,
const Filename& newImage,
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;
126 explicit SyncEndOfTape(Scheduler& s) :
Schedulable(s) {}
127 void executeUntil(EmuTime::param time)
override {
128 auto& cp =
OUTER(CassettePlayer, syncEndOfTape);
129 cp.execEndOfTape(time);
134 explicit SyncAudioEmu(Scheduler& s) :
Schedulable(s) {}
135 void executeUntil(EmuTime::param time)
override {
136 auto& cp =
OUTER(CassettePlayer, syncAudioEmu);
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,
168 Scheduler& scheduler);
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;
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event