22 #ifndef NUVIE_SOUND_ADPLUG_OPL_CLASS_H 23 #define NUVIE_SOUND_ADPLUG_OPL_CLASS_H 25 #include "ultima/nuvie/sound/adplug/opl.h" 35 #define BUILD_YM3812 (HAS_YM3812) 36 #define BUILD_YM3526 (HAS_YM3526) 37 #define BUILD_Y8950 (HAS_Y8950) 40 #define OPL_SAMPLE_BITS 16 42 #if (OPL_SAMPLE_BITS==16) 43 typedef int16 OPLSAMPLE;
45 #if (OPL_SAMPLE_BITS==8) 46 typedef int8 OPLSAMPLE;
50 typedef void (*OPL_TIMERHANDLER)(
int channel,
double interval_Sec);
51 typedef void (*OPL_IRQHANDLER)(
int param,
int irq);
52 typedef void (*OPL_UPDATEHANDLER)(
int param,
int min_interval_us);
53 typedef void (*OPL_PORTHANDLER_W)(
int param,
unsigned char data);
54 typedef unsigned char (*OPL_PORTHANDLER_R)(
int param);
97 unsigned int wavetable;
117 uint32 eg_timer_overflow;
125 uint8 lfo_pm_depth_range;
141 OPL_TIMERHANDLER TimerHandler;
143 OPL_IRQHANDLER IRQHandler;
145 OPL_UPDATEHANDLER UpdateHandler;
160 #define MAX_OPL_CHIPS 2 164 #define SIN_LEN (1<<SIN_BITS) 165 #define SIN_MASK (SIN_LEN-1) 167 #define TL_RES_LEN (256) 174 #define TL_TAB_LEN (12*2*TL_RES_LEN) 179 FM_OPL *OPL_YM3812[MAX_OPL_CHIPS];
182 signed int tl_tab[TL_TAB_LEN];
186 unsigned int sin_tab[SIN_LEN * 4];
193 OPL_SLOT *SLOT7_1, *SLOT7_2, *SLOT8_1, *SLOT8_2;
195 signed int phase_modulation;
196 signed int output[1];
201 bool use16bit, stereo;
205 OplClass(
int rate,
bool bit16,
bool usestereo);
214 void update(
short *buf,
int samples);
217 void write(
int reg,
int val)
override;
218 void init()
override;
221 int YM3812Init(
int num,
int clock,
int rate);
222 void YM3812Shutdown(
void);
223 void YM3812ResetChip(
int which);
224 int YM3812Write(
int which,
int a,
int v);
225 unsigned char YM3812Read(
int which,
int a);
226 int YM3812TimerOver(
int which,
int c);
227 void YM3812UpdateOne(
int which, int16 *buffer,
int length);
229 void YM3812SetTimerHandler(
int which, OPL_TIMERHANDLER TimerHandler,
int channelOffset);
230 void YM3812SetIRQHandler(
int which, OPL_IRQHANDLER IRQHandler,
int param);
231 void YM3812SetUpdateHandler(
int which, OPL_UPDATEHANDLER UpdateHandler,
int param);
233 int init_tables(
void);
234 void OPLWriteReg(
FM_OPL *
OPL,
int r,
int v);
235 void OPLResetChip(
FM_OPL *OPL);
236 int OPL_LockTable(
void);
237 FM_OPL *OPLCreate(
int type,
int clock,
int rate);
238 void OPL_UnLockTable(
void);
239 void OPLDestroy(
FM_OPL *OPL);
240 int OPLWrite(
FM_OPL *OPL,
int a,
int v);
242 inline void advance_lfo(
FM_OPL *OPL);
243 inline void advancex(
FM_OPL *OPL);
244 inline signed int op_calc(uint32 phase,
unsigned int env,
signed int pm,
unsigned int wave_tab);
245 inline signed int op_calc1(uint32 phase,
unsigned int env,
signed int pm,
unsigned int wave_tab);
246 inline void OPL_CALC_CH(
OPL_CH *CH);
247 inline void OPL_CALC_RH(
OPL_CH *CH,
unsigned int noise);
Definition: detection.h:27
Definition: opl_class.h:110
Definition: opl_class.h:176
Definition: opl_class.h:100
Definition: opl_class.h:58