LMMS
Loading...
Searching...
No Matches
Ym2612_Emu.cpp File Reference
#include "Ym2612_Emu.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <math.h>

Classes

struct  slot_t
struct  channel_t
struct  state_t
struct  tables_t
struct  Ym2612_Impl
struct  ym2612_update_chan< algo >

Macros

#define PI   3.14159265358979323846
#define ATTACK   0
#define DECAY   1
#define SUBSTAIN   2
#define RELEASE   3
#define SIN_HBITS   12
#define SIN_LBITS   (26 - SIN_HBITS)
#define ENV_HBITS   12
#define ENV_LBITS   (28 - ENV_HBITS)
#define LFO_HBITS   10
#define LFO_LBITS   (28 - LFO_HBITS)
#define SIN_LENGHT   (1 << SIN_HBITS)
#define ENV_LENGHT   (1 << ENV_HBITS)
#define LFO_LENGHT   (1 << LFO_HBITS)
#define TL_LENGHT   (ENV_LENGHT * 3)
#define SIN_MASK   (SIN_LENGHT - 1)
#define ENV_MASK   (ENV_LENGHT - 1)
#define LFO_MASK   (LFO_LENGHT - 1)
#define ENV_STEP   (96.0 / ENV_LENGHT)
#define ENV_ATTACK   ((ENV_LENGHT * 0) << ENV_LBITS)
#define ENV_DECAY   ((ENV_LENGHT * 1) << ENV_LBITS)
#define ENV_END   ((ENV_LENGHT * 2) << ENV_LBITS)
#define MAX_OUT_BITS   (SIN_HBITS + SIN_LBITS + 2)
#define MAX_OUT   ((1 << MAX_OUT_BITS) - 1)
#define PG_CUT_OFF   ((int) (78.0 / ENV_STEP))
#define ENV_CUT_OFF   ((int) (68.0 / ENV_STEP))
#define AR_RATE   399128
#define DR_RATE   5514396
#define LFO_FMS_LBITS   9
#define LFO_FMS_BASE   ((int) (0.05946309436 * 0.0338 * (double) (1 << LFO_FMS_LBITS)))
#define S0   0
#define S1   2
#define S2   1
#define S3   3
#define CALC_EN(x)
#define SINT(i, o)

Typedefs

typedef void(* ym2612_update_chan_t) (tables_t &, channel_t &, Ym2612_Emu::sample_t *, int)

Functions

void set_seg (slot_t &s, int seg)
void YM2612_Special_Update ()
static void update_envelope_ (slot_t *sl)
void update_envelope (slot_t &sl)

Variables

const int output_bits = 14
static const unsigned char DT_DEF_TAB [4 *32]
static const unsigned char FKEY_TAB [16]
static const unsigned char LFO_AMS_TAB [4]
static const unsigned char LFO_FMS_TAB [8]
static const ym2612_update_chan_t UPDATE_CHAN [8]

Macro Definition Documentation

◆ AR_RATE

#define AR_RATE   399128

◆ ATTACK

#define ATTACK   0

◆ CALC_EN

#define CALC_EN ( x)
Value:
int temp##x = ENV_TAB [ch.SLOT [S##x].Ecnt >> ENV_LBITS] + ch.SLOT [S##x].TLL; \
int en##x = ((temp##x ^ ch.SLOT [S##x].env_xor) + (env_LFO >> ch.SLOT [S##x].AMS)) & \
((temp##x - ch.SLOT [S##x].env_max) >> 31);
#define ENV_LBITS
Definition Ym2612_Emu.cpp:141
unsigned x[BMAX+1]
Definition inflate.c:1586

◆ DECAY

#define DECAY   1

◆ DR_RATE

#define DR_RATE   5514396

◆ ENV_ATTACK

#define ENV_ATTACK   ((ENV_LENGHT * 0) << ENV_LBITS)

◆ ENV_CUT_OFF

#define ENV_CUT_OFF   ((int) (68.0 / ENV_STEP))

◆ ENV_DECAY

#define ENV_DECAY   ((ENV_LENGHT * 1) << ENV_LBITS)

◆ ENV_END

#define ENV_END   ((ENV_LENGHT * 2) << ENV_LBITS)

◆ ENV_HBITS

#define ENV_HBITS   12

◆ ENV_LBITS

#define ENV_LBITS   (28 - ENV_HBITS)

◆ ENV_LENGHT

#define ENV_LENGHT   (1 << ENV_HBITS)

◆ ENV_MASK

#define ENV_MASK   (ENV_LENGHT - 1)

◆ ENV_STEP

#define ENV_STEP   (96.0 / ENV_LENGHT)

◆ LFO_FMS_BASE

#define LFO_FMS_BASE   ((int) (0.05946309436 * 0.0338 * (double) (1 << LFO_FMS_LBITS)))

◆ LFO_FMS_LBITS

#define LFO_FMS_LBITS   9

◆ LFO_HBITS

#define LFO_HBITS   10

◆ LFO_LBITS

#define LFO_LBITS   (28 - LFO_HBITS)

◆ LFO_LENGHT

#define LFO_LENGHT   (1 << LFO_HBITS)

◆ LFO_MASK

#define LFO_MASK   (LFO_LENGHT - 1)

◆ MAX_OUT

#define MAX_OUT   ((1 << MAX_OUT_BITS) - 1)

◆ MAX_OUT_BITS

#define MAX_OUT_BITS   (SIN_HBITS + SIN_LBITS + 2)

◆ PG_CUT_OFF

#define PG_CUT_OFF   ((int) (78.0 / ENV_STEP))

◆ PI

#define PI   3.14159265358979323846

◆ RELEASE

#define RELEASE   3

◆ S0

#define S0   0

◆ S1

#define S1   2

◆ S2

#define S2   1

◆ S3

#define S3   3

◆ SIN_HBITS

#define SIN_HBITS   12

◆ SIN_LBITS

#define SIN_LBITS   (26 - SIN_HBITS)

◆ SIN_LENGHT

#define SIN_LENGHT   (1 << SIN_HBITS)

◆ SIN_MASK

#define SIN_MASK   (SIN_LENGHT - 1)

◆ SINT

#define SINT ( i,
o )
Value:
(TL_TAB [g.SIN_TAB [(i)] + (o)])
int g
Definition inflate.c:1573
register unsigned i
Definition inflate.c:1575

◆ SUBSTAIN

#define SUBSTAIN   2

◆ TL_LENGHT

#define TL_LENGHT   (ENV_LENGHT * 3)

Typedef Documentation

◆ ym2612_update_chan_t

typedef void(* ym2612_update_chan_t) (tables_t &, channel_t &, Ym2612_Emu::sample_t *, int)

Function Documentation

◆ set_seg()

void set_seg ( slot_t & s,
int seg )
inline

◆ update_envelope()

void update_envelope ( slot_t & sl)
inline

◆ update_envelope_()

void update_envelope_ ( slot_t * sl)
static

◆ YM2612_Special_Update()

void YM2612_Special_Update ( )
inline

Variable Documentation

◆ DT_DEF_TAB

const unsigned char DT_DEF_TAB[4 *32]
static
Initial value:
=
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8,
1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
5, 6, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 16, 16, 16, 16,
2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7,
8 , 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 20, 22, 22, 22, 22
}

◆ FKEY_TAB

const unsigned char FKEY_TAB[16]
static
Initial value:
=
{
0, 0, 0, 0,
0, 0, 0, 1,
2, 3, 3, 3,
3, 3, 3, 3
}

◆ LFO_AMS_TAB

const unsigned char LFO_AMS_TAB[4]
static
Initial value:
=
{
31, 4, 1, 0
}

◆ LFO_FMS_TAB

const unsigned char LFO_FMS_TAB[8]
static
Initial value:
=
{
}
#define LFO_FMS_BASE
Definition Ym2612_Emu.cpp:175

◆ output_bits

const int output_bits = 14

◆ UPDATE_CHAN