Go to the documentation of this file. 1 #ifndef YM2413BURCZYNSKI_HH
2 #define YM2413BURCZYNSKI_HH
9 namespace YM2413Burczynski {
29 [[nodiscard]]
inline int calcOutput(
Channel& channel,
unsigned eg_cnt,
bool carrier,
30 unsigned lfo_am,
int phase);
32 unsigned lfo_pm,
unsigned lfo_am);
102 template<
typename Archive>
103 void serialize(Archive& ar,
unsigned version);
118 inline void updateTotalLevel(
Channel& channel);
119 inline void updateAttackRate(
int kcodeScaled);
120 inline void updateDecayRate(
int kcodeScaled);
121 inline void updateReleaseRate(
int kcodeScaled);
123 const unsigned* wavetable;
142 const uint8_t* eg_sel_dp;
143 const uint8_t* eg_sel_ar;
144 const uint8_t* eg_sel_dr;
145 const uint8_t* eg_sel_rr;
146 const uint8_t* eg_sel_rs;
177 [[nodiscard]]
inline int calcOutput(
unsigned eg_cnt,
unsigned lfo_pm,
unsigned lfo_am,
int fm);
209 template<
typename Archive>
210 void serialize(Archive& ar,
unsigned version);
229 void reset()
override;
230 void writePort(
bool port, uint8_t value,
int offset)
override;
231 void pokeReg(uint8_t reg, uint8_t value)
override;
232 [[nodiscard]] uint8_t
peekReg(uint8_t reg)
const override;
236 template<
typename Archive>
237 void serialize(Archive& ar,
unsigned version);
240 void writeReg(uint8_t reg, uint8_t value);
244 void resetOperators();
246 [[nodiscard]]
inline bool isRhythm()
const;
248 [[nodiscard]]
Channel& getChannelForReg(uint8_t reg);
254 void updateCustomInstrument(
int part, uint8_t value);
256 void setRhythmFlags(uint8_t old);
269 unsigned idleSamples;
282 uint8_t inst_tab[19][8];
286 uint8_t registerLatch;
bool isActive() const
Does this slot currently produce an output signal?
void updateInstrument(const uint8_t *inst)
Sets all synthesis parameters as specified by the instrument.
void setFrequencyMultiplier(uint8_t value)
Sets the frequency multiplier [0..15].
uint8_t peekReg(uint8_t reg) const override
Read from a YM2413 register (for debug).
void serialize(Archive &ar, unsigned version)
int calc_slot_mod(Channel &channel, unsigned eg_cnt, bool carrier, unsigned lfo_pm, unsigned lfo_am)
void setFrequencyHigh(uint8_t value)
Changes the higher 4 bits of the frequency for this channel.
void reset() override
Reset this YM2413 core.
void setDecayRate(const Channel &channel, uint8_t value)
Sets the decay rate [0..15].
void updateInstrumentPart(int part, uint8_t value)
Sets some synthesis parameters as specified by the instrument.
FreqIndex getFrequencyIncrement() const
void updateGenerators(Channel &channel)
Update phase increment counter of operator.
int calc_phase(Channel &channel, unsigned lfo_pm)
void setKeyScaleLevel(Channel &channel, uint8_t value)
Sets the key scale level: 0->0 / 1->1.5 / 2->3.0 / 3->6.0 dB/OCT.
int getKeyScaleLevelBase() const
void setReleaseRate(const Channel &channel, uint8_t value)
Sets the release rate [0..15].
void setVibrato(bool value)
Enables (true) or disables (false) vibrato.
uint8_t getKeyCode() const
int calc_envelope(Channel &channel, unsigned eg_cnt, bool carrier)
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
void setKeyOn(KeyPart part)
void setWaveform(uint8_t value)
Sets the waveform: 0 = sinus, 1 = half sinus, half silence.
EnvelopeState
Envelope Generator phases Note: These are ordered: phase constants are compared in the code.
void setFrequencyLow(uint8_t value)
Changes the lower 8 bits of the frequency for this channel.
int calcOutput(unsigned eg_cnt, unsigned lfo_pm, unsigned lfo_am, int fm)
Calculate the value of the current sample produced by this channel.
void setAttackRate(const Channel &channel, uint8_t value)
Sets the attack rate [0..15].
void setSustainLevel(uint8_t value)
Sets the sustain level [0..15].
void setFrequency(int block_fnum)
Sets the frequency for this channel.
void setKeyOnOff(KeyPart part, bool enabled)
void serialize(Archive &ar, unsigned version)
void generateChannels(float *bufs[9+5], unsigned num) override
void pokeReg(uint8_t reg, uint8_t value) override
Write to a YM2413 register (for debug).
void setAmplitudeModulation(bool value)
Enables (true) or disables (false) amplitude modulation.
int calcOutput(Channel &channel, unsigned eg_cnt, bool carrier, unsigned lfo_am, int phase)
void updateFrequency(Channel &channel)
Called by Channel when block_fnum changes.
void serialize(Archive &ar, unsigned version)
void setKeyScaleRate(bool value)
Sets the key scale rate: true->0, false->2.
float getAmplificationFactor() const override
Returns normalization factor.
Abstract interface for the YM2413 core.
void setKeyOff(KeyPart part)
void setEnvelopeSustained(bool value)
Sets the envelope type of the current instrument.
void writePort(bool port, uint8_t value, int offset) override
Write to the YM2413 register/data port.
void setFeedbackShift(uint8_t value)
Sets the amount of feedback [0..7].
This file implemented 3 utility functions:
void setTotalLevel(Channel &channel, uint8_t value)
Sets the total level: [0..63].
void setSustain(bool sustained)
A fixed point number, implemented by a 32-bit signed integer.