openMSX
Classes | Typedefs | Enumerations | Variables
openmsx::YM2413Okazaki Namespace Reference

Classes

class  Patch
 
class  Slot
 
class  Channel
 
class  YM2413
 

Typedefs

using EnvPhaseIndex = FixedPoint< EP_FP_BITS >
 

Enumerations

enum  EnvelopeState {
  ATTACK , DECAY , SUSHOLD , SUSTAIN ,
  RELEASE , SETTLE , FINISH
}
 

Variables

constexpr int PM_FP_BITS = 8
 
constexpr int DB_BITS = 8
 
constexpr int DB_MUTE = 1 << DB_BITS
 
constexpr int DBTABLEN = 4 * DB_MUTE
 
constexpr double DB_STEP = 48.0 / DB_MUTE
 
constexpr double EG_STEP = 0.375
 
constexpr double TL_STEP = 0.75
 
constexpr int PG_BITS = 9
 
constexpr int PG_WIDTH = 1 << PG_BITS
 
constexpr int PG_MASK = PG_WIDTH - 1
 
constexpr int DP_BITS = 18
 
constexpr int DP_BASE_BITS = DP_BITS - PG_BITS
 
constexpr int EG_BITS = 7
 
constexpr int DB2LIN_AMP_BITS = 8
 
constexpr int SLOT_AMP_BITS = DB2LIN_AMP_BITS
 
constexpr int AM_PG_BITS = 8
 
constexpr int AM_PG_WIDTH = 1 << AM_PG_BITS
 
constexpr int AM_DP_BITS = 16
 
constexpr int AM_DP_WIDTH = 1 << AM_DP_BITS
 
constexpr int AM_DP_MASK = AM_DP_WIDTH - 1
 
constexpr unsigned LFO_AM_TAB_ELEMENTS = 210
 
constexpr EnvPhaseIndex EG_DP_MAX = EnvPhaseIndex(1 << 7)
 
constexpr EnvPhaseIndex EG_DP_INF = EnvPhaseIndex(1 << 8)
 
constexpr signed char pmTable [8][8]
 
constexpr unsigned char lfo_am_table [LFO_AM_TAB_ELEMENTS]
 
constexpr uint8_t mlTable [16]
 
constexpr auto dB2LinTab
 
constexpr auto arAdjustTab
 
constexpr auto tllTab
 
constexpr auto fullSinTable
 
constexpr auto halfSinTable
 
constexpr unsigned const *const waveform [2] = {fullSinTable.data(), halfSinTable.data()}
 
constexpr auto dPhaseDrTab
 
constexpr auto slTab
 
constexpr int EP_FP_BITS = 15
 

Typedef Documentation

◆ EnvPhaseIndex

Definition at line 14 of file YM2413Okazaki.hh.

Enumeration Type Documentation

◆ EnvelopeState

Enumerator
ATTACK 
DECAY 
SUSHOLD 
SUSTAIN 
RELEASE 
SETTLE 
FINISH 

Definition at line 16 of file YM2413Okazaki.hh.

Variable Documentation

◆ AM_DP_BITS

constexpr int openmsx::YM2413Okazaki::AM_DP_BITS = 16
constexpr

Definition at line 56 of file YM2413Okazaki.cc.

◆ AM_DP_MASK

constexpr int openmsx::YM2413Okazaki::AM_DP_MASK = AM_DP_WIDTH - 1
constexpr

Definition at line 58 of file YM2413Okazaki.cc.

◆ AM_DP_WIDTH

constexpr int openmsx::YM2413Okazaki::AM_DP_WIDTH = 1 << AM_DP_BITS
constexpr

Definition at line 57 of file YM2413Okazaki.cc.

◆ AM_PG_BITS

constexpr int openmsx::YM2413Okazaki::AM_PG_BITS = 8
constexpr

Definition at line 54 of file YM2413Okazaki.cc.

◆ AM_PG_WIDTH

constexpr int openmsx::YM2413Okazaki::AM_PG_WIDTH = 1 << AM_PG_BITS
constexpr

Definition at line 55 of file YM2413Okazaki.cc.

◆ arAdjustTab

constexpr auto openmsx::YM2413Okazaki::arAdjustTab
constexpr
Initial value:
= [] {
std::array<unsigned, 1 << EG_BITS> result = {};
result[0] = (1 << EG_BITS) - 1;
constexpr double l127 = cstd::log<5, 4>(127.0);
for (int i : xrange(1, 1 << EG_BITS)) {
result[i] = unsigned(double(1 << EG_BITS) - 1 -
((1 << EG_BITS) - 1) * cstd::log<5, 4>(double(i)) / l127);
}
return result;
}()
constexpr auto xrange(T e)
Definition: xrange.hh:155

Definition at line 179 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::calc_envelope(), openmsx::YM2413Okazaki::Slot::slotOff(), and openmsx::YM2413Okazaki::YM2413::YM2413().

◆ DB2LIN_AMP_BITS

constexpr int openmsx::YM2413Okazaki::DB2LIN_AMP_BITS = 8
constexpr

◆ dB2LinTab

constexpr auto openmsx::YM2413Okazaki::dB2LinTab
constexpr
Initial value:
= [] {
std::array<int, 2 * DBTABLEN> result = {};
for (int i : xrange(DB_MUTE - 1)) {
result[i] = int(double((1 << DB2LIN_AMP_BITS) - 1) *
cstd::pow<5, 3>(10, -double(i) * DB_STEP / 20));
}
result[DB_MUTE - 1] = 0;
for (auto i : xrange(DB_MUTE, DBTABLEN)) {
result[i] = 0;
}
for (auto i : xrange(DBTABLEN)) {
result[i + DBTABLEN] = -result[i];
}
return result;
}()
constexpr int DB2LIN_AMP_BITS
constexpr int DBTABLEN
constexpr double DB_STEP

Definition at line 162 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::calc_slot_car(), openmsx::YM2413Okazaki::Slot::calc_slot_cym(), openmsx::YM2413Okazaki::Slot::calc_slot_hat(), openmsx::YM2413Okazaki::Slot::calc_slot_mod(), openmsx::YM2413Okazaki::Slot::calc_slot_snare(), openmsx::YM2413Okazaki::Slot::calc_slot_tom(), and openmsx::YM2413Okazaki::YM2413::YM2413().

◆ DB_BITS

constexpr int openmsx::YM2413Okazaki::DB_BITS = 8
constexpr

Definition at line 29 of file YM2413Okazaki.cc.

◆ DB_MUTE

constexpr int openmsx::YM2413Okazaki::DB_MUTE = 1 << DB_BITS
constexpr

Definition at line 30 of file YM2413Okazaki.cc.

◆ DB_STEP

constexpr double openmsx::YM2413Okazaki::DB_STEP = 48.0 / DB_MUTE
constexpr

Definition at line 33 of file YM2413Okazaki.cc.

◆ DBTABLEN

constexpr int openmsx::YM2413Okazaki::DBTABLEN = 4 * DB_MUTE
constexpr

Definition at line 31 of file YM2413Okazaki.cc.

◆ DP_BASE_BITS

constexpr int openmsx::YM2413Okazaki::DP_BASE_BITS = DP_BITS - PG_BITS
constexpr

Definition at line 44 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::calc_phase().

◆ DP_BITS

constexpr int openmsx::YM2413Okazaki::DP_BITS = 18
constexpr

Definition at line 43 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::updatePG().

◆ dPhaseDrTab

constexpr auto openmsx::YM2413Okazaki::dPhaseDrTab
constexpr
Initial value:
= [] {
std::array<std::array<int, 16>, 16> result = {};
for (auto Rks : xrange(16)) {
result[Rks][0] = 0;
for (auto DR : xrange(1, 16)) {
unsigned RM = std::min(DR + (Rks >> 2), 15);
unsigned RL = Rks & 3;
result[Rks][DR] =
((RL + 4) << EP_FP_BITS) >> (16 - RM);
}
}
return result;
}()
constexpr vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
Definition: gl_vec.hh:269
constexpr int EP_FP_BITS

Definition at line 254 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::reset(), openmsx::YM2413Okazaki::Slot::updateRKS(), and openmsx::YM2413Okazaki::YM2413::YM2413().

◆ EG_BITS

constexpr int openmsx::YM2413Okazaki::EG_BITS = 7
constexpr

Definition at line 47 of file YM2413Okazaki.cc.

◆ EG_DP_INF

constexpr EnvPhaseIndex openmsx::YM2413Okazaki::EG_DP_INF = EnvPhaseIndex(1 << 8)
constexpr

Definition at line 79 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::setEnvelopeState().

◆ EG_DP_MAX

constexpr EnvPhaseIndex openmsx::YM2413Okazaki::EG_DP_MAX = EnvPhaseIndex(1 << 7)
constexpr

Definition at line 78 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::setEnvelopeState().

◆ EG_STEP

constexpr double openmsx::YM2413Okazaki::EG_STEP = 0.375
constexpr

Definition at line 34 of file YM2413Okazaki.cc.

◆ EP_FP_BITS

constexpr int openmsx::YM2413Okazaki::EP_FP_BITS = 15
constexpr

Definition at line 13 of file YM2413Okazaki.hh.

◆ fullSinTable

constexpr auto openmsx::YM2413Okazaki::fullSinTable
constexpr
Initial value:
= [] {
auto lin2db = [](double d) {
return (d == 0)
? DB_MUTE - 1
: std::min(-int(20.0 * cstd::log10<5, 2>(d) / DB_STEP), DB_MUTE - 1);
};
std::array<unsigned, PG_WIDTH> result = {};
for (auto i : xrange(PG_WIDTH / 4)) {
result[i] = lin2db(cstd::sin<2>(double(2.0 * M_PI) * i / PG_WIDTH));
}
for (auto i : xrange(PG_WIDTH / 4)) {
result[PG_WIDTH / 2 - 1 - i] = result[i];
}
for (auto i : xrange(PG_WIDTH / 2)) {
result[PG_WIDTH / 2 + i] = DBTABLEN + result[i];
}
return result;
}()
#define M_PI
Definition: Math.hh:27
constexpr int PG_WIDTH

Definition at line 218 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::YM2413::YM2413().

◆ halfSinTable

constexpr auto openmsx::YM2413Okazaki::halfSinTable
constexpr
Initial value:
= [] {
std::array<unsigned, PG_WIDTH> result = {};
for (auto i : xrange(PG_WIDTH / 2)) {
result[i] = fullSinTable[i];
}
for (auto i : xrange(PG_WIDTH / 2, PG_WIDTH)) {
result[i] = fullSinTable[0];
}
return result;
}()
constexpr auto fullSinTable

Definition at line 238 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::YM2413::YM2413().

◆ LFO_AM_TAB_ELEMENTS

constexpr unsigned openmsx::YM2413Okazaki::LFO_AM_TAB_ELEMENTS = 210
constexpr

◆ lfo_am_table

constexpr unsigned char openmsx::YM2413Okazaki::lfo_am_table[LFO_AM_TAB_ELEMENTS]
constexpr

Definition at line 95 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::YM2413::calcChannel().

◆ mlTable

constexpr uint8_t openmsx::YM2413Okazaki::mlTable[16]
constexpr
Initial value:
= {
1, 1*2, 2*2, 3*2, 4*2, 5*2, 6*2, 7*2,
8*2, 9*2, 10*2, 10*2, 12*2, 12*2, 15*2, 15*2
}

Definition at line 151 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Patch::setML().

◆ PG_BITS

constexpr int openmsx::YM2413Okazaki::PG_BITS = 9
constexpr

◆ PG_MASK

constexpr int openmsx::YM2413Okazaki::PG_MASK = PG_WIDTH - 1
constexpr

◆ PG_WIDTH

constexpr int openmsx::YM2413Okazaki::PG_WIDTH = 1 << PG_BITS
constexpr

Definition at line 39 of file YM2413Okazaki.cc.

◆ PM_FP_BITS

constexpr int openmsx::YM2413Okazaki::PM_FP_BITS = 8
constexpr

Definition at line 26 of file YM2413Okazaki.cc.

◆ pmTable

constexpr signed char openmsx::YM2413Okazaki::pmTable[8][8]
constexpr
Initial value:
=
{
{ 0, 0, 0, 0, 0, 0, 0, 0, },
{ 0, 0, 1, 0, 0, 0,-1, 0, },
{ 0, 1, 2, 1, 0,-1,-2,-1, },
{ 0, 1, 3, 1, 0,-1,-3,-1, },
{ 0, 2, 4, 2, 0,-2,-4,-2, },
{ 0, 2, 5, 2, 0,-2,-5,-2, },
{ 0, 3, 6, 3, 0,-3,-6,-3, },
{ 0, 3, 7, 3, 0,-3,-7,-3, },
}

Definition at line 82 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Slot::updatePG().

◆ SLOT_AMP_BITS

constexpr int openmsx::YM2413Okazaki::SLOT_AMP_BITS = DB2LIN_AMP_BITS
constexpr

Definition at line 51 of file YM2413Okazaki.cc.

◆ slTab

constexpr auto openmsx::YM2413Okazaki::slTab
constexpr
Initial value:
= [] {
std::array<unsigned, 16> result = {};
for (int i = 0; i < 16; ++i) {
double x = (i == 15) ? 48.0 : (3.0 * i);
result[i] = int(x / EG_STEP) << EP_FP_BITS;
}
return result;
}()
constexpr double EG_STEP
constexpr KeyMatrixPosition x
Keyboard bindings.
Definition: Keyboard.cc:118

Definition at line 269 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Patch::setSL(), and openmsx::YM2413Okazaki::YM2413::YM2413().

◆ TL_STEP

constexpr double openmsx::YM2413Okazaki::TL_STEP = 0.75
constexpr

Definition at line 35 of file YM2413Okazaki.cc.

◆ tllTab

constexpr auto openmsx::YM2413Okazaki::tllTab
constexpr
Initial value:
= [] {
std::array<std::array<uint8_t, 16 * 8>, 4> result = {};
constexpr unsigned klTable[16] = {
0, 24, 32, 37, 40, 43, 45, 47, 48, 50, 51, 52, 53, 54, 55, 56
};
for (auto freq : xrange(16 * 8u)) {
unsigned fnum = freq % 16;
unsigned block = freq / 16;
int tmp = 2 * klTable[fnum] - 16 * (7 - block);
for (auto KL : xrange(4)) {
unsigned t = (tmp <= 0 || KL == 0) ? 0 : (tmp >> (3 - KL));
assert(t <= 112);
result[KL][freq] = t;
}
}
return result;
}()
TclObject t

Definition at line 191 of file YM2413Okazaki.cc.

Referenced by openmsx::YM2413Okazaki::Patch::setKL(), and openmsx::YM2413Okazaki::YM2413::YM2413().

◆ waveform

constexpr unsigned const* const openmsx::YM2413Okazaki::waveform[2] = {fullSinTable.data(), halfSinTable.data()}
constexpr