mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-04 23:07:46 -04:00
audio: add option to switch off SSG-EG
This commit is contained in:
parent
1dbda5f894
commit
324bd6852e
9 changed files with 21 additions and 17 deletions
|
@ -48,7 +48,7 @@ void PsndRerate(int preserve_state)
|
|||
ym2612_pack_state();
|
||||
memcpy(state, YM2612GetRegs(), 0x204);
|
||||
}
|
||||
YM2612Init(Pico.m.pal ? OSC_PAL/7 : OSC_NTSC/7, PicoIn.sndRate);
|
||||
YM2612Init(Pico.m.pal ? OSC_PAL/7 : OSC_NTSC/7, PicoIn.sndRate, !(PicoIn.opt&POPT_DIS_FM_SSGEG));
|
||||
if (preserve_state) {
|
||||
// feed it back it's own registers, just like after loading state
|
||||
memcpy(YM2612GetRegs(), state, 0x204);
|
||||
|
|
|
@ -1820,17 +1820,17 @@ int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty)
|
|||
// flags: stereo, ssg_enabled, disabled, _, pan_r, pan_l
|
||||
chan_render_prep();
|
||||
#define BIT_IF(v,b,c) { v &= ~(1<<(b)); if (c) v |= 1<<(b); }
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x00000f));
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x00000f) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0x00000f) active_chs |= chan_render(buffer, length, 0, flags|((pan&0x003)<<4)) << 0;
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x0000f0));
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x0000f0) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0x0000f0) active_chs |= chan_render(buffer, length, 1, flags|((pan&0x00c)<<2)) << 1;
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x000f00));
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x000f00) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0x000f00) active_chs |= chan_render(buffer, length, 2, flags|((pan&0x030) )) << 2;
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x00f000));
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x00f000) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0x00f000) active_chs |= chan_render(buffer, length, 3, flags|((pan&0x0c0)>>2)) << 3;
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x0f0000));
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0x0f0000) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0x0f0000) active_chs |= chan_render(buffer, length, 4, flags|((pan&0x300)>>4)) << 4;
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0xf00000));
|
||||
BIT_IF(flags, 1, (ym2612.ssg_mask & 0xf00000) && (ym2612.OPN.ST.flags & 1));
|
||||
if (ym2612.slot_mask & 0xf00000) active_chs |= chan_render(buffer, length, 5, flags|((pan&0xc00)>>6)|(!!ym2612.dacen<<2)) << 5;
|
||||
#undef BIT_IF
|
||||
chan_render_finish();
|
||||
|
@ -1840,13 +1840,14 @@ int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty)
|
|||
|
||||
|
||||
/* initialize YM2612 emulator */
|
||||
void YM2612Init_(int clock, int rate)
|
||||
void YM2612Init_(int clock, int rate, int ssg)
|
||||
{
|
||||
memset(&ym2612, 0, sizeof(ym2612));
|
||||
init_tables();
|
||||
|
||||
ym2612.OPN.ST.clock = clock;
|
||||
ym2612.OPN.ST.rate = rate;
|
||||
ym2612.OPN.ST.flags = (ssg ? 1:0);
|
||||
|
||||
OPNSetPres( 6*24 );
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ typedef struct
|
|||
UINT8 address; /* 10 address register | need_save */
|
||||
UINT8 status; /* 11 status flag | need_save */
|
||||
UINT8 mode; /* mode CSM / 3SLOT */
|
||||
UINT8 pad;
|
||||
UINT8 flags; /* operational flags */
|
||||
int TA; /* timer a */
|
||||
int TAC; /* timer a maxval */
|
||||
int TAT; /* timer a ticker | need_save */
|
||||
|
@ -161,7 +161,7 @@ typedef struct
|
|||
extern YM2612 ym2612;
|
||||
#endif
|
||||
|
||||
void YM2612Init_(int baseclock, int rate);
|
||||
void YM2612Init_(int baseclock, int rate, int ssg);
|
||||
void YM2612ResetChip_(void);
|
||||
int YM2612UpdateOne_(int *buffer, int length, int stereo, int is_buf_empty);
|
||||
|
||||
|
@ -183,9 +183,9 @@ int YM2612PicoStateLoad2(int *tat, int *tbt);
|
|||
#else
|
||||
/* GP2X specific */
|
||||
#include "../../platform/gp2x/940ctl.h"
|
||||
#define YM2612Init(baseclock,rate) do { \
|
||||
if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate); \
|
||||
else YM2612Init_(baseclock, rate); \
|
||||
#define YM2612Init(baseclock,rate,ssg) do { \
|
||||
if (PicoIn.opt&POPT_EXT_FM) YM2612Init_940(baseclock, rate, ssg); \
|
||||
else YM2612Init_(baseclock, rate, ssg); \
|
||||
} while (0)
|
||||
#define YM2612ResetChip() do { \
|
||||
if (PicoIn.opt&POPT_EXT_FM) YM2612ResetChip_940(); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue