Switched the OPL and NukedOPL code to VARCem's reworked (and cleaner) versions.
This commit is contained in:
@@ -1,31 +1,61 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
typedef struct opl_t
|
||||
{
|
||||
int pos, chip_nr[2];
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Definitions for the OPL interface.
|
||||
*
|
||||
* Version: @(#)snd_opl.h 1.0.3 2020/07/15
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* TheCollector1995, <mariogplayer@gmail.com>
|
||||
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
||||
*
|
||||
* Copyright 2017-2020 Fred N. van Kempen.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
*/
|
||||
#ifndef SOUND_OPL_H
|
||||
# define SOUND_OPL_H
|
||||
|
||||
int32_t buffer[SOUNDBUFLEN * 2],
|
||||
buffer2[SOUNDBUFLEN * 2];
|
||||
|
||||
pc_timer_t timers[2][2];
|
||||
typedef void (*tmrfunc)(void *priv, int timer, uint64_t period);
|
||||
|
||||
/* Define an OPLx chip. */
|
||||
typedef struct {
|
||||
#ifdef SOUND_OPL_NUKED_H
|
||||
nuked_t *opl;
|
||||
#else
|
||||
void *opl;
|
||||
#endif
|
||||
int8_t is_opl3;
|
||||
|
||||
uint16_t port;
|
||||
uint8_t status;
|
||||
uint8_t status_mask;
|
||||
uint8_t timer_ctrl;
|
||||
uint16_t timer[2];
|
||||
|
||||
pc_timer_t timers[2];
|
||||
|
||||
int pos;
|
||||
int32_t buffer[SOUNDBUFLEN * 2];
|
||||
} opl_t;
|
||||
|
||||
|
||||
extern uint8_t opl2_read(uint16_t a, void *priv);
|
||||
extern void opl2_write(uint16_t a, uint8_t v, void *priv);
|
||||
extern uint8_t opl2_l_read(uint16_t a, void *priv);
|
||||
extern void opl2_l_write(uint16_t a, uint8_t v, void *priv);
|
||||
extern uint8_t opl2_r_read(uint16_t a, void *priv);
|
||||
extern void opl2_r_write(uint16_t a, uint8_t v, void *priv);
|
||||
extern uint8_t opl3_read(uint16_t a, void *priv);
|
||||
extern void opl3_write(uint16_t a, uint8_t v, void *priv);
|
||||
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 void opl2_poll(opl_t *opl, int16_t *bufl, int16_t *bufr);
|
||||
extern void opl3_poll(opl_t *opl, int16_t *bufl, int16_t *bufr);
|
||||
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 *);
|
||||
|
||||
extern void opl2_init(opl_t *opl);
|
||||
extern void opl3_init(opl_t *opl);
|
||||
|
||||
extern void opl2_update2(opl_t *opl);
|
||||
extern void opl3_update2(opl_t *opl);
|
||||
#endif /*SOUND_OPL_H*/
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/* Copyright holders: Sarah Walker, SA1988
|
||||
see COPYING for more details
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void opl_init(void (*timer_callback)(void *param, int timer, uint64_t period), void *timer_param, int nr, int is_opl3);
|
||||
void opl_write(int nr, uint16_t addr, uint8_t val);
|
||||
uint8_t opl_read(int nr, uint16_t addr);
|
||||
void opl_timer_over(int nr, int timer);
|
||||
void opl2_update(int nr, int32_t *buffer, int samples);
|
||||
void opl3_update(int nr, int32_t *buffer, int samples);
|
||||
|
||||
extern int opl_type;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
35
src/include/86box/snd_opl_nuked.h
Normal file
35
src/include/86box/snd_opl_nuked.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Definitions for the NukedOPL3 driver.
|
||||
*
|
||||
* Version: @(#)snd_opl_nuked.h 1.0.5 2020/07/16
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2017-2020 Fred N. van Kempen.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
*/
|
||||
#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*/
|
||||
@@ -113,7 +113,7 @@ typedef struct sb_ct1745_mixer_t
|
||||
typedef struct sb_t
|
||||
{
|
||||
uint8_t opl_enabled;
|
||||
opl_t opl;
|
||||
opl_t opl, opl2;
|
||||
sb_dsp_t dsp;
|
||||
union {
|
||||
sb_ct1335_mixer_t mixer_sb2;
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2013-2018 Alexey Khokholov (Nuke.YKT)
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// Nuked OPL3 emulator.
|
||||
// Thanks:
|
||||
// MAME Development Team(Jarek Burczynski, Tatsuyuki Satoh):
|
||||
// Feedback and Rhythm part calculation information.
|
||||
// forums.submarine.org.uk(carbon14, opl3):
|
||||
// Tremolo and phase generator calculation information.
|
||||
// OPLx decapsulated(Matthew Gambrell, Olli Niemitalo):
|
||||
// OPL2 ROMs.
|
||||
// siliconpr0n.org(John McMaster, digshadow):
|
||||
// YMF262 and VRC VII decaps and die shots.
|
||||
//
|
||||
// version: 1.8
|
||||
//
|
||||
|
||||
#ifndef NUKEDOPL_H
|
||||
#define NUKEDOPL_H
|
||||
#define OPL_WRITEBUF_SIZE 1024
|
||||
#define OPL_WRITEBUF_DELAY 1
|
||||
|
||||
//#include "dosbox.h"
|
||||
#include <stdint.h>
|
||||
typedef signed int Bits;
|
||||
typedef unsigned int Bitu;
|
||||
typedef int8_t Bit8s;
|
||||
typedef uint8_t Bit8u;
|
||||
typedef int16_t Bit16s;
|
||||
typedef uint16_t Bit16u;
|
||||
typedef int32_t Bit32s;
|
||||
typedef uint32_t Bit32u;
|
||||
typedef int64_t Bit64s;
|
||||
typedef uint64_t Bit64u;
|
||||
|
||||
struct opl3_slot;
|
||||
struct opl3_channel;
|
||||
struct opl3_writebuf;
|
||||
struct opl3_chip;
|
||||
|
||||
struct opl3_slot {
|
||||
struct opl3_channel *channel;
|
||||
struct opl3_chip *chip;
|
||||
Bit16s out;
|
||||
Bit16s fbmod;
|
||||
Bit16s *mod;
|
||||
Bit16s prout;
|
||||
Bit16s eg_rout;
|
||||
Bit16s eg_out;
|
||||
Bit8u eg_inc;
|
||||
Bit8u eg_gen;
|
||||
Bit8u eg_rate;
|
||||
Bit8u eg_ksl;
|
||||
Bit8u *trem;
|
||||
Bit8u reg_vib;
|
||||
Bit8u reg_type;
|
||||
Bit8u reg_ksr;
|
||||
Bit8u reg_mult;
|
||||
Bit8u reg_ksl;
|
||||
Bit8u reg_tl;
|
||||
Bit8u reg_ar;
|
||||
Bit8u reg_dr;
|
||||
Bit8u reg_sl;
|
||||
Bit8u reg_rr;
|
||||
Bit8u reg_wf;
|
||||
Bit8u key;
|
||||
Bit32u pg_reset;
|
||||
Bit32u pg_phase;
|
||||
Bit16u pg_phase_out;
|
||||
Bit8u slot_num;
|
||||
};
|
||||
|
||||
struct opl3_channel {
|
||||
struct opl3_slot *slots[2];
|
||||
struct opl3_channel *pair;
|
||||
struct opl3_chip *chip;
|
||||
Bit16s *out[4];
|
||||
Bit8u chtype;
|
||||
Bit16u f_num;
|
||||
Bit8u block;
|
||||
Bit8u fb;
|
||||
Bit8u con;
|
||||
Bit8u alg;
|
||||
Bit8u ksv;
|
||||
Bit16u cha, chb;
|
||||
Bit8u ch_num;
|
||||
};
|
||||
|
||||
struct opl3_writebuf {
|
||||
Bit64u time;
|
||||
Bit16u reg;
|
||||
Bit8u data;
|
||||
};
|
||||
|
||||
struct opl3_chip {
|
||||
struct opl3_channel channel[18];
|
||||
struct opl3_slot slot[36];
|
||||
Bit16u timer;
|
||||
Bit64u eg_timer;
|
||||
Bit8u eg_timerrem;
|
||||
Bit8u eg_state;
|
||||
Bit8u eg_add;
|
||||
Bit8u newm;
|
||||
Bit8u nts;
|
||||
Bit8u rhy;
|
||||
Bit8u vibpos;
|
||||
Bit8u vibshift;
|
||||
Bit8u tremolo;
|
||||
Bit8u tremolopos;
|
||||
Bit8u tremoloshift;
|
||||
Bit32u noise;
|
||||
Bit16s zeromod;
|
||||
Bit32s mixbuff[2];
|
||||
Bit8u rm_hh_bit2;
|
||||
Bit8u rm_hh_bit3;
|
||||
Bit8u rm_hh_bit7;
|
||||
Bit8u rm_hh_bit8;
|
||||
Bit8u rm_tc_bit3;
|
||||
Bit8u rm_tc_bit5;
|
||||
//OPL3L
|
||||
Bit32s rateratio;
|
||||
Bit32s samplecnt;
|
||||
Bit32s oldsamples[2];
|
||||
Bit32s samples[2];
|
||||
|
||||
Bit64u writebuf_samplecnt;
|
||||
Bit32u writebuf_cur;
|
||||
Bit32u writebuf_last;
|
||||
Bit64u writebuf_lasttime;
|
||||
struct opl3_writebuf writebuf[OPL_WRITEBUF_SIZE];
|
||||
};
|
||||
|
||||
void OPL3_Generate(struct opl3_chip *chip, Bit32s *buf);
|
||||
void OPL3_GenerateResampled(struct opl3_chip *chip, Bit32s *buf);
|
||||
void OPL3_Reset(struct opl3_chip *chip, Bit32u samplerate);
|
||||
Bit32u OPL3_WriteAddr(struct opl3_chip *chip, Bit32u port, Bit8u val);
|
||||
void OPL3_WriteReg(struct opl3_chip *chip, Bit16u reg, Bit8u v);
|
||||
void OPL3_WriteRegBuffered(struct opl3_chip *chip, Bit16u reg, Bit8u v);
|
||||
void OPL3_GenerateStream(struct opl3_chip *chip, Bit32s *sndptr, Bit32u numsamples);
|
||||
#endif
|
||||
Reference in New Issue
Block a user