27 [[nodiscard]] uint8_t
readRegister(
unsigned reg, EmuTime::param time);
28 [[nodiscard]] uint8_t
peekRegister(
unsigned reg, EmuTime::param time)
const;
29 void writeRegister(
unsigned reg, uint8_t value, EmuTime::param time);
30 void reset(EmuTime::param time);
32 template<
typename Archive>
33 void serialize(Archive& ar,
unsigned version);
38 inline void setPeriod(
int value);
39 [[nodiscard]]
inline unsigned getNextEventTime()
const;
40 inline void advanceFast(
unsigned duration);
42 template<
typename Archive>
43 void serialize(Archive& ar,
unsigned version);
46 Generator() =
default;
62 class ToneGenerator :
public Generator {
71 inline void advance(
unsigned duration);
73 inline void doNextEvent(
AY8910& ay8910);
77 [[nodiscard]]
bool getOutput()
const {
return output; }
79 template<
typename Archive>
80 void serialize(Archive& ar,
unsigned version);
83 [[nodiscard]]
int getDetune(
AY8910& ay8910);
88 unsigned vibratoCount = 0;
89 unsigned detuneCount = 0;
96 class NoiseGenerator :
public Generator {
104 inline void advance(
unsigned duration);
106 inline void doNextEvent();
110 [[nodiscard]]
bool getOutput()
const {
return random & 1; }
112 template<
typename Archive>
113 void serialize(Archive& ar,
unsigned version);
122 [[nodiscard]]
auto getEnvVolTable()
const {
return envVolTable; }
123 [[nodiscard]]
inline float getVolume(
unsigned chan)
const;
124 inline void setChannelVolume(
unsigned chan,
unsigned value);
125 [[nodiscard]]
inline bool followsEnvelope(
unsigned chan)
const;
129 std::span<const float, 32> envVolTable;
130 std::array<float, 3> vol;
131 std::array<bool, 3> envChan;
136 explicit inline Envelope(std::span<const float, 32> envVolTable);
138 inline void setPeriod(
int value);
139 inline void setShape(
unsigned shape);
140 [[nodiscard]]
inline bool isChanging()
const;
141 inline void advance(
unsigned duration);
142 [[nodiscard]]
inline float getVolume()
const;
144 [[nodiscard]]
inline unsigned getNextEventTime()
const;
145 inline void advanceFast(
unsigned duration);
146 inline void doNextEvent();
148 template<
typename Archive>
149 void serialize(Archive& ar,
unsigned version);
152 inline void doSteps(
int steps);
155 std::span<const float, 32> envVolTable;
160 bool hold =
false, alternate =
false, holding =
false;
164 void generateChannels(std::span<float*> bufs,
unsigned num)
override;
165 [[nodiscard]]
float getAmplificationFactorImpl()
const override;
170 void wrtReg(
unsigned reg, uint8_t value, EmuTime::param time);
177 [[nodiscard]] uint8_t read(
unsigned address, EmuTime::param time)
override;
178 void write(
unsigned address, uint8_t value, EmuTime::param time)
override;
186 std::array<ToneGenerator, 3> tone;
187 NoiseGenerator noise;
190 std::array<uint8_t, 16> regs;
192 const bool ignorePortDirections;
194 bool detuneInitialized =
false;
Models the general purpose I/O ports of the AY8910.
This class implements the AY-3-8910 sound chip.
uint8_t readRegister(unsigned reg, EmuTime::param time)
AY8910(const std::string &name, AY8910Periphery &periphery, const DeviceConfig &config, EmuTime::param time)
void reset(EmuTime::param time)
void writeRegister(unsigned reg, uint8_t value, EmuTime::param time)
uint8_t peekRegister(unsigned reg, EmuTime::param time) const
void serialize(Archive &ar, unsigned version)
A Setting with a floating point value.
ALWAYS_INLINE unsigned count(const uint8_t *pIn, const uint8_t *pMatch, const uint8_t *pInLimit)
This file implemented 3 utility functions:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
void advance(octet_iterator &it, distance_type n, octet_iterator end)