mirror of
https://github.com/libretro/beetle-pce-fast-libretro.git
synced 2024-11-26 17:40:40 +00:00
Remove hw_sound
This commit is contained in:
parent
8d498cef10
commit
3ed7691139
4
Makefile
4
Makefile
@ -289,7 +289,7 @@ TRIO_SOURCES += $(MEDNAFEN_DIR)/trio/trio.c $(MEDNAFEN_DIR)/trio/triostr.c
|
||||
|
||||
SOURCES_C := $(TREMOR_SRC) $(LIBRETRO_SOURCES_C) $(TRIO_SOURCES) $(THREAD_SOURCES)
|
||||
|
||||
SOURCES := $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(HW_CPU_SOURCES) $(HW_MISC_SOURCES) $(HW_SOUND_SOURCES) $(HW_VIDEO_SOURCES)
|
||||
SOURCES := $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(HW_CPU_SOURCES) $(HW_MISC_SOURCES) $(HW_VIDEO_SOURCES)
|
||||
|
||||
WARNINGS := -Wall \
|
||||
-Wno-sign-compare \
|
||||
@ -321,7 +321,7 @@ endif
|
||||
|
||||
LDFLAGS += $(fpic) $(SHARED)
|
||||
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
|
||||
FLAGS += -I. -Imednafen -Imednafen/include -Imednafen/intl -Imednafen/hw_misc -Imednafen/hw_sound -Imednafen/hw_cpu $(CORE_INCDIR) $(EXTRA_CORE_INCDIR)
|
||||
FLAGS += -I. -Imednafen -Imednafen/include -Imednafen/intl -Imednafen/hw_misc -Imednafen/hw_cpu $(CORE_INCDIR) $(EXTRA_CORE_INCDIR)
|
||||
|
||||
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.31\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=931 -DPSS_STYLE=1 -DMPC_FIXED_POINT $(CORE_DEFINE) -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -D_LOW_ACCURACY_ $(EXTRA_INCLUDES) $(SOUND_DEFINE)
|
||||
|
||||
|
@ -112,7 +112,7 @@ LIBRETRO_SOURCES := $(MEDNAFEN_LIBRETRO_DIR)/libretro.cpp
|
||||
|
||||
SOURCES_C := $(TREMOR_SRC) $(LIBRETRO_SOURCES_C) $(MEDNAFEN_DIR)/trio/trio.c $(MEDNAFEN_DIR)/trio/triostr.c $(THREAD_SOURCES)
|
||||
|
||||
LOCAL_SRC_FILES += $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(CDROM_SOURCES) $(SCSI_CD_SOURCES) $(HW_MISC_SOURCES) $(HW_SOUND_SOURCES) $(HW_VIDEO_SOURCES) $(SOURCES_C) $(CORE_CD_SOURCES)
|
||||
LOCAL_SRC_FILES += $(LIBRETRO_SOURCES) $(CORE_SOURCES) $(MEDNAFEN_SOURCES) $(CDROM_SOURCES) $(SCSI_CD_SOURCES) $(HW_MISC_SOURCES) $(HW_VIDEO_SOURCES) $(SOURCES_C) $(CORE_CD_SOURCES)
|
||||
|
||||
WARNINGS := -Wall \
|
||||
-Wno-sign-compare \
|
||||
@ -145,7 +145,7 @@ endif
|
||||
|
||||
LDFLAGS += $(fpic) $(SHARED)
|
||||
FLAGS += $(fpic) $(NEW_GCC_FLAGS)
|
||||
LOCAL_C_INCLUDES += .. ../mednafen ../mednafen/include ../mednafen/intl ../mednafen/hw_cpu ../mednafen/hw_sound ../mednafen/hw_misc $(CORE_INCDIR) $(EXTRA_CORE_INCDIR)
|
||||
LOCAL_C_INCLUDES += .. ../mednafen ../mednafen/include ../mednafen/intl ../mednafen/hw_cpu ../mednafen/hw_misc $(CORE_INCDIR) $(EXTRA_CORE_INCDIR)
|
||||
|
||||
FLAGS += $(ENDIANNESS_DEFINES) -DSIZEOF_DOUBLE=8 $(WARNINGS) -DMEDNAFEN_VERSION=\"0.9.26\" -DPACKAGE=\"mednafen\" -DMEDNAFEN_VERSION_NUMERIC=926 -DPSS_STYLE=1 -DMPC_FIXED_POINT $(CORE_DEFINE) -DSTDC_HEADERS -D__STDC_LIMIT_MACROS -D__LIBRETRO__ -DNDEBUG -D_LOW_ACCURACY_ $(SOUND_DEFINE) -DLSB_FIRST
|
||||
|
||||
|
@ -1,904 +0,0 @@
|
||||
/* Mednafen - Multi-system Emulator
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "mednafen/mednafen.h"
|
||||
#include "pce_psg.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
// Frequency cache cutoff optimization threshold (<= FREQC7M_COT)
|
||||
#define FREQC7M_COT 0x7 //0xA
|
||||
|
||||
void PCE_PSG::SetVolume(double new_volume)
|
||||
{
|
||||
for(int vl = 0; vl < 32; vl++)
|
||||
{
|
||||
double flub = 1.0 * new_volume * 8 / 6;
|
||||
|
||||
if(vl)
|
||||
flub /= powf(2, (double)1 / 4 * vl); // ~1.5dB reduction per increment of vl
|
||||
|
||||
if(vl == 0x1F)
|
||||
flub = 0;
|
||||
|
||||
for(int samp = 0; samp < 32; samp++)
|
||||
{
|
||||
int eff_samp;
|
||||
|
||||
if(revision == REVISION_HUC6280)
|
||||
eff_samp = samp * 2;
|
||||
else
|
||||
eff_samp = samp * 2 - 0x1F;
|
||||
|
||||
dbtable[vl][samp] = (int32)(flub * eff_samp * 128); // * 256);
|
||||
dbtable_volonly[vl] = (int32)(flub * 65536);
|
||||
|
||||
// dbtable[vl][samp] = (int32)(flub * eff_samp * 128);
|
||||
// dbtable_volonly[vl] = (int32)(flub * 65536);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Changing the 0x1F(not that there should be) would require changing the channel pseudo-off volume check logic later on.
|
||||
static const int scale_tab[] =
|
||||
{
|
||||
0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
|
||||
0x10, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F
|
||||
};
|
||||
|
||||
#define CLOCK_LFSR(lfsr) { unsigned int newbit = ((lfsr >> 0) ^ (lfsr >> 1) ^ (lfsr >> 11) ^ (lfsr >> 12) ^ (lfsr >> 17)) & 1; lfsr = (lfsr >> 1) | (newbit << 17); }
|
||||
|
||||
static const int16 Phase_Filter[2][7] =
|
||||
{
|
||||
/* 0 */ { 35, 250, 579, 641, 425, 112, 6 }, // 2048
|
||||
/* 1 */ { 6, 112, 425, 641, 579, 250, 35 }, // 2048
|
||||
};
|
||||
|
||||
INLINE void PCE_PSG::UpdateOutputSub(const int32 timestamp, psg_channel *ch, const int32 samp0, const int32 samp1)
|
||||
{
|
||||
int32 delta[2];
|
||||
|
||||
delta[0] = samp0 - ch->blip_prev_samp[0];
|
||||
delta[1] = samp1 - ch->blip_prev_samp[1];
|
||||
|
||||
const int16* c = Phase_Filter[(timestamp >> 1) & 1];
|
||||
const int32 l = (timestamp >> 2) & 0xFFFF;
|
||||
|
||||
HRBufs[0][l + 0] += delta[0] * c[0];
|
||||
HRBufs[0][l + 1] += delta[0] * c[1];
|
||||
HRBufs[0][l + 2] += delta[0] * c[2];
|
||||
HRBufs[0][l + 3] += delta[0] * c[3];
|
||||
HRBufs[0][l + 4] += delta[0] * c[4];
|
||||
HRBufs[0][l + 5] += delta[0] * c[5];
|
||||
HRBufs[0][l + 6] += delta[0] * c[6];
|
||||
|
||||
HRBufs[1][l + 0] += delta[1] * c[0];
|
||||
HRBufs[1][l + 1] += delta[1] * c[1];
|
||||
HRBufs[1][l + 2] += delta[1] * c[2];
|
||||
HRBufs[1][l + 3] += delta[1] * c[3];
|
||||
HRBufs[1][l + 4] += delta[1] * c[4];
|
||||
HRBufs[1][l + 5] += delta[1] * c[5];
|
||||
HRBufs[1][l + 6] += delta[1] * c[6];
|
||||
|
||||
ch->blip_prev_samp[0] = samp0;
|
||||
ch->blip_prev_samp[1] = samp1;
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateOutput_Norm(const int32 timestamp, psg_channel *ch)
|
||||
{
|
||||
int sv = ch->dda;
|
||||
|
||||
UpdateOutputSub(timestamp, ch, dbtable[ch->vl[0]][sv],
|
||||
dbtable[ch->vl[1]][sv]);
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateOutput_Noise(const int32 timestamp, psg_channel *ch)
|
||||
{
|
||||
int sv = ((ch->lfsr & 1) << 5) - (ch->lfsr & 1); //(ch->lfsr & 0x1) ? 0x1F : 0;
|
||||
|
||||
UpdateOutputSub(timestamp, ch, dbtable[ch->vl[0]][sv],
|
||||
dbtable[ch->vl[1]][sv]);
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateOutput_Off(const int32 timestamp, psg_channel *ch)
|
||||
{
|
||||
UpdateOutputSub(timestamp, ch, 0, 0);
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateOutput_Accum_HuC6280A(const int32 timestamp, psg_channel *ch)
|
||||
{
|
||||
int32 samp[2];
|
||||
|
||||
// 31(5-bit max) * 32 samples = 992
|
||||
// 992 / 2 = 496
|
||||
//
|
||||
// 8 + 5 = 13
|
||||
// 13 - 12 = 1
|
||||
|
||||
samp[0] = ((int32)dbtable_volonly[ch->vl[0]] * ((int32)ch->samp_accum - 496)) >> (8 + 5);
|
||||
samp[1] = ((int32)dbtable_volonly[ch->vl[1]] * ((int32)ch->samp_accum - 496)) >> (8 + 5);
|
||||
|
||||
UpdateOutputSub(timestamp, ch, samp[0], samp[1]);
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateOutput_Accum_HuC6280(const int32 timestamp, psg_channel *ch)
|
||||
{
|
||||
int32 samp[2];
|
||||
|
||||
samp[0] = ((int32)dbtable_volonly[ch->vl[0]] * (int32)ch->samp_accum) >> (8 + 5);
|
||||
samp[1] = ((int32)dbtable_volonly[ch->vl[1]] * (int32)ch->samp_accum) >> (8 + 5);
|
||||
|
||||
UpdateOutputSub(timestamp, ch, samp[0], samp[1]);
|
||||
}
|
||||
|
||||
|
||||
// This function should always be called after RecalcFreqCache() (it's not called from RecalcFreqCache to avoid redundant code)
|
||||
void PCE_PSG::RecalcUOFunc(int chnum)
|
||||
{
|
||||
psg_channel *ch = &channel[chnum];
|
||||
|
||||
//printf("UO Update: %d, %02x\n", chnum, ch->control);
|
||||
|
||||
if((revision != REVISION_HUC6280 && !(ch->control & 0xC0)) || (revision == REVISION_HUC6280 && !(ch->control & 0x80)))
|
||||
ch->UpdateOutput = &PCE_PSG::UpdateOutput_Off;
|
||||
else if(ch->noisectrl & ch->control & 0x80)
|
||||
ch->UpdateOutput = &PCE_PSG::UpdateOutput_Noise;
|
||||
// If the control for the channel is in waveform play mode, and the (real) playback frequency is too high, and the channel is either not the LFO modulator channel or
|
||||
// if the LFO trigger bit(which halts the LFO modulator channel's waveform incrementing when set) is clear
|
||||
else if((ch->control & 0xC0) == 0x80 && ch->freq_cache <= FREQC7M_COT && (chnum != 1 || !(lfoctrl & 0x80)) )
|
||||
ch->UpdateOutput = UpdateOutput_Accum;
|
||||
else
|
||||
ch->UpdateOutput = &PCE_PSG::UpdateOutput_Norm;
|
||||
}
|
||||
|
||||
|
||||
void PCE_PSG::RecalcFreqCache(int chnum)
|
||||
{
|
||||
psg_channel *ch = &channel[chnum];
|
||||
|
||||
if(chnum == 0 && (lfoctrl & 0x03))
|
||||
{
|
||||
const uint32 shift = (((lfoctrl & 0x3) - 1) << 1);
|
||||
uint8 la = channel[1].dda;
|
||||
int32 tmp_freq = ((int32)ch->frequency + ((la - 0x10) << shift)) & 0xFFF;
|
||||
|
||||
ch->freq_cache = (tmp_freq ? tmp_freq : 4096) << 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch->freq_cache = (ch->frequency ? ch->frequency : 4096) << 1;
|
||||
|
||||
if(chnum == 1 && (lfoctrl & 0x03))
|
||||
ch->freq_cache *= lfofreq ? lfofreq : 256;
|
||||
}
|
||||
}
|
||||
|
||||
void PCE_PSG::RecalcNoiseFreqCache(int chnum)
|
||||
{
|
||||
psg_channel *ch = &channel[chnum];
|
||||
int32 freq = 0x1F - (ch->noisectrl & 0x1F);
|
||||
|
||||
if(!freq)
|
||||
freq = 0x20;
|
||||
else
|
||||
freq <<= 6;
|
||||
|
||||
freq <<= 1;
|
||||
|
||||
ch->noise_freq_cache = freq;
|
||||
}
|
||||
|
||||
void PCE_PSG::PeekWave(const unsigned int ch, uint32 Address, uint32 Length, uint8 *Buffer)
|
||||
{
|
||||
assert(ch <= 5);
|
||||
|
||||
while(Length--)
|
||||
{
|
||||
Address &= 0x1F;
|
||||
*Buffer = channel[ch].waveform[Address];
|
||||
Address++;
|
||||
Buffer++;
|
||||
}
|
||||
}
|
||||
|
||||
void PCE_PSG::PokeWave(const unsigned int ch, uint32 Address, uint32 Length, const uint8 *Buffer)
|
||||
{
|
||||
assert(ch <= 5);
|
||||
|
||||
while(Length--)
|
||||
{
|
||||
Address &= 0x1F;
|
||||
channel[ch].samp_accum -= channel[ch].waveform[Address];
|
||||
channel[ch].waveform[Address] = *Buffer & 0x1F;
|
||||
channel[ch].samp_accum += channel[ch].waveform[Address];
|
||||
Address++;
|
||||
Buffer++;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 PCE_PSG::GetRegister(const unsigned int id, char *special, const uint32 special_len)
|
||||
{
|
||||
uint32 value = 0xDEADBEEF;
|
||||
const int ch = (id >> 8) & 0xF;
|
||||
|
||||
switch(id & 0xF0FF)
|
||||
{
|
||||
default: break;
|
||||
|
||||
case PSG_GSREG_SELECT:
|
||||
value = select;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_GBALANCE:
|
||||
value = globalbalance;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_LFOFREQ:
|
||||
value = lfofreq;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_LFOCTRL:
|
||||
value = lfoctrl;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_FREQ:
|
||||
value = channel[ch].frequency;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_CTRL:
|
||||
value = channel[ch].control;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_BALANCE:
|
||||
value = channel[ch].balance;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_WINDEX:
|
||||
value = channel[ch].waveform_index;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_SCACHE:
|
||||
value = channel[ch].dda;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_NCTRL:
|
||||
value = channel[ch].noisectrl;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_LFSR:
|
||||
value = channel[ch].lfsr & 0x7FFF;
|
||||
break;
|
||||
}
|
||||
return(value);
|
||||
}
|
||||
|
||||
|
||||
void PCE_PSG::SetRegister(const unsigned int id, const uint32 value)
|
||||
{
|
||||
const int ch = (id >> 8) & 0xF;
|
||||
|
||||
switch(id & 0xF0FF)
|
||||
{
|
||||
default: break;
|
||||
|
||||
case PSG_GSREG_SELECT:
|
||||
select = value & 0x07;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_GBALANCE:
|
||||
globalbalance = value & 0xFF;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_LFOFREQ:
|
||||
lfofreq = value & 0xFF;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_LFOCTRL:
|
||||
lfoctrl = value & 0x83;
|
||||
RecalcFreqCache(0);
|
||||
RecalcUOFunc(0);
|
||||
RecalcFreqCache(1);
|
||||
RecalcUOFunc(1);
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_FREQ:
|
||||
channel[ch].frequency = value & 0xFFF;
|
||||
RecalcFreqCache(ch);
|
||||
RecalcUOFunc(ch);
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_CTRL:
|
||||
channel[ch].control = value & 0xFF;
|
||||
RecalcFreqCache(ch);
|
||||
RecalcUOFunc(ch);
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_BALANCE:
|
||||
channel[ch].balance = value & 0xFF;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_WINDEX:
|
||||
channel[ch].waveform_index = value & 0x1F;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_SCACHE:
|
||||
channel[ch].dda = value & 0x1F;
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_NCTRL:
|
||||
channel[ch].noisectrl = value & 0xFF;
|
||||
RecalcNoiseFreqCache(ch);
|
||||
RecalcUOFunc(ch);
|
||||
break;
|
||||
|
||||
case PSG_GSREG_CH0_LFSR:
|
||||
channel[ch].lfsr = value & 0x7FFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void PSG_SetRegister(const unsigned int id, const uint32 value)
|
||||
{
|
||||
|
||||
|
||||
if(name == "Select")
|
||||
PSG_Write(0x00, V);
|
||||
else if(name == "GBalance")
|
||||
PSG_Write(0x01, V);
|
||||
else if(name == "LFOFreq")
|
||||
{
|
||||
PSG_Write(0x08, V);
|
||||
}
|
||||
else if(name == "LFOCtrl")
|
||||
PSG_Write(0x09, V);
|
||||
else if(!strncmp(name.c_str(), "CH", 2))
|
||||
{
|
||||
unsigned int psg_sel_save = select;
|
||||
int ch = name[2] - '0';
|
||||
char moomoo[64];
|
||||
strncpy(moomoo, name.c_str() + 3, 63);
|
||||
|
||||
PSG_Write(0x00, ch);
|
||||
|
||||
if(!strcmp(moomoo, "Freq"))
|
||||
{
|
||||
PSG_Write(0x02, V);
|
||||
PSG_Write(0x03, V >> 8);
|
||||
}
|
||||
else if(!strcmp(moomoo, "Ctrl"))
|
||||
PSG_Write(0x04, V);
|
||||
else if(!strcmp(moomoo, "Balance"))
|
||||
PSG_Write(0x05, V);
|
||||
else if(!strcmp(moomoo, "WIndex"))
|
||||
psg.channel[ch].waveform_index = V & 0x1F;
|
||||
else if(!strcmp(moomoo, "SCache"))
|
||||
psg.channel[ch].dda = V & 0x1F;
|
||||
else if(!strcmp(moomoo, "NCtrl") && ch < 4)
|
||||
psg.channel[ch].noisectrl = V;
|
||||
else if(!strcmp(moomoo, "LFSR") && ch < 4)
|
||||
psg.channel[ch].lfsr = V & 0x3FFFF;
|
||||
|
||||
PSG_Write(0x00, psg_sel_save);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PCE_PSG::PCE_PSG(int32* hr_l, int32* hr_r, int want_revision)
|
||||
{
|
||||
//printf("Test: %u, %u\n", sizeof(psg_channel), (uint8*)&channel[0].balance - (uint8*)&channel[0].waveform[0]);
|
||||
|
||||
revision = want_revision;
|
||||
switch(revision)
|
||||
{
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
|
||||
case REVISION_HUC6280:
|
||||
UpdateOutput_Accum = &PCE_PSG::UpdateOutput_Accum_HuC6280;
|
||||
break;
|
||||
|
||||
case REVISION_HUC6280A:
|
||||
UpdateOutput_Accum = &PCE_PSG::UpdateOutput_Accum_HuC6280A;
|
||||
break;
|
||||
}
|
||||
HRBufs[0] = hr_l;
|
||||
HRBufs[1] = hr_r;
|
||||
|
||||
lastts = 0;
|
||||
for(int ch = 0; ch < 6; ch++)
|
||||
{
|
||||
channel[ch].blip_prev_samp[0] = 0;
|
||||
channel[ch].blip_prev_samp[1] = 0;
|
||||
channel[ch].lastts = 0;
|
||||
}
|
||||
|
||||
SetVolume(1.0); // Will build dbtable in the process.
|
||||
Power(0);
|
||||
}
|
||||
|
||||
PCE_PSG::~PCE_PSG()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
int32 PCE_PSG::GetVL(const int chnum, const int lr)
|
||||
{
|
||||
psg_channel *ch = &channel[chnum];
|
||||
|
||||
const int gbal = 0x1F - scale_tab[(globalbalance >> (lr ? 0 : 4)) & 0xF];
|
||||
const int bal = 0x1F - scale_tab[(ch->balance >> (lr ? 0 : 4)) & 0xF];
|
||||
const int al = 0x1F - (ch->control & 0x1F);
|
||||
int vol_reduction;
|
||||
|
||||
vol_reduction = gbal + bal + al;
|
||||
|
||||
if(vol_reduction > 0x1F)
|
||||
vol_reduction = 0x1F;
|
||||
|
||||
return(vol_reduction);
|
||||
}
|
||||
|
||||
void PCE_PSG::Write(int32 timestamp, uint8 A, uint8 V)
|
||||
{
|
||||
A &= 0x0F;
|
||||
|
||||
if(A == 0x00)
|
||||
{
|
||||
select = (V & 0x07);
|
||||
return;
|
||||
}
|
||||
|
||||
Update(timestamp);
|
||||
|
||||
psg_channel *ch = &channel[select];
|
||||
|
||||
//if(A == 0x01 || select == 5)
|
||||
// printf("Write Ch: %d %04x %02x, %d\n", select, A, V, timestamp);
|
||||
|
||||
switch(A)
|
||||
{
|
||||
default: break;
|
||||
|
||||
case 0x01: /* Global sound balance */
|
||||
globalbalance = V;
|
||||
vol_pending = true;
|
||||
break;
|
||||
|
||||
case 0x02: /* Channel frequency (LSB) */
|
||||
if(select > 5) return; // no more than 6 channels, silly game.
|
||||
|
||||
ch->frequency = (ch->frequency & 0x0F00) | V;
|
||||
RecalcFreqCache(select);
|
||||
RecalcUOFunc(select);
|
||||
break;
|
||||
|
||||
case 0x03: /* Channel frequency (MSB) */
|
||||
if(select > 5) return; // no more than 6 channels, silly game.
|
||||
|
||||
ch->frequency = (ch->frequency & 0x00FF) | ((V & 0x0F) << 8);
|
||||
RecalcFreqCache(select);
|
||||
RecalcUOFunc(select);
|
||||
break;
|
||||
|
||||
case 0x04: /* Channel enable, DDA, volume */
|
||||
if(select > 5) return; // no more than 6 channels, silly game.
|
||||
|
||||
if((ch->control & 0x40) && !(V & 0x40))
|
||||
{
|
||||
ch->waveform_index = 0;
|
||||
ch->dda = ch->waveform[ch->waveform_index];
|
||||
ch->counter = ch->freq_cache;
|
||||
}
|
||||
|
||||
if(!(ch->control & 0x80) && (V & 0x80))
|
||||
{
|
||||
if(!(V & 0x40))
|
||||
{
|
||||
ch->waveform_index = (ch->waveform_index + 1) & 0x1F;
|
||||
ch->dda = ch->waveform[ch->waveform_index];
|
||||
}
|
||||
}
|
||||
|
||||
ch->control = V;
|
||||
RecalcFreqCache(select);
|
||||
RecalcUOFunc(select);
|
||||
|
||||
vol_pending = true;
|
||||
break;
|
||||
|
||||
case 0x05: /* Channel balance */
|
||||
if(select > 5) return; // no more than 6 channels, silly game.
|
||||
ch->balance = V;
|
||||
|
||||
vol_pending = true;
|
||||
break;
|
||||
|
||||
case 0x06: /* Channel waveform data */
|
||||
if(select > 5) return; // no more than 6 channels, silly game.
|
||||
V &= 0x1F;
|
||||
|
||||
if(!(ch->control & 0x40))
|
||||
{
|
||||
ch->samp_accum -= ch->waveform[ch->waveform_index];
|
||||
ch->waveform[ch->waveform_index] = V;
|
||||
ch->samp_accum += ch->waveform[ch->waveform_index];
|
||||
}
|
||||
|
||||
if((ch->control & 0xC0) == 0x00)
|
||||
ch->waveform_index = ((ch->waveform_index + 1) & 0x1F);
|
||||
|
||||
if(ch->control & 0x80)
|
||||
{
|
||||
// According to my tests(on SuperGrafx), writing to this channel
|
||||
// will update the waveform value cache/latch regardless of DDA mode being enabled.
|
||||
ch->dda = V;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x07: /* Noise enable and frequency */
|
||||
if(select > 5) return; // no more than 6 channels, silly game.
|
||||
if(select >= 4)
|
||||
{
|
||||
ch->noisectrl = V;
|
||||
RecalcNoiseFreqCache(select);
|
||||
RecalcUOFunc(select);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x08: /* LFO frequency */
|
||||
lfofreq = V & 0xFF;
|
||||
//printf("LFO Freq: %02x\n", V);
|
||||
break;
|
||||
|
||||
case 0x09: /* LFO trigger and control */
|
||||
//printf("LFO Ctrl: %02x\n", V);
|
||||
if(V & 0x80)
|
||||
{
|
||||
channel[1].waveform_index = 0;
|
||||
channel[1].dda = channel[1].waveform[channel[1].waveform_index];
|
||||
channel[1].counter = channel[1].freq_cache;
|
||||
}
|
||||
lfoctrl = V;
|
||||
RecalcFreqCache(0);
|
||||
RecalcUOFunc(0);
|
||||
RecalcFreqCache(1);
|
||||
RecalcUOFunc(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't use INLINE, which has always_inline in it, due to gcc's inability to cope with the type of recursion
|
||||
// used in this function.
|
||||
void PCE_PSG::RunChannel(int chc, int32 timestamp, const bool LFO_On)
|
||||
{
|
||||
psg_channel *ch = &channel[chc];
|
||||
int32 running_timestamp = ch->lastts;
|
||||
int32 run_time = timestamp - ch->lastts;
|
||||
|
||||
ch->lastts = timestamp;
|
||||
|
||||
if(!run_time)
|
||||
return;
|
||||
|
||||
(this->*ch->UpdateOutput)(running_timestamp, ch);
|
||||
|
||||
if(chc >= 4)
|
||||
{
|
||||
int32 freq = ch->noise_freq_cache;
|
||||
|
||||
ch->noisecount -= run_time;
|
||||
|
||||
if(&PCE_PSG::UpdateOutput_Noise == ch->UpdateOutput)
|
||||
while(ch->noisecount <= 0)
|
||||
{
|
||||
CLOCK_LFSR(ch->lfsr);
|
||||
UpdateOutput_Noise(timestamp + ch->noisecount, ch);
|
||||
ch->noisecount += freq;
|
||||
}
|
||||
else
|
||||
while(ch->noisecount <= 0)
|
||||
{
|
||||
CLOCK_LFSR(ch->lfsr);
|
||||
ch->noisecount += freq;
|
||||
}
|
||||
}
|
||||
|
||||
// D7 of control is 0, don't clock the counter at all.
|
||||
// D7 of lfocontrol is 1(and chc == 1), don't clock the counter at all(not sure about this)
|
||||
// In DDA mode, don't clock the counter.
|
||||
// (Noise being enabled isn't handled here since AFAIK it doesn't disable clocking of the waveform portion, its sound just overrides the sound from
|
||||
// the waveform portion when the noise enable bit is set, which is handled in our RecalcUOFunc).
|
||||
if(!(ch->control & 0x80) || (chc == 1 && (lfoctrl & 0x80)) || (ch->control & 0x40))
|
||||
return;
|
||||
|
||||
ch->counter -= run_time;
|
||||
|
||||
if(!LFO_On && ch->freq_cache <= FREQC7M_COT)
|
||||
{
|
||||
if(ch->counter <= 0)
|
||||
{
|
||||
const int32 inc_count = ((0 - ch->counter) / ch->freq_cache) + 1;
|
||||
|
||||
ch->counter += inc_count * ch->freq_cache;
|
||||
|
||||
ch->waveform_index = (ch->waveform_index + inc_count) & 0x1F;
|
||||
ch->dda = ch->waveform[ch->waveform_index];
|
||||
}
|
||||
}
|
||||
|
||||
while(ch->counter <= 0)
|
||||
{
|
||||
ch->waveform_index = (ch->waveform_index + 1) & 0x1F;
|
||||
ch->dda = ch->waveform[ch->waveform_index];
|
||||
|
||||
(this->*ch->UpdateOutput)(timestamp + ch->counter, ch);
|
||||
|
||||
if(LFO_On)
|
||||
{
|
||||
RunChannel(1, timestamp + ch->counter, false);
|
||||
RecalcFreqCache(0);
|
||||
RecalcUOFunc(0);
|
||||
|
||||
ch->counter += (ch->freq_cache <= FREQC7M_COT) ? FREQC7M_COT : ch->freq_cache; // Not particularly accurate, but faster.
|
||||
}
|
||||
else
|
||||
ch->counter += ch->freq_cache;
|
||||
}
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateSubLFO(int32 timestamp)
|
||||
{
|
||||
for(int chc = 0; chc < 6; chc++)
|
||||
RunChannel(chc, timestamp, chc == 0);
|
||||
}
|
||||
|
||||
void PCE_PSG::UpdateSubNonLFO(int32 timestamp)
|
||||
{
|
||||
for(int chc = 0; chc < 6; chc++)
|
||||
RunChannel(chc, timestamp, false);
|
||||
}
|
||||
|
||||
void PCE_PSG::Update(int32 timestamp)
|
||||
{
|
||||
int32 run_time = timestamp - lastts;
|
||||
|
||||
if(vol_pending && !vol_update_counter && !vol_update_which)
|
||||
{
|
||||
vol_update_counter = 1;
|
||||
vol_pending = false;
|
||||
}
|
||||
|
||||
bool lfo_on = (bool)(lfoctrl & 0x03);
|
||||
|
||||
if(lfo_on)
|
||||
{
|
||||
if(!(channel[1].control & 0x80) || (lfoctrl & 0x80))
|
||||
{
|
||||
lfo_on = 0;
|
||||
RecalcFreqCache(0);
|
||||
RecalcUOFunc(0);
|
||||
}
|
||||
}
|
||||
|
||||
int32 clocks = run_time;
|
||||
int32 running_timestamp = lastts;
|
||||
|
||||
while(clocks > 0)
|
||||
{
|
||||
int32 chunk_clocks = clocks;
|
||||
|
||||
if(vol_update_counter > 0 && chunk_clocks > vol_update_counter)
|
||||
chunk_clocks = vol_update_counter;
|
||||
|
||||
running_timestamp += chunk_clocks;
|
||||
clocks -= chunk_clocks;
|
||||
|
||||
if(lfo_on)
|
||||
UpdateSubLFO(running_timestamp);
|
||||
else
|
||||
UpdateSubNonLFO(running_timestamp);
|
||||
|
||||
if(vol_update_counter > 0)
|
||||
{
|
||||
vol_update_counter -= chunk_clocks;
|
||||
if(!vol_update_counter)
|
||||
{
|
||||
const int phase = vol_update_which & 1;
|
||||
const int lr = ((vol_update_which >> 1) & 1) ^ 1;
|
||||
const int chnum = vol_update_which >> 2;
|
||||
|
||||
if(!phase)
|
||||
{
|
||||
//printf("Volume update(Read, %d since last): ch=%d, lr=%d, ts=%d\n", running_timestamp - last_read, chnum, lr, running_timestamp);
|
||||
|
||||
if(chnum < 6)
|
||||
{
|
||||
vol_update_vllatch = GetVL(chnum, lr);
|
||||
}
|
||||
//last_read = running_timestamp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// printf("Volume update(Apply): ch=%d, lr=%d, ts=%d\n", chnum, lr, running_timestamp);
|
||||
if(chnum < 6)
|
||||
{
|
||||
channel[chnum].vl[lr] = vol_update_vllatch;
|
||||
}
|
||||
//last_apply = running_timestamp;
|
||||
}
|
||||
vol_update_which = (vol_update_which + 1) & 0x1F;
|
||||
|
||||
if(vol_update_which)
|
||||
vol_update_counter = phase ? 1 : 255;
|
||||
else if(vol_pending)
|
||||
{
|
||||
vol_update_counter = phase ? 1 : 255;
|
||||
vol_pending = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastts = running_timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
void PCE_PSG::ResetTS(int32 ts_base)
|
||||
{
|
||||
lastts = ts_base;
|
||||
|
||||
for(int chc = 0; chc < 6; chc++)
|
||||
channel[chc].lastts = ts_base;
|
||||
}
|
||||
|
||||
void PCE_PSG::Power(const int32 timestamp)
|
||||
{
|
||||
// Not sure about power-on values, these are mostly just intuitive guesses(with some laziness thrown in).
|
||||
if(timestamp != lastts)
|
||||
Update(timestamp);
|
||||
|
||||
// Don't memset channel to 0, there's stuff like lastts and blip_prev_samp that shouldn't be altered on Power().
|
||||
|
||||
select = 0;
|
||||
globalbalance = 0;
|
||||
lfofreq = 0;
|
||||
lfoctrl = 0;
|
||||
|
||||
for(int ch = 0; ch < 6; ch++)
|
||||
{
|
||||
channel[ch].frequency = 0;
|
||||
channel[ch].control = 0x00;
|
||||
channel[ch].balance = 0;
|
||||
memset(channel[ch].waveform, 0, 32);
|
||||
channel[ch].samp_accum = 0;
|
||||
|
||||
channel[ch].waveform_index = 0;
|
||||
channel[ch].dda = 0x00;
|
||||
channel[ch].noisectrl = 0x00;
|
||||
|
||||
channel[ch].vl[0] = 0x1F;
|
||||
channel[ch].vl[1] = 0x1F;
|
||||
|
||||
channel[ch].samp_accum = 0;
|
||||
|
||||
RecalcFreqCache(ch);
|
||||
RecalcUOFunc(ch);
|
||||
|
||||
channel[ch].counter = channel[ch].freq_cache;
|
||||
|
||||
if(ch >= 4)
|
||||
{
|
||||
RecalcNoiseFreqCache(ch);
|
||||
channel[ch].noisecount = 1;
|
||||
channel[ch].lfsr = 1;
|
||||
}
|
||||
}
|
||||
|
||||
vol_pending = false;
|
||||
vol_update_counter = 0;
|
||||
vol_update_which = 0;
|
||||
}
|
||||
|
||||
int PCE_PSG::StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
for(int ch = 0; ch < 6; ch++)
|
||||
{
|
||||
char tmpstr[5] = "SCHx";
|
||||
psg_channel *pt = &channel[ch];
|
||||
|
||||
SFORMAT CH_StateRegs[] =
|
||||
{
|
||||
SFVARN(pt->counter, "counter"),
|
||||
SFVARN(pt->frequency, "frequency"),
|
||||
SFVARN(pt->control, "control"),
|
||||
SFVARN(pt->balance, "balance"),
|
||||
SFARRAYN(pt->waveform, 32, "waveform"),
|
||||
SFVARN(pt->waveform_index, "waveform_index"),
|
||||
SFVARN(pt->dda, "dda"),
|
||||
SFVARN(pt->noisectrl, "noisectrl"),
|
||||
SFVARN(pt->noisecount, "noisecount"),
|
||||
SFVARN(pt->lfsr, "lfsr"),
|
||||
SFARRAY32N(pt->vl, 2, "vl"), // TODO
|
||||
SFEND
|
||||
};
|
||||
tmpstr[3] = '0' + ch;
|
||||
ret &= MDFNSS_StateAction(sm, load, data_only, CH_StateRegs, tmpstr);
|
||||
}
|
||||
|
||||
SFORMAT PSG_StateRegs[] =
|
||||
{
|
||||
SFVAR(select),
|
||||
SFVAR(globalbalance),
|
||||
SFVAR(lfofreq),
|
||||
SFVAR(lfoctrl),
|
||||
|
||||
SFVAR(vol_update_counter),
|
||||
SFVAR(vol_update_which),
|
||||
SFVAR(vol_pending),
|
||||
SFEND
|
||||
};
|
||||
|
||||
ret &= MDFNSS_StateAction(sm, load, data_only, PSG_StateRegs, "PSG");
|
||||
|
||||
if(load)
|
||||
{
|
||||
vol_update_which &= 0x1F;
|
||||
|
||||
if(!channel[4].lfsr)
|
||||
channel[4].lfsr = 1;
|
||||
|
||||
if(!channel[5].lfsr)
|
||||
channel[5].lfsr = 1;
|
||||
|
||||
for(int ch = 0; ch < 6; ch++)
|
||||
{
|
||||
channel[ch].samp_accum = 0;
|
||||
for(int wi = 0; wi < 32; wi++)
|
||||
{
|
||||
channel[ch].waveform[wi] &= 0x1F;
|
||||
channel[ch].samp_accum += channel[ch].waveform[wi];
|
||||
}
|
||||
|
||||
for(int lr = 0; lr < 2; lr++)
|
||||
channel[ch].vl[lr] &= 0x1F;
|
||||
|
||||
if(!channel[ch].noisecount && ch >= 4)
|
||||
{
|
||||
printf("ch=%d, noisecount == 0\n", ch);
|
||||
channel[ch].noisecount = 1;
|
||||
}
|
||||
|
||||
if(channel[ch].counter <= 0)
|
||||
{
|
||||
printf("ch=%d, counter <= 0\n", ch);
|
||||
channel[ch].counter = 1;
|
||||
}
|
||||
|
||||
if(ch >= 4)
|
||||
RecalcNoiseFreqCache(ch);
|
||||
RecalcFreqCache(ch);
|
||||
RecalcUOFunc(ch);
|
||||
}
|
||||
}
|
||||
return(ret);
|
||||
}
|
@ -1,171 +0,0 @@
|
||||
#ifndef _PCE_PSG_H
|
||||
#define _PCE_PSG_H
|
||||
|
||||
class PCE_PSG;
|
||||
|
||||
struct psg_channel
|
||||
{
|
||||
uint8 waveform[32]; /* Waveform data */
|
||||
uint8 waveform_index; /* Waveform data index */
|
||||
uint8 dda;
|
||||
uint8 control; /* Channel enable, DDA, volume */
|
||||
uint8 noisectrl; /* Noise enable/ctrl (channels 4,5 only) */
|
||||
|
||||
int32 vl[2]; //vll, vlr;
|
||||
|
||||
int32 counter;
|
||||
|
||||
void (PCE_PSG::*UpdateOutput)(const int32 timestamp, psg_channel *ch);
|
||||
|
||||
uint32 freq_cache;
|
||||
uint32 noise_freq_cache; // Channel 4,5 only
|
||||
int32 noisecount;
|
||||
uint32 lfsr;
|
||||
|
||||
int32 samp_accum; // The result of adding up all the samples in the waveform buffer(part of an optimization for high-frequency playback).
|
||||
int32 blip_prev_samp[2];
|
||||
int32 lastts;
|
||||
|
||||
uint16 frequency; /* Channel frequency */
|
||||
uint8 balance; /* Channel balance */
|
||||
};
|
||||
|
||||
// Only CH4 and CH5 have NCTRL and LFSR, but it's here for the other channels for "consistency".
|
||||
enum
|
||||
{
|
||||
PSG_GSREG_CH0_FREQ = 0x000,
|
||||
// PSG_GSREG_CH0_COUNTER,
|
||||
PSG_GSREG_CH0_CTRL,
|
||||
PSG_GSREG_CH0_BALANCE,
|
||||
PSG_GSREG_CH0_WINDEX,
|
||||
PSG_GSREG_CH0_SCACHE,
|
||||
PSG_GSREG_CH0_NCTRL,
|
||||
PSG_GSREG_CH0_LFSR,
|
||||
|
||||
PSG_GSREG_CH1_FREQ = 0x100,
|
||||
// PSG_GSREG_CH1_COUNTER,
|
||||
PSG_GSREG_CH1_CTRL,
|
||||
PSG_GSREG_CH1_BALANCE,
|
||||
PSG_GSREG_CH1_WINDEX,
|
||||
PSG_GSREG_CH1_SCACHE,
|
||||
PSG_GSREG_CH1_NCTRL,
|
||||
PSG_GSREG_CH1_LFSR,
|
||||
|
||||
PSG_GSREG_CH2_FREQ = 0x200,
|
||||
// PSG_GSREG_CH2_COUNTER,
|
||||
PSG_GSREG_CH2_CTRL,
|
||||
PSG_GSREG_CH2_BALANCE,
|
||||
PSG_GSREG_CH2_WINDEX,
|
||||
PSG_GSREG_CH2_SCACHE,
|
||||
PSG_GSREG_CH2_NCTRL,
|
||||
PSG_GSREG_CH2_LFSR,
|
||||
|
||||
PSG_GSREG_CH3_FREQ = 0x300,
|
||||
// PSG_GSREG_CH3_COUNTER,
|
||||
PSG_GSREG_CH3_CTRL,
|
||||
PSG_GSREG_CH3_BALANCE,
|
||||
PSG_GSREG_CH3_WINDEX,
|
||||
PSG_GSREG_CH3_SCACHE,
|
||||
PSG_GSREG_CH3_NCTRL,
|
||||
PSG_GSREG_CH3_LFSR,
|
||||
|
||||
PSG_GSREG_CH4_FREQ = 0x400,
|
||||
// PSG_GSREG_CH4_COUNTER,
|
||||
PSG_GSREG_CH4_CTRL,
|
||||
PSG_GSREG_CH4_BALANCE,
|
||||
PSG_GSREG_CH4_WINDEX,
|
||||
PSG_GSREG_CH4_SCACHE,
|
||||
PSG_GSREG_CH4_NCTRL,
|
||||
PSG_GSREG_CH4_LFSR,
|
||||
|
||||
PSG_GSREG_CH5_FREQ = 0x500,
|
||||
// PSG_GSREG_CH5_COUNTER,
|
||||
PSG_GSREG_CH5_CTRL,
|
||||
PSG_GSREG_CH5_BALANCE,
|
||||
PSG_GSREG_CH5_WINDEX,
|
||||
PSG_GSREG_CH5_SCACHE,
|
||||
PSG_GSREG_CH5_NCTRL,
|
||||
PSG_GSREG_CH5_LFSR,
|
||||
|
||||
PSG_GSREG_SELECT = 0x1000,
|
||||
PSG_GSREG_GBALANCE,
|
||||
PSG_GSREG_LFOFREQ,
|
||||
PSG_GSREG_LFOCTRL,
|
||||
_PSG_GSREG_COUNT
|
||||
};
|
||||
|
||||
class PCE_PSG
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
REVISION_HUC6280 = 0,
|
||||
REVISION_HUC6280A,
|
||||
_REVISION_COUNT
|
||||
};
|
||||
|
||||
|
||||
PCE_PSG(int32* hr_l, int32* hr_r, int want_revision);
|
||||
~PCE_PSG();
|
||||
|
||||
int StateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
void Power(const int32 timestamp);
|
||||
void Write(int32 timestamp, uint8 A, uint8 V);
|
||||
|
||||
void SetVolume(double new_volume);
|
||||
|
||||
void Update(int32 timestamp);
|
||||
void ResetTS(int32 ts_base = 0);
|
||||
|
||||
// TODO: timestamp
|
||||
uint32 GetRegister(const unsigned int id, char *special, const uint32 special_len);
|
||||
void SetRegister(const unsigned int id, const uint32 value);
|
||||
|
||||
void PeekWave(const unsigned int ch, uint32 Address, uint32 Length, uint8 *Buffer);
|
||||
void PokeWave(const unsigned int ch, uint32 Address, uint32 Length, const uint8 *Buffer);
|
||||
|
||||
private:
|
||||
|
||||
void UpdateSubLFO(int32 timestamp);
|
||||
void UpdateSubNonLFO(int32 timestamp);
|
||||
|
||||
void RecalcUOFunc(int chnum);
|
||||
void UpdateOutputSub(const int32 timestamp, psg_channel *ch, const int32 samp0, const int32 samp1);
|
||||
void UpdateOutput_Off(const int32 timestamp, psg_channel *ch);
|
||||
void UpdateOutput_Accum_HuC6280(const int32 timestamp, psg_channel *ch);
|
||||
void UpdateOutput_Accum_HuC6280A(const int32 timestamp, psg_channel *ch);
|
||||
void UpdateOutput_Norm(const int32 timestamp, psg_channel *ch);
|
||||
void UpdateOutput_Noise(const int32 timestamp, psg_channel *ch);
|
||||
void (PCE_PSG::*UpdateOutput_Accum)(const int32 timestamp, psg_channel *ch);
|
||||
|
||||
int32 GetVL(const int chnum, const int lr);
|
||||
|
||||
void RecalcFreqCache(int chnum);
|
||||
void RecalcNoiseFreqCache(int chnum);
|
||||
void RunChannel(int chc, int32 timestamp, bool LFO_On);
|
||||
|
||||
uint8 select; /* Selected channel (0-5) */
|
||||
uint8 globalbalance; /* Global sound balance */
|
||||
uint8 lfofreq; /* LFO frequency */
|
||||
uint8 lfoctrl; /* LFO control */
|
||||
|
||||
int32 vol_update_counter;
|
||||
int32 vol_update_which;
|
||||
int32 vol_update_vllatch;
|
||||
bool vol_pending;
|
||||
|
||||
psg_channel channel[6];
|
||||
|
||||
int32 lastts;
|
||||
int revision;
|
||||
|
||||
int32* HRBufs[2];
|
||||
|
||||
int32 dbtable_volonly[32];
|
||||
|
||||
int32 dbtable[32][32];
|
||||
};
|
||||
|
||||
#endif
|
@ -20,7 +20,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_sound";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
PreprocessorDefinitions="_DEBUG;_XBOX;_LIB;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.28;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;MEDNAFEN_VERSION_NUMERIC=926;NEED_CD;WANT_CRC32;LSB_FIRST;BYTE_ORDER=LITTLE_ENDIAN;WANT_THREADING;WANT_NEW_API"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -54,7 +54,7 @@
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_sound";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;_LIB;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.28;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;MEDNAFEN_VERSION_NUMERIC=926;NEED_CD;WANT_CRC32;LSB_FIRST;BYTE_ORDER=LITTLE_ENDIAN;WANT_THREADING;WANT_NEW_API"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
@ -89,7 +89,7 @@
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_sound";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";";$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.28;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;MEDNAFEN_VERSION_NUMERIC=926;NEED_CD;WANT_CRC32;LSB_FIRST;BYTE_ORDER=LITTLE_ENDIAN;WANT_THREADING;WANT_NEW_API"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
@ -125,7 +125,7 @@
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_sound";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;_LIB;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.28;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;MEDNAFEN_VERSION_NUMERIC=926;NEED_CD;WANT_CRC32;LSB_FIRST;BYTE_ORDER=LITTLE_ENDIAN;WANT_THREADING;WANT_NEW_API"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
@ -161,7 +161,7 @@
|
||||
Optimization="3"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_sound";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\msvc-2003-xbox1";"$(SolutionDir)\..\..\";"$(SolutionDir)\..\..\mednafen";"$(SolutionDir)\..\..\mednafen\include";"$(SolutionDir)\..\..\mednafen\cdrom";"$(SolutionDir)\..\..\mednafen\sound";"$(SolutionDir)\..\..\mednafen\pce_fast";"$(SolutionDir)\..\..\mednafen\hw_cpu";"$(SolutionDir)\..\..\mednafen\include\blip";"$(SolutionDir)\..\..\mednafen\hw_misc""
|
||||
PreprocessorDefinitions="NDEBUG;_XBOX;LTCG;_LIB;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.28;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;MEDNAFEN_VERSION_NUMERIC=926;NEED_CD;WANT_CRC32;LSB_FIRST;BYTE_ORDER=LITTLE_ENDIAN;WANT_THREADING;WANT_NEW_API"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -360,7 +360,7 @@
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;_LIB;MSB_FIRST;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.26;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;PSS_STYLE=2;MEDNAFEN_VERSION_NUMERIC=926;BYTE_ORDER=1;NEED_CD;WANT_CRC32;%(PreprocessorDefinitions);WANT_THREADING;WANT_NEW_API</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_misc;$(SolutionDir)\..\..\mednafen\hw_sound;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -382,7 +382,7 @@
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;_LIB;MSB_FIRST;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.26;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;PSS_STYLE=2;MEDNAFEN_VERSION_NUMERIC=926;BYTE_ORDER=1;NEED_CD;WANT_CRC32;%(PreprocessorDefinitions);WANT_THREADING;WANT_NEW_API</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_sound;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -404,7 +404,7 @@
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;_LIB;MSB_FIRST;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.26;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;PSS_STYLE=2;MEDNAFEN_VERSION_NUMERIC=926;BYTE_ORDER=1;NEED_CD;WANT_CRC32;%(PreprocessorDefinitions);WANT_THREADING;WANT_NEW_API</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_sound;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -33,12 +33,6 @@
|
||||
<Filter Include="Source Files\mednafen\hw_misc\arcade_card">
|
||||
<UniqueIdentifier>{691cb3fc-62c8-4ac6-9c02-9f23e66368f7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mednafen\hw_sound">
|
||||
<UniqueIdentifier>{105e8413-1815-4b73-b6e5-61453de5430f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mednafen\hw_sound\pce_psg">
|
||||
<UniqueIdentifier>{13127bdc-2df4-4f65-9e00-4e8d9dcd221d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mednafen\tremor">
|
||||
<UniqueIdentifier>{6e70f6f2-5174-46d4-9bd6-33725139e84c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -143,9 +137,6 @@
|
||||
<ClCompile Include="..\..\..\mednafen\hw_misc\arcade_card\arcade_card.cpp">
|
||||
<Filter>Source Files\mednafen\hw_misc\arcade_card</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\mednafen\hw_sound\pce_psg\pce_psg.cpp">
|
||||
<Filter>Source Files\mednafen\hw_sound\pce_psg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\mednafen\cdrom\CDAccess_CCD.cpp">
|
||||
<Filter>Source Files\mednafen\cdrom</Filter>
|
||||
</ClCompile>
|
||||
|
@ -189,7 +189,7 @@
|
||||
<PrecompiledHeaderOutputFile>$(OutDir)$(ProjectName).pch</PrecompiledHeaderOutputFile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_WIN32;_LIB;LSB_FIRST;WANT_PCE_FAST_EMU;WANT_16BPP;SIZEOF_DOUBLE=8;MEDNAFEN_VERSION=0.9.26;MPC_FIXED_POINT;__LIBRETRO__;_LOW_ACCURACY;WANT_STEREO_SOUND;FRONTEND_SUPPORTS_RGB565;PSS_STYLE=2;MEDNAFEN_VERSION_NUMERIC=926;NEED_CD;WANT_CRC32;%(PreprocessorDefinitions);WANT_THREADING;_CRT_SECURE_NO_WARNINGS;WANT_NEW_API</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_sound;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\;$(SolutionDir)\..\..\mednafen;$(SolutionDir)\..\..\mednafen\cdrom;$(SolutionDir)\..\..\mednafen\include;$(SolutionDir)\..\..\mednafen\sound;$(SolutionDir)\..\..\mednafen\ngp;$(SolutionDir)\..\..\mednafen\hw_misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
@ -33,12 +33,6 @@
|
||||
<Filter Include="Source Files\mednafen\hw_misc\arcade_card">
|
||||
<UniqueIdentifier>{691cb3fc-62c8-4ac6-9c02-9f23e66368f7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mednafen\hw_sound">
|
||||
<UniqueIdentifier>{105e8413-1815-4b73-b6e5-61453de5430f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mednafen\hw_sound\pce_psg">
|
||||
<UniqueIdentifier>{13127bdc-2df4-4f65-9e00-4e8d9dcd221d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\mednafen\tremor">
|
||||
<UniqueIdentifier>{6e70f6f2-5174-46d4-9bd6-33725139e84c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -143,9 +137,6 @@
|
||||
<ClCompile Include="..\..\..\mednafen\hw_misc\arcade_card\arcade_card.cpp">
|
||||
<Filter>Source Files\mednafen\hw_misc\arcade_card</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\mednafen\hw_sound\pce_psg\pce_psg.cpp">
|
||||
<Filter>Source Files\mednafen\hw_sound\pce_psg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\mednafen\cdrom\CDAccess_CCD.cpp">
|
||||
<Filter>Source Files\mednafen\cdrom</Filter>
|
||||
</ClCompile>
|
||||
|
Loading…
Reference in New Issue
Block a user