aica: get rid of audio samples batching
Some audio issues are reported because of this option and the now correctly clocked aica cpu.
This commit is contained in:
parent
8a0323ec08
commit
59ff44132b
|
@ -135,14 +135,6 @@ static void loadSpecialSettings()
|
|||
config::ExtraDepthScale.override(1000.f);
|
||||
}
|
||||
|
||||
// Tony Hawk's Pro Skater 2
|
||||
if (prod_id == "T13008D" || prod_id == "T13006N"
|
||||
// Tony Hawk's Pro Skater 1
|
||||
|| prod_id == "T40205N"
|
||||
// Tony Hawk's Skateboarding
|
||||
|| prod_id == "T40204D")
|
||||
settings.aica.forceNoBatch = true;
|
||||
|
||||
std::string areas(ip_meta.area_symbols, sizeof(ip_meta.area_symbols));
|
||||
bool region_usa = areas.find('U') != std::string::npos;
|
||||
bool region_eu = areas.find('E') != std::string::npos;
|
||||
|
@ -483,7 +475,6 @@ void Emulator::loadGame(const char *path, LoadProgress *progress)
|
|||
config::Settings::instance().load(false);
|
||||
dc_reset(true);
|
||||
memset(&settings.network.md5, 0, sizeof(settings.network.md5));
|
||||
settings.aica.forceNoBatch = false;
|
||||
|
||||
if (settings.platform.isNaomi2() && config::RendererType == RenderType::DirectX9)
|
||||
throw FlycastException("DirectX 9 doesn't support Naomi 2 games. Select a different graphics API");
|
||||
|
@ -693,7 +684,6 @@ void loadGameSpecificSettings()
|
|||
{
|
||||
config::ExtraDepthScale.override(0.1f);
|
||||
config::FullMMU.override(true);
|
||||
settings.aica.forceNoBatch = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -788,7 +778,6 @@ void Emulator::start()
|
|||
verify(state == Loaded);
|
||||
state = Running;
|
||||
SetMemoryHandlers();
|
||||
settings.aica.NoBatch = settings.aica.forceNoBatch || config::DSPEnabled || config::GGPOEnable;
|
||||
rend_resize_renderer();
|
||||
#if FEAT_SHREC != DYNAREC_NONE
|
||||
if (config::DynarecEnabled)
|
||||
|
|
|
@ -90,8 +90,6 @@ const int AICA_TICK = 145125; // 44.1 KHz / 32
|
|||
static int AicaUpdate(int tag, int c, int j)
|
||||
{
|
||||
aicaarm::run(32);
|
||||
if (!settings.aica.NoBatch)
|
||||
AICA_Sample32();
|
||||
|
||||
return AICA_TICK;
|
||||
}
|
||||
|
@ -106,8 +104,7 @@ void libAICA_TimeStep()
|
|||
SCIPD->SAMPLE_DONE = 1;
|
||||
MCIPD->SAMPLE_DONE = 1;
|
||||
|
||||
if (settings.aica.NoBatch)
|
||||
AICA_Sample();
|
||||
AICA_Sample();
|
||||
|
||||
//Make sure sh4/arm interrupt system is up to date :)
|
||||
update_arm_interrupts();
|
||||
|
|
|
@ -1422,109 +1422,6 @@ constexpr int CDDA_SIZE = 2352 / 2;
|
|||
static s16 cdda_sector[CDDA_SIZE];
|
||||
static u32 cdda_index = CDDA_SIZE;
|
||||
|
||||
//no DSP for now in this version
|
||||
void AICA_Sample32()
|
||||
{
|
||||
SampleType mxlr[64];
|
||||
memset(mxlr,0,sizeof(mxlr));
|
||||
|
||||
//Generate 32 samples for each channel, before moving to next channel
|
||||
//much more cache efficient !
|
||||
for (int ch = 0; ch < 64; ch++)
|
||||
{
|
||||
for (int i=0;i<32;i++)
|
||||
{
|
||||
SampleType oLeft,oRight,oDsp;
|
||||
//stop working on this channel if its turned off ...
|
||||
if (!Chans[ch].Step(oLeft, oRight, oDsp))
|
||||
break;
|
||||
|
||||
if (oLeft + oRight == 0)
|
||||
oLeft = oRight = oDsp >> 4;
|
||||
|
||||
mxlr[i*2+0] += oLeft;
|
||||
mxlr[i*2+1] += oRight;
|
||||
}
|
||||
}
|
||||
//OK , generated all Channels , now DSP/ect + final mix ;p
|
||||
//CDDA EXTS input
|
||||
|
||||
for (int i=0;i<32;i++)
|
||||
{
|
||||
SampleType mixl,mixr;
|
||||
|
||||
mixl=mxlr[i*2+0];
|
||||
mixr=mxlr[i*2+1];
|
||||
|
||||
if (cdda_index>=CDDA_SIZE)
|
||||
{
|
||||
cdda_index=0;
|
||||
libCore_CDDA_Sector(cdda_sector);
|
||||
}
|
||||
s32 EXTS0L=cdda_sector[cdda_index];
|
||||
s32 EXTS0R=cdda_sector[cdda_index+1];
|
||||
cdda_index+=2;
|
||||
|
||||
//Final MIX ..
|
||||
//Add CDDA / DSP effect(s)
|
||||
|
||||
//CDDA
|
||||
VolumePan(EXTS0L, dsp_out_vol[16].EFSDL, dsp_out_vol[16].EFPAN, mixl, mixr);
|
||||
VolumePan(EXTS0R, dsp_out_vol[17].EFSDL, dsp_out_vol[17].EFPAN, mixl, mixr);
|
||||
|
||||
/*
|
||||
no dsp for now -- needs special handling of oDSP for ch paraller version ...
|
||||
if (config::DSPEnabled)
|
||||
{
|
||||
dsp::step();
|
||||
|
||||
for (int i=0;i<16;i++)
|
||||
{
|
||||
VolumePan( (*(s16*)&DSPData->EFREG[i]) ,dsp_out_vol[i].EFSDL,dsp_out_vol[i].EFPAN,mixl,mixr);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//Mono !
|
||||
if (CommonData->Mono)
|
||||
{
|
||||
//Yay for mono =P
|
||||
mixl+=mixr;
|
||||
mixr=mixl;
|
||||
}
|
||||
|
||||
//MVOL !
|
||||
//we want to make sure mix* is *At least* 23 bits wide here, so 64 bit mul !
|
||||
u32 mvol=CommonData->MVOL;
|
||||
s32 val=volume_lut[mvol];
|
||||
mixl = (s32)FPMul<s64>(mixl, val, 15);
|
||||
mixr = (s32)FPMul<s64>(mixr, val, 15);
|
||||
|
||||
|
||||
if (CommonData->DAC18B)
|
||||
{
|
||||
//If 18 bit output , make it 16b :p
|
||||
mixl=FPs(mixl,2);
|
||||
mixr=FPs(mixr,2);
|
||||
}
|
||||
|
||||
//Sample is ready ! clip/saturate and store :}
|
||||
|
||||
#ifdef CLIP_WARN
|
||||
if (((s16)mixl) != mixl)
|
||||
printf("Clipped mixl %d\n",mixl);
|
||||
if (((s16)mixr) != mixr)
|
||||
printf("Clipped mixr %d\n",mixr);
|
||||
#endif
|
||||
|
||||
clip16(mixl);
|
||||
clip16(mixr);
|
||||
|
||||
if (!settings.input.fastForwardMode && !settings.aica.muteAudio)
|
||||
WriteSample(mixr,mixl);
|
||||
}
|
||||
}
|
||||
|
||||
void AICA_Sample()
|
||||
{
|
||||
SampleType mixl,mixr;
|
||||
|
|
|
@ -303,8 +303,6 @@ struct settings_t
|
|||
|
||||
struct
|
||||
{
|
||||
bool NoBatch;
|
||||
bool forceNoBatch;
|
||||
bool muteAudio;
|
||||
} aica;
|
||||
|
||||
|
|
Loading…
Reference in New Issue