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:
@@ -33,7 +33,7 @@ adlib_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
typedef struct adlib_t {
|
||||
opl_t opl;
|
||||
fm_drv_t opl;
|
||||
|
||||
uint8_t pos_regs[8];
|
||||
} adlib_t;
|
||||
@@ -44,12 +44,12 @@ adlib_get_buffer(int32_t *buffer, int len, void *p)
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
int c;
|
||||
|
||||
opl2_update(&adlib->opl);
|
||||
int32_t *opl_buf = adlib->opl.update(adlib->opl.priv);
|
||||
|
||||
for (c = 0; c < len * 2; c++)
|
||||
buffer[c] += (int32_t) adlib->opl.buffer[c];
|
||||
buffer[c] += (int32_t) opl_buf[c];
|
||||
|
||||
adlib->opl.pos = 0;
|
||||
adlib->opl.reset_buffer(adlib->opl.priv);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
@@ -76,14 +76,14 @@ adlib_mca_write(int port, uint8_t val, void *p)
|
||||
case 0x102:
|
||||
if ((adlib->pos_regs[2] & 1) && !(val & 1))
|
||||
io_removehandler(0x0388, 0x0002,
|
||||
opl2_read, NULL, NULL,
|
||||
opl2_write, NULL, NULL,
|
||||
&adlib->opl);
|
||||
adlib->opl.read, NULL, NULL,
|
||||
adlib->opl.write, NULL, NULL,
|
||||
adlib->opl.priv);
|
||||
if (!(adlib->pos_regs[2] & 1) && (val & 1))
|
||||
io_sethandler(0x0388, 0x0002,
|
||||
opl2_read, NULL, NULL,
|
||||
opl2_write, NULL, NULL,
|
||||
&adlib->opl);
|
||||
adlib->opl.read, NULL, NULL,
|
||||
adlib->opl.write, NULL, NULL,
|
||||
adlib->opl.priv);
|
||||
break;
|
||||
}
|
||||
adlib->pos_regs[port & 7] = val;
|
||||
@@ -104,11 +104,11 @@ adlib_init(const device_t *info)
|
||||
memset(adlib, 0, sizeof(adlib_t));
|
||||
|
||||
adlib_log("adlib_init\n");
|
||||
opl2_init(&adlib->opl);
|
||||
fm_driver_get(FM_YM3812, &adlib->opl);
|
||||
io_sethandler(0x0388, 0x0002,
|
||||
opl2_read, NULL, NULL,
|
||||
opl2_write, NULL, NULL,
|
||||
&adlib->opl);
|
||||
adlib->opl.read, NULL, NULL,
|
||||
adlib->opl.write, NULL, NULL,
|
||||
adlib->opl.priv);
|
||||
sound_add_handler(adlib_get_buffer, adlib);
|
||||
return adlib;
|
||||
}
|
||||
@@ -119,9 +119,9 @@ adlib_mca_init(const device_t *info)
|
||||
adlib_t *adlib = adlib_init(info);
|
||||
|
||||
io_removehandler(0x0388, 0x0002,
|
||||
opl2_read, NULL, NULL,
|
||||
opl2_write, NULL, NULL,
|
||||
&adlib->opl);
|
||||
adlib->opl.read, NULL, NULL,
|
||||
adlib->opl.write, NULL, NULL,
|
||||
adlib->opl.priv);
|
||||
mca_add(adlib_mca_read,
|
||||
adlib_mca_write,
|
||||
adlib_mca_feedb,
|
||||
@@ -137,7 +137,6 @@ void
|
||||
adlib_close(void *p)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
|
||||
free(adlib);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user