12 , mixer(getMotherBoard().getMSXMixer())
13 , connector(getPluggingController(),
"pcminput")
14 , dac(
"PCM",
"Turbo-R PCM", config)
15 , reference(getCurrentTime())
27 reference.
reset(time);
42 switch (port & 0x01) {
60 return (getComp(time) ? 0x80 : 0x00) | (status & 0x1F);
68 switch (port & 0x01) {
76 assert(reference.
getTime() <= time);
77 auto time2 = (status & 0x01)
80 assert(time <= time2);
92 byte change = status ^ value;
95 if ((change & 0x01) && ((status & 0x01) == 0)) {
99 if ((change & 0x10) && (status & 0x10)) {
100 hold = getSample(time);
102 hardwareMute(!(status & 0x02));
107byte MSXTurboRPCM::getSample(EmuTime::param time)
const
109 return (status & 0x04)
110 ? narrow<byte>((connector.
readSample(time) / 256) + 0x80)
114bool MSXTurboRPCM::getComp(EmuTime::param time)
const
117 byte sample = (status & 0x10) ? hold : getSample(time);
118 return sample >= DValue;
121void MSXTurboRPCM::hardwareMute(
bool mute)
123 if (mute == hwMute)
return;
134template<
typename Archive>
137 ar.template serializeBase<MSXDevice>(*
this);
138 ar.serialize(
"audioConnector", connector,
139 "reference", reference,
145 hardwareMute(!(status & 0x02));
#define REGISTER_MSXDEVICE(CLASS, NAME)
constexpr void reset(EmuTime::param e)
Reset the clock to start ticking at the given time.
constexpr EmuTime getFastAdd(unsigned n) const
Like operator+() but faster, though the step can't be too big (max a little over 1 second).
constexpr EmuTime::param getTime() const
Gets the time at which the last clock tick occurred.
constexpr void advance(EmuTime::param e)
Advance this clock in time until the last tick which is not past the given time.
constexpr unsigned getTicksTill(EmuTime::param e) const
Calculate the number of ticks for this clock until the given time.
void reset(EmuTime::param time)
void writeDAC(uint8_t value, EmuTime::param time)
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
EmuTime::param getCurrentTime() const
void mute()
TODO This methods (un)mute the sound.
MSXTurboRPCM(const DeviceConfig &config)
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time) override
This method is called on reset.
This file implemented 3 utility functions:
uint16_t word
16 bit unsigned integer
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)