mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-06-02 16:48:43 +02:00
Processing sound.h
This commit is contained in:
parent
df8e3991a6
commit
7d133a44c0
|
@ -77,23 +77,6 @@ static const uint16_t chanVolume[16] = {
|
|||
0 /* OFF */
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
int clocks;
|
||||
int latch;
|
||||
int zeroFreqInc;
|
||||
int noiseShiftValue;
|
||||
int noiseShiftWidth;
|
||||
int noiseBitMask;
|
||||
int regs[8];
|
||||
int freqInc[4];
|
||||
int freqCounter[4];
|
||||
int polarity[4];
|
||||
int chanDelta[4][2];
|
||||
int chanOut[4][2];
|
||||
int chanAmp[4][2];
|
||||
} psg;
|
||||
|
||||
static void psg_update(unsigned int clocks);
|
||||
|
||||
void psg_init(PSG_TYPE type)
|
||||
|
|
|
@ -49,6 +49,23 @@ typedef enum {
|
|||
PSG_INTEGRATED
|
||||
} PSG_TYPE;
|
||||
|
||||
struct psg_t
|
||||
{
|
||||
int clocks;
|
||||
int latch;
|
||||
int zeroFreqInc;
|
||||
int noiseShiftValue;
|
||||
int noiseShiftWidth;
|
||||
int noiseBitMask;
|
||||
int regs[8];
|
||||
int freqInc[4];
|
||||
int freqCounter[4];
|
||||
int polarity[4];
|
||||
int chanDelta[4][2];
|
||||
int chanOut[4][2];
|
||||
int chanAmp[4][2];
|
||||
};
|
||||
|
||||
/* Function prototypes */
|
||||
extern void psg_init(PSG_TYPE type);
|
||||
extern void psg_reset(void);
|
||||
|
|
|
@ -49,54 +49,15 @@
|
|||
#include "ym2612.h"
|
||||
#include "sound.h"
|
||||
|
||||
#ifdef HAVE_YM3438_CORE
|
||||
#include "ym3438.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPLL_CORE
|
||||
#include "opll.h"
|
||||
#endif
|
||||
|
||||
/* YM2612 internal clock = input clock / 6 = (master clock / 7) / 6 */
|
||||
#define YM2612_CLOCK_RATIO (7*6)
|
||||
|
||||
/* FM output buffer (large enough to hold a whole frame at original chips rate) */
|
||||
#if defined(HAVE_YM3438_CORE) || defined(HAVE_OPLL_CORE)
|
||||
int fm_buffer[1080 * 2 * 24];
|
||||
#else
|
||||
int fm_buffer[1080 * 2];
|
||||
#endif
|
||||
|
||||
int fm_last[2];
|
||||
int *fm_ptr;
|
||||
|
||||
/* Cycle-accurate FM samples */
|
||||
int fm_cycles_ratio;
|
||||
int fm_cycles_start;
|
||||
int fm_cycles_count;
|
||||
int fm_cycles_busy;
|
||||
|
||||
/* YM chip function pointers */
|
||||
void (*YM_Update)(int *buffer, int length);
|
||||
void (*fm_reset)(unsigned int cycles);
|
||||
void (*fm_write)(unsigned int cycles, unsigned int address, unsigned int data);
|
||||
unsigned int (*fm_read)(unsigned int cycles, unsigned int address);
|
||||
|
||||
#ifdef HAVE_YM3438_CORE
|
||||
ym3438_t ym3438;
|
||||
short ym3438_accm[24][2];
|
||||
int ym3438_sample[2];
|
||||
int ym3438_cycles;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPLL_CORE
|
||||
opll_t opll;
|
||||
int opll_accm[18][2];
|
||||
int opll_sample;
|
||||
int opll_cycles;
|
||||
int opll_status;
|
||||
#endif
|
||||
|
||||
/* Run FM chip until required M-cycles */
|
||||
INLINE void fm_update(int cycles)
|
||||
{
|
||||
|
|
34
core/state.c
34
core/state.c
|
@ -88,6 +88,40 @@ int m68k_irq_latency;
|
|||
|
||||
int s68k_irq_latency;
|
||||
|
||||
// sound/psg.c
|
||||
|
||||
struct psg_t psg;
|
||||
|
||||
// sound/sound.c
|
||||
|
||||
#if defined(HAVE_YM3438_CORE) || defined(HAVE_OPLL_CORE)
|
||||
int fm_buffer[1080 * 2 * 24]; // FM output buffer (large enough to hold a whole frame at original chips rate)
|
||||
#else
|
||||
int fm_buffer[1080 * 2];
|
||||
#endif
|
||||
|
||||
int fm_last[2];
|
||||
int *fm_ptr;
|
||||
int fm_cycles_ratio; // Cycle-accurate FM samples
|
||||
int fm_cycles_start;
|
||||
int fm_cycles_count;
|
||||
int fm_cycles_busy;
|
||||
|
||||
#ifdef HAVE_YM3438_CORE
|
||||
ym3438_t ym3438;
|
||||
short ym3438_accm[24][2];
|
||||
int ym3438_sample[2];
|
||||
int ym3438_cycles;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPLL_CORE
|
||||
opll_t opll;
|
||||
int opll_accm[18][2];
|
||||
int opll_sample;
|
||||
int opll_cycles;
|
||||
int opll_status;
|
||||
#endif
|
||||
|
||||
// genesis.c
|
||||
|
||||
uint8_t boot_rom[0x800];
|
||||
|
|
43
core/state.h
43
core/state.h
|
@ -19,6 +19,7 @@
|
|||
#include "input_hw/teamplayer.h"
|
||||
#include "input_hw/terebi_oekaki.h"
|
||||
#include "input_hw/xe_1ap.h"
|
||||
#include "sound/psg.h"
|
||||
#include "m68k/m68k.h"
|
||||
#include "sound/eq.h"
|
||||
#include "genesis.h"
|
||||
|
@ -31,6 +32,14 @@
|
|||
#include "ntsc/md_ntsc.h"
|
||||
#include "ntsc/sms_ntsc.h"
|
||||
|
||||
#ifdef HAVE_YM3438_CORE
|
||||
#include "sound/ym3438.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPLL_CORE
|
||||
#include "sound/opll.h"
|
||||
#endif
|
||||
|
||||
// cart_hw/svp.h
|
||||
|
||||
// Special case, as svp is inside the cart.rom allocation
|
||||
|
@ -123,6 +132,40 @@ extern int m68k_irq_latency;
|
|||
|
||||
extern int s68k_irq_latency;
|
||||
|
||||
// sound/psg.h
|
||||
|
||||
extern struct psg_t psg;
|
||||
|
||||
// sound/sound.h
|
||||
|
||||
#if defined(HAVE_YM3438_CORE) || defined(HAVE_OPLL_CORE)
|
||||
extern int fm_buffer[1080 * 2 * 24]; // FM output buffer (large enough to hold a whole frame at original chips rate)
|
||||
#else
|
||||
extern int fm_buffer[1080 * 2];
|
||||
#endif
|
||||
|
||||
extern int fm_last[2];
|
||||
extern int *fm_ptr;
|
||||
extern int fm_cycles_ratio; // Cycle-accurate FM samples
|
||||
extern int fm_cycles_start;
|
||||
extern int fm_cycles_count;
|
||||
extern int fm_cycles_busy;
|
||||
|
||||
#ifdef HAVE_YM3438_CORE
|
||||
extern ym3438_t ym3438;
|
||||
extern short ym3438_accm[24][2];
|
||||
extern int ym3438_sample[2];
|
||||
extern int ym3438_cycles;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPLL_CORE
|
||||
extern opll_t opll;
|
||||
extern int opll_accm[18][2];
|
||||
extern int opll_sample;
|
||||
extern int opll_cycles;
|
||||
extern int opll_status;
|
||||
#endif
|
||||
|
||||
// genesis.h
|
||||
|
||||
extern uint8_t boot_rom[0x800];
|
||||
|
|
Loading…
Reference in New Issue
Block a user