59 unsigned sampleRam, EmuTime::param time,
MSXAudio& audio);
62 void setEnabled(
bool enabled, EmuTime::param time);
64 void reset(EmuTime::param time);
65 void writeReg(uint8_t rg, uint8_t data, EmuTime::param time);
66 [[nodiscard]] uint8_t
readReg(uint8_t rg, EmuTime::param time);
67 [[nodiscard]] uint8_t
peekReg(uint8_t rg, EmuTime::param time)
const;
68 [[nodiscard]] uint8_t
readStatus(EmuTime::param time)
const;
69 [[nodiscard]] uint8_t
peekStatus(EmuTime::param time)
const;
76 template<
typename Archive>
77 void serialize(Archive& ar,
unsigned version);
81 [[nodiscard]]
float getAmplificationFactorImpl()
const override;
82 void generateChannels(std::span<float*> bufs,
unsigned num)
override;
94 void setRythmMode(
int data);
95 void update_key_status();
97 [[nodiscard]]
bool checkMuteHelper();
99 void changeStatusMask(uint8_t newMask);
101 void callback(uint8_t flag)
override;
114 enum KeyPart : uint8_t { KEY_MAIN = 1, KEY_RHYTHM = 2 };
121 void setKeyScaleRate(
bool value) {
124 void setFeedbackShift(uint8_t value) {
125 FB = value ? 8 - value : 0;
128 template<
typename Archive>
129 void serialize(Archive& ar,
unsigned version);
148 [[nodiscard]]
bool isActive()
const;
149 void slotOn (KeyPart part);
150 void slotOff(KeyPart part);
152 [[nodiscard]]
unsigned calc_phase(
int lfo_pm);
153 [[nodiscard]]
unsigned calc_envelope(
int lfo_am);
154 [[nodiscard]]
int calc_slot_car(
int lfo_pm,
int lfo_am,
int fm);
155 [[nodiscard]]
int calc_slot_mod(
int lfo_pm,
int lfo_am);
156 [[nodiscard]]
int calc_slot_tom(
int lfo_pm,
int lfo_am);
157 [[nodiscard]]
int calc_slot_snare(
int lfo_pm,
int lfo_am,
int whiteNoise);
158 [[nodiscard]]
int calc_slot_cym(
int lfo_am,
int a,
int b);
159 [[nodiscard]]
int calc_slot_hat(
int lfo_am,
int a,
int b,
int whiteNoise);
161 void updateAll(
unsigned freq);
162 void updatePG(
unsigned freq);
163 void updateTLL(
unsigned freq);
164 void updateRKS(
unsigned freq);
167 template<
typename Archive>
168 void serialize(Archive& ar,
unsigned version);
179 std::span<const EnvPhaseIndex, 16> dPhaseARTableRks;
180 std::span<const EnvPhaseIndex, 16> dPhaseDRTableRks;
194 void setFreq(
unsigned freq);
195 void keyOn (KeyPart part);
196 void keyOff(KeyPart part);
198 template<
typename Archive>
199 void serialize(Archive& ar,
unsigned version);
201 std::array<Slot, 2> slot;
206 MSXMotherBoard& motherBoard;
207 Y8950Periphery& periphery;
212 struct Debuggable final : SimpleDebuggable {
213 Debuggable(MSXMotherBoard& motherBoard,
const std::string& name);
214 [[nodiscard]] uint8_t
read(
unsigned address, EmuTime::param time)
override;
215 void write(
unsigned address, uint8_t value, EmuTime::param time)
override;
218 const std::unique_ptr<EmuTimer> timer1;
219 const std::unique_ptr<EmuTimer> timer2;
222 std::array<uint8_t, 0x100> reg;
224 std::array<Channel, 9> ch;
231 unsigned noiseA_phase;
232 unsigned noiseB_phase;
233 unsigned noiseA_dPhase;
234 unsigned noiseB_dPhase;