Switched the OPL and NukedOPL code to VARCem's reworked (and cleaner) versions.

This commit is contained in:
OBattler
2020-07-19 03:24:45 +02:00
parent 3a4953036f
commit 4f3ae96b63
15 changed files with 1806 additions and 1900 deletions

View File

@@ -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*/

View File

@@ -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

View 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*/

View File

@@ -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;