OPL: add the faster YMFM cores
This refactors the OPL interface in two drivers : Nuked and YMFM Nuked is used by default, YMFM can be enabled with [Sound] fm_driver = ymfm
This commit is contained in:
@@ -136,7 +136,7 @@ extern int is_pentium; /* TODO: Move back to cpu/cpu.h when it's figured out,
|
||||
extern int fixed_size_x, fixed_size_y;
|
||||
extern double mouse_sensitivity; /* (C) Mouse sensitivity scale */
|
||||
extern int pit_mode; /* (C) force setting PIT mode */
|
||||
|
||||
extern int fm_driver; /* (C) select FM sound driver */
|
||||
|
||||
extern char exe_path[2048]; /* path (dir) of executable */
|
||||
extern char usr_path[1024]; /* path (dir) of user data */
|
||||
|
||||
@@ -17,38 +17,40 @@
|
||||
#ifndef SOUND_OPL_H
|
||||
#define SOUND_OPL_H
|
||||
|
||||
typedef void (*tmrfunc)(void *priv, int timer, uint64_t period);
|
||||
enum fm_type {
|
||||
FM_YM3812 = 0,
|
||||
FM_YMF262,
|
||||
FM_YMF289B,
|
||||
FM_MAX
|
||||
};
|
||||
|
||||
enum fm_driver {
|
||||
FM_DRV_NUKED = 0,
|
||||
FM_DRV_YMFM,
|
||||
FM_DRV_MAX
|
||||
};
|
||||
|
||||
/* Define an OPLx chip. */
|
||||
typedef struct {
|
||||
#ifdef SOUND_OPL_NUKED_H
|
||||
nuked_t *opl;
|
||||
#else
|
||||
void *opl;
|
||||
uint8_t (*read)(uint16_t port, void *priv);
|
||||
void (*write)(uint16_t port, uint8_t val, void *priv);
|
||||
int32_t * (*update)(void *priv);
|
||||
void (*reset_buffer)(void *priv);
|
||||
void (*set_do_cycles)(void *priv, int8_t do_cycles);
|
||||
void *priv;
|
||||
} fm_drv_t;
|
||||
|
||||
extern uint8_t fm_driver_get(int chip_id, fm_drv_t *drv);
|
||||
|
||||
extern const fm_drv_t nuked_opl_drv;
|
||||
extern const fm_drv_t ymfm_drv;
|
||||
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t ym3812_nuked_device;
|
||||
extern const device_t ymf262_nuked_device;
|
||||
|
||||
extern const device_t ym3812_ymfm_device;
|
||||
extern const device_t ymf262_ymfm_device;
|
||||
extern const device_t ymf289b_ymfm_device;
|
||||
#endif
|
||||
int8_t flags, pad;
|
||||
|
||||
uint16_t port;
|
||||
uint8_t status, timer_ctrl;
|
||||
uint16_t timer_count[2],
|
||||
timer_cur_count[2];
|
||||
|
||||
pc_timer_t timers[2];
|
||||
|
||||
int pos;
|
||||
int32_t buffer[SOUNDBUFLEN * 2];
|
||||
} opl_t;
|
||||
|
||||
extern void opl_set_do_cycles(opl_t *dev, int8_t do_cycles);
|
||||
|
||||
extern uint8_t opl2_read(uint16_t port, void *);
|
||||
extern void opl2_write(uint16_t port, uint8_t val, void *);
|
||||
extern void opl2_init(opl_t *);
|
||||
extern void opl2_update(opl_t *);
|
||||
|
||||
extern uint8_t opl3_read(uint16_t port, void *);
|
||||
extern void opl3_write(uint16_t port, uint8_t val, void *);
|
||||
extern void opl3_init(opl_t *);
|
||||
extern void opl3_update(opl_t *);
|
||||
|
||||
#endif /*SOUND_OPL_H*/
|
||||
|
||||
@@ -20,15 +20,5 @@
|
||||
#ifndef SOUND_OPL_NUKED_H
|
||||
#define SOUND_OPL_NUKED_H
|
||||
|
||||
extern void *nuked_init(uint32_t sample_rate);
|
||||
extern void nuked_close(void *);
|
||||
|
||||
extern uint16_t nuked_write_addr(void *, uint16_t port, uint8_t val);
|
||||
extern void nuked_write_reg(void *, uint16_t reg, uint8_t v);
|
||||
extern void nuked_write_reg_buffered(void *, uint16_t reg, uint8_t v);
|
||||
|
||||
extern void nuked_generate(void *, int32_t *buf);
|
||||
extern void nuked_generate_resampled(void *, int32_t *buf);
|
||||
extern void nuked_generate_stream(void *, int32_t *sndptr, uint32_t num);
|
||||
|
||||
#endif /*SOUND_OPL_NUKED_H*/
|
||||
|
||||
@@ -129,7 +129,7 @@ typedef struct sb_t {
|
||||
opl_enabled,
|
||||
mixer_enabled;
|
||||
cms_t cms;
|
||||
opl_t opl,
|
||||
fm_drv_t opl,
|
||||
opl2;
|
||||
sb_dsp_t dsp;
|
||||
union {
|
||||
|
||||
@@ -56,6 +56,10 @@ typedef struct pc_timer_t
|
||||
struct pc_timer_t *prev, *next;
|
||||
} pc_timer_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*Timestamp of nearest enabled timer. CPU emulation must call timer_process()
|
||||
when TSC matches or exceeds this.*/
|
||||
extern uint32_t timer_target;
|
||||
@@ -237,4 +241,8 @@ timer_process_inline(void)
|
||||
timer_target = timer_head->ts.ts32.integer;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TIMER_H_*/
|
||||
|
||||
Reference in New Issue
Block a user