55 unsigned sampleRam, EmuTime::param time,
MSXAudio& audio);
58 void setEnabled(
bool enabled, EmuTime::param time);
60 void reset(EmuTime::param time);
61 void writeReg(
byte rg,
byte data, EmuTime::param time);
62 [[nodiscard]]
byte readReg(
byte rg, EmuTime::param time);
63 [[nodiscard]]
byte peekReg(
byte rg, EmuTime::param time)
const;
64 [[nodiscard]]
byte readStatus(EmuTime::param time)
const;
65 [[nodiscard]]
byte peekStatus(EmuTime::param time)
const;
72 template<
typename Archive>
73 void serialize(Archive& ar,
unsigned version);
77 [[nodiscard]]
float getAmplificationFactorImpl()
const override;
78 void generateChannels(
float** bufs,
unsigned num)
override;
80 inline void keyOn_BD();
81 inline void keyOn_SD();
82 inline void keyOn_TOM();
83 inline void keyOn_HH();
84 inline void keyOn_CYM();
85 inline void keyOff_BD();
86 inline void keyOff_SD();
87 inline void keyOff_TOM();
88 inline void keyOff_HH();
89 inline void keyOff_CYM();
90 inline void setRythmMode(
int data);
91 void update_key_status();
93 [[nodiscard]]
bool checkMuteHelper();
95 void changeStatusMask(
byte newMask);
97 void callback(
byte flag)
override;
110 enum KeyPart { KEY_MAIN = 1, KEY_RHYTHM = 2 };
117 void setKeyScaleRate(
bool value) {
120 void setFeedbackShift(
byte value) {
121 FB = value ? 8 - value : 0;
124 template<
typename Archive>
125 void serialize(Archive& ar,
unsigned version);
143 [[nodiscard]]
inline bool isActive()
const;
144 inline void slotOn (KeyPart part);
145 inline void slotOff(KeyPart part);
147 [[nodiscard]]
inline unsigned calc_phase(
int lfo_pm);
148 [[nodiscard]]
inline unsigned calc_envelope(
int lfo_am);
149 [[nodiscard]]
inline int calc_slot_car(
int lfo_pm,
int lfo_am,
int fm);
150 [[nodiscard]]
inline int calc_slot_mod(
int lfo_pm,
int lfo_am);
151 [[nodiscard]]
inline int calc_slot_tom(
int lfo_pm,
int lfo_am);
152 [[nodiscard]]
inline int calc_slot_snare(
int lfo_pm,
int lfo_am,
int whitenoise);
153 [[nodiscard]]
inline int calc_slot_cym(
int lfo_am,
int a,
int b);
154 [[nodiscard]]
inline int calc_slot_hat(
int lfo_am,
int a,
int b,
int whitenoise);
156 inline void updateAll(
unsigned freq);
157 inline void updatePG(
unsigned freq);
158 inline void updateTLL(
unsigned freq);
159 inline void updateRKS(
unsigned freq);
160 inline void updateEG();
162 template<
typename Archive>
163 void serialize(Archive& ar,
unsigned version);
189 inline void setFreq(
unsigned freq);
190 inline void keyOn (KeyPart part);
191 inline void keyOff(KeyPart part);
193 template<
typename Archive>
194 void serialize(Archive& ar,
unsigned version);
201 MSXMotherBoard& motherBoard;
202 Y8950Periphery& periphery;
207 struct Debuggable final : SimpleDebuggable {
208 Debuggable(MSXMotherBoard& motherBoard,
const std::string& name);
209 [[nodiscard]]
byte read(
unsigned address, EmuTime::param time)
override;
210 void write(
unsigned address,
byte value, EmuTime::param time)
override;
213 const std::unique_ptr<EmuTimer> timer1;
214 const std::unique_ptr<EmuTimer> timer2;
226 unsigned noiseA_phase;
227 unsigned noiseB_phase;
228 unsigned noiseA_dPhase;
229 unsigned noiseB_dPhase;
Debuggable(const Debuggable &)=delete
byte read(unsigned address) override
void write(unsigned address, byte value) override
static constexpr int STATUS_BUF_RDY
static constexpr int STATUS_T1
void reset(EmuTime::param time)
static constexpr int EG_DP_BITS
byte peekRawStatus() const
byte readStatus(EmuTime::param time) const
void setEnabled(bool enabled, EmuTime::param time)
static constexpr int CLOCK_FREQ_DIV
Y8950(const std::string &name, const DeviceConfig &config, unsigned sampleRam, EmuTime::param time, MSXAudio &audio)
static constexpr int R04_MASK_T2
static constexpr int R04_MASK_BUF_RDY
static constexpr int STATUS_PCM_BSY
static constexpr int R04_IRQ_RESET
static constexpr int R04_MASK_EOS
FixedPoint< EG_DP_BITS - EG_BITS > EnvPhaseIndex
byte peekReg(byte rg, EmuTime::param time) const
static constexpr int R04_ST2
void serialize(Archive &ar, unsigned version)
void resetStatus(byte flags)
static constexpr int R04_MASK_T1
static constexpr int R04_ST1
void writeReg(byte rg, byte data, EmuTime::param time)
static constexpr int CLOCK_FREQ
static constexpr int EG_BITS
byte readReg(byte rg, EmuTime::param time)
void setStatus(byte flags)
static constexpr int STATUS_EOS
byte peekStatus(EmuTime::param time) const
static constexpr int STATUS_T2
This file implemented 3 utility functions:
constexpr Y8950::EnvPhaseIndex SL[16]
IntHelper< IRQSource > IRQHelper