This commit is contained in:
Jasmine Iwanek
2024-12-19 03:29:07 -05:00
parent 7b9d025a26
commit a05582320e
3 changed files with 54 additions and 23 deletions

View File

@@ -18,29 +18,30 @@
#define SOUND_OPL_H
enum fm_type {
FM_YM3526 = 0, /* OPL */
FM_Y8950 = 1, /* MSX-Audio (OPL with ADPCM) */
FM_YM3812 = 2, /* OPL2 */
FM_YMF262 = 3, /* OPL3 */
FM_YMF289B = 4, /* OPL3-L */
FM_YMF278B = 5, /* OPL4 */
FM_YM2413 = 6, /* OPLL */
FM_YM2423 = 7, /* OPLL-X */
FM_YMF281 = 8, /* OPLLP */
FM_DS1001 = 9, /* Konami VRC7 MMC */
FM_YM2151 = 10, /* OPM */
FM_YM2203 = 11, /* OPN */
FM_YM2608 = 12, /* OPNA */
FM_YMF288 = 13, /* OPN3L */
FM_YM2610 = 14, /* OPNB */
FM_YM2610B = 15, /* OPNB2 */
FM_YM2612 = 16, /* OPN2 */
FM_YM3438 = 17, /* OPN2C */
FM_YMF276 = 18, /* OPN2L */
FM_YM2164 = 19, /* OPP */
FM_ESFM = 20, /* ESFM */
FM_OPL2BOARD = 21, /* OPL2Board (External Device) */
FM_MAX = 22
FM_YM2149 = 0, /* SSG */
FM_YM3526 = 1, /* OPL */
FM_Y8950 = 2, /* MSX-Audio (OPL with ADPCM) */
FM_YM3812 = 3, /* OPL2 */
FM_YMF262 = 4, /* OPL3 */
FM_YMF289B = 5, /* OPL3-L */
FM_YMF278B = 6, /* OPL4 */
FM_YM2413 = 7, /* OPLL */
FM_YM2423 = 8, /* OPLL-X */
FM_YMF281 = 9, /* OPLLP */
FM_DS1001 = 10, /* Konami VRC7 MMC */
FM_YM2151 = 11, /* OPM */
FM_YM2203 = 12, /* OPN */
FM_YM2608 = 13, /* OPNA */
FM_YMF288 = 14, /* OPN3L */
FM_YM2610 = 15, /* OPNB */
FM_YM2610B = 16, /* OPNB2 */
FM_YM2612 = 17, /* OPN2 */
FM_YM3438 = 18, /* OPN2C */
FM_YMF276 = 19, /* OPN2L */
FM_YM2164 = 20, /* OPP */
FM_ESFM = 21, /* ESFM */
FM_OPL2BOARD = 22, /* OPL2Board (External Device) */
FM_MAX = 23
};
enum fm_driver {
@@ -70,6 +71,8 @@ extern const fm_drv_t ymfm_opl2board_drv;
extern const device_t ym3812_nuked_device;
extern const device_t ymf262_nuked_device;
extern const device_t ym2149_ymfm_device;
/* OPL Series */
extern const device_t ym3526_ymfm_device;
extern const device_t y8950_ymfm_device;

View File

@@ -39,6 +39,11 @@ uint8_t
fm_driver_get(int chip_id, fm_drv_t *drv)
{
switch (chip_id) {
case FM_YM2149: /* SSG */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym2149_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);
break;
case FM_YM3526: /* OPL */
*drv = ymfm_drv;
drv->priv = device_add_inst(&ym3526_ymfm_device, fm_dev_inst[fm_driver][chip_id]++);

View File

@@ -19,9 +19,13 @@
#include <cstdlib>
#include <cstring>
#include "ymfm/ymfm_ssg.h"
#include "ymfm/ymfm_misc.h"
#include "ymfm/ymfm_opl.h"
#include "ymfm/ymfm_opm.h"
#include "ymfm/ymfm_opn.h"
#include "ymfm/ymfm_opq.h"
#include "ymfm/ymfm_opx.h"
#include "ymfm/ymfm_opz.h"
extern "C" {
#define HAVE_STDARG_H
@@ -322,6 +326,11 @@ ymfm_drv_init(const device_t *info)
YMFMChipBase *fm;
switch (info->local) {
case FM_YM2149: /* OPL */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym2149>(14318181, FM_YM2149, FREQ_49716);
break;
case FM_YM3526: /* OPL */
// TODO: Check rates and frequency
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym3526>(14318181, FM_YM3526, FREQ_49716);
@@ -500,6 +509,20 @@ ymfm_drv_generate(void *priv, int32_t *data, uint32_t num_samples)
drv->generate(data, num_samples);
}
const device_t ym2149_ymfm_device = {
.name = "Yamaha 2149 SSG (YMFM)",
.internal_name = "ym2149_ymfm",
.flags = 0,
.local = FM_YM2149,
.init = ymfm_drv_init,
.close = ymfm_drv_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ym3526_ymfm_device = {
.name = "Yamaha YM3526 OPL (YMFM)",
.internal_name = "ym3526_ymfm",