2020-03-25 00:49:25 +01:00
|
|
|
/*
|
2022-02-22 20:28:56 -05:00
|
|
|
* 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.
|
2020-03-25 00:49:25 +01:00
|
|
|
*
|
2022-02-22 20:28:56 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
2020-03-25 00:49:25 +01:00
|
|
|
*
|
2022-02-22 20:28:56 -05:00
|
|
|
* Sound Blaster emulation.
|
2020-03-25 00:49:25 +01:00
|
|
|
*
|
2023-01-06 15:36:29 -05:00
|
|
|
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
2022-02-22 20:28:56 -05:00
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
* TheCollector1995, <mariogplayer@gmail.com>
|
2020-03-25 00:49:25 +01:00
|
|
|
*
|
2022-02-22 20:28:56 -05:00
|
|
|
* Copyright 2008-2018 Sarah Walker.
|
|
|
|
|
* Copyright 2016-2018 Miran Grca.
|
2020-03-25 00:49:25 +01:00
|
|
|
*/
|
2022-02-18 19:47:35 -05:00
|
|
|
|
2020-03-25 00:49:25 +01:00
|
|
|
#ifndef SOUND_SND_SB_H
|
2022-02-22 20:28:56 -05:00
|
|
|
#define SOUND_SND_SB_H
|
2020-03-25 00:49:25 +01:00
|
|
|
|
2022-02-22 20:28:56 -05:00
|
|
|
#include <86box/snd_cms.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/snd_emu8k.h>
|
|
|
|
|
#include <86box/snd_mpu401.h>
|
|
|
|
|
#include <86box/snd_opl.h>
|
|
|
|
|
#include <86box/snd_sb_dsp.h>
|
2020-03-25 00:49:25 +01:00
|
|
|
|
2022-02-22 20:28:56 -05:00
|
|
|
#define SADLIB 1 /* No DSP */
|
|
|
|
|
#define SB1 2 /* DSP v1.05 */
|
|
|
|
|
#define SB15 3 /* DSP v2.00 */
|
|
|
|
|
#define SB2 4 /* DSP v2.01 - needed for high-speed DMA */
|
|
|
|
|
#define SBPRO 5 /* DSP v3.00 */
|
|
|
|
|
#define SBPRO2 6 /* DSP v3.02 + OPL3 */
|
|
|
|
|
#define SB16 7 /* DSP v4.05 + OPL3 */
|
|
|
|
|
#define SBAWE32 8 /* DSP v4.13 + OPL3 */
|
|
|
|
|
#define SBAWE64 9 /* DSP v4.16 + OPL3 */
|
2020-03-25 00:49:25 +01:00
|
|
|
|
|
|
|
|
/* SB 2.0 CD version */
|
2022-02-22 20:28:56 -05:00
|
|
|
typedef struct sb_ct1335_mixer_t {
|
|
|
|
|
double master;
|
|
|
|
|
double voice;
|
|
|
|
|
double fm;
|
|
|
|
|
double cd;
|
|
|
|
|
|
|
|
|
|
uint8_t index;
|
|
|
|
|
uint8_t regs[256];
|
2020-03-25 00:49:25 +01:00
|
|
|
} sb_ct1335_mixer_t;
|
2022-02-22 20:28:56 -05:00
|
|
|
|
2020-03-25 00:49:25 +01:00
|
|
|
/* SB PRO */
|
2022-02-22 20:28:56 -05:00
|
|
|
typedef struct sb_ct1345_mixer_t {
|
|
|
|
|
double master_l,
|
|
|
|
|
master_r;
|
|
|
|
|
double voice_l,
|
|
|
|
|
voice_r;
|
|
|
|
|
double fm_l,
|
|
|
|
|
fm_r;
|
|
|
|
|
double cd_l,
|
|
|
|
|
cd_r;
|
|
|
|
|
double line_l,
|
|
|
|
|
line_r;
|
|
|
|
|
double mic;
|
|
|
|
|
/*see sb_ct1745_mixer for values for input selector*/
|
|
|
|
|
int32_t input_selector;
|
|
|
|
|
|
|
|
|
|
int input_filter;
|
|
|
|
|
int in_filter_freq;
|
|
|
|
|
int output_filter;
|
|
|
|
|
|
|
|
|
|
int stereo;
|
|
|
|
|
int stereo_isleft;
|
|
|
|
|
|
|
|
|
|
uint8_t index;
|
|
|
|
|
uint8_t regs[256];
|
2022-02-20 02:26:27 -05:00
|
|
|
|
2020-03-25 00:49:25 +01:00
|
|
|
} sb_ct1345_mixer_t;
|
2022-02-22 20:28:56 -05:00
|
|
|
|
2020-03-25 00:49:25 +01:00
|
|
|
/* SB16 and AWE32 */
|
2022-02-22 20:28:56 -05:00
|
|
|
typedef struct sb_ct1745_mixer_t {
|
|
|
|
|
double master_l,
|
|
|
|
|
master_r;
|
|
|
|
|
double voice_l,
|
|
|
|
|
voice_r;
|
|
|
|
|
double fm_l,
|
|
|
|
|
fm_r;
|
|
|
|
|
double cd_l,
|
|
|
|
|
cd_r;
|
|
|
|
|
double line_l,
|
|
|
|
|
line_r;
|
|
|
|
|
double mic;
|
|
|
|
|
double speaker;
|
|
|
|
|
|
|
|
|
|
int bass_l,
|
|
|
|
|
bass_r;
|
|
|
|
|
int treble_l,
|
|
|
|
|
treble_r;
|
|
|
|
|
|
|
|
|
|
int output_selector;
|
|
|
|
|
#define OUTPUT_MIC 1
|
|
|
|
|
#define OUTPUT_CD_R 2
|
|
|
|
|
#define OUTPUT_CD_L 4
|
|
|
|
|
#define OUTPUT_LINE_R 8
|
|
|
|
|
#define OUTPUT_LINE_L 16
|
|
|
|
|
|
|
|
|
|
int input_selector_left;
|
|
|
|
|
int input_selector_right;
|
|
|
|
|
#define INPUT_MIC 1
|
|
|
|
|
#define INPUT_CD_R 2
|
|
|
|
|
#define INPUT_CD_L 4
|
|
|
|
|
#define INPUT_LINE_R 8
|
|
|
|
|
#define INPUT_LINE_L 16
|
|
|
|
|
#define INPUT_MIDI_R 32
|
|
|
|
|
#define INPUT_MIDI_L 64
|
|
|
|
|
|
|
|
|
|
int mic_agc;
|
|
|
|
|
|
|
|
|
|
int32_t input_gain_L;
|
|
|
|
|
int32_t input_gain_R;
|
|
|
|
|
double output_gain_L;
|
|
|
|
|
double output_gain_R;
|
|
|
|
|
|
|
|
|
|
uint8_t index;
|
|
|
|
|
uint8_t regs[256];
|
2022-02-25 19:22:45 -03:00
|
|
|
|
2022-07-27 17:00:34 -04:00
|
|
|
int output_filter; /* for clones */
|
2020-03-25 00:49:25 +01:00
|
|
|
} sb_ct1745_mixer_t;
|
|
|
|
|
|
2022-02-22 20:28:56 -05:00
|
|
|
typedef struct sb_t {
|
|
|
|
|
uint8_t cms_enabled,
|
|
|
|
|
opl_enabled,
|
|
|
|
|
mixer_enabled;
|
2022-07-27 17:00:34 -04:00
|
|
|
cms_t cms;
|
2022-07-25 20:24:31 +02:00
|
|
|
fm_drv_t opl,
|
2022-02-22 20:28:56 -05:00
|
|
|
opl2;
|
|
|
|
|
sb_dsp_t dsp;
|
|
|
|
|
union {
|
|
|
|
|
sb_ct1335_mixer_t mixer_sb2;
|
|
|
|
|
sb_ct1345_mixer_t mixer_sbpro;
|
|
|
|
|
sb_ct1745_mixer_t mixer_sb16;
|
|
|
|
|
};
|
|
|
|
|
mpu_t *mpu;
|
|
|
|
|
emu8k_t emu8k;
|
|
|
|
|
void *gameport;
|
|
|
|
|
|
|
|
|
|
int pos;
|
|
|
|
|
|
|
|
|
|
uint8_t pos_regs[8],
|
|
|
|
|
pnp_rom[512];
|
|
|
|
|
|
|
|
|
|
uint16_t opl_pnp_addr;
|
2022-11-20 13:30:31 +06:00
|
|
|
|
|
|
|
|
void *opl_mixer;
|
|
|
|
|
void (*opl_mix)(void*, double*, double*);
|
2020-03-25 00:49:25 +01:00
|
|
|
} sb_t;
|
|
|
|
|
|
2022-02-22 20:28:56 -05:00
|
|
|
extern void sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p);
|
2020-03-25 00:49:25 +01:00
|
|
|
extern uint8_t sb_ct1345_mixer_read(uint16_t addr, void *p);
|
2022-02-22 20:28:56 -05:00
|
|
|
extern void sb_ct1345_mixer_reset(sb_t *sb);
|
2020-03-25 00:49:25 +01:00
|
|
|
|
2022-07-27 17:00:34 -04:00
|
|
|
extern void sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p);
|
2022-02-25 19:22:45 -03:00
|
|
|
extern uint8_t sb_ct1745_mixer_read(uint16_t addr, void *p);
|
2022-07-27 17:00:34 -04:00
|
|
|
extern void sb_ct1745_mixer_reset(sb_t *sb);
|
2022-02-25 19:22:45 -03:00
|
|
|
|
2020-03-25 00:49:25 +01:00
|
|
|
extern void sb_get_buffer_sbpro(int32_t *buffer, int len, void *p);
|
2020-10-21 02:46:50 +02:00
|
|
|
extern void sbpro_filter_cd_audio(int channel, double *buffer, void *p);
|
2022-02-25 19:22:45 -03:00
|
|
|
extern void sb16_awe32_filter_cd_audio(int channel, double *buffer, void *p);
|
2020-03-25 00:49:25 +01:00
|
|
|
extern void sb_close(void *p);
|
|
|
|
|
extern void sb_speed_changed(void *p);
|
|
|
|
|
|
2022-02-22 20:28:56 -05:00
|
|
|
#endif /*SOUND_SND_SB_H*/
|