mirror of https://github.com/PCSX2/pcsx2.git
SPU2: Only reset output modules if the sample rate changes.
Also don't reset all SPU2 regs when entering PS1 mode, only need to set the sample rate. Fixes issues with portaudio.
This commit is contained in:
parent
c4ca10258b
commit
54bcf9a657
|
@ -282,51 +282,59 @@ CALLBACK SPU2writeDMA7Mem(u16 *pMem, u32 size)
|
|||
|
||||
EXPORT_C_(s32)
|
||||
SPU2reset()
|
||||
{
|
||||
SampleRate = 48000;
|
||||
|
||||
if (SndBuffer::Test() != 0)
|
||||
{
|
||||
if (SndBuffer::Test() == 0 && SampleRate != 48000)
|
||||
{
|
||||
SampleRate = 48000;
|
||||
SndBuffer::Cleanup();
|
||||
|
||||
try {
|
||||
SndBuffer::Init();
|
||||
}
|
||||
catch (std::exception& ex) {
|
||||
fprintf(stderr, "SPU2-X Error: Could not initialize device, or something.\nReason: %s", ex.what());
|
||||
SPU2close();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
SampleRate = 48000;
|
||||
|
||||
memset(spu2regs, 0, 0x010000);
|
||||
memset(_spu2mem, 0, 0x200000);
|
||||
memset(_spu2mem + 0x2800, 7, 0x10); // from BIOS reversal. Locks the voices so they don't run free.
|
||||
Cores[0].Init(0);
|
||||
Cores[1].Init(1);
|
||||
try {
|
||||
SndBuffer::Init();
|
||||
} catch (std::exception &ex) {
|
||||
fprintf(stderr, "SPU2-X Error: Could not initialize device, or something.\nReason: %s", ex.what());
|
||||
SPU2close();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
SPU2ps1reset()
|
||||
{
|
||||
SampleRate = 44100;
|
||||
|
||||
if (SndBuffer::Test() != 0)
|
||||
{
|
||||
SndBuffer::Cleanup();
|
||||
}
|
||||
{
|
||||
printf("RESET PS1 \n");
|
||||
memset(spu2regs, 0, 0x010000);
|
||||
|
||||
if (SndBuffer::Test() == 0 && SampleRate != 44100)
|
||||
{
|
||||
SampleRate = 44100;
|
||||
SndBuffer::Cleanup();
|
||||
|
||||
try {
|
||||
SndBuffer::Init();
|
||||
}
|
||||
catch (std::exception& ex) {
|
||||
fprintf(stderr, "SPU2-X Error: Could not initialize device, or something.\nReason: %s", ex.what());
|
||||
SPU2close();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
SampleRate = 44100;
|
||||
|
||||
/* memset(spu2regs, 0, 0x010000);
|
||||
memset(_spu2mem, 0, 0x200000);
|
||||
memset(_spu2mem + 0x2800, 7, 0x10); // from BIOS reversal. Locks the voices so they don't run free.
|
||||
// Reset the cores to actually apply the sample rate. Beware, thar be dragons in here.
|
||||
/*Cores[0].Init(0);
|
||||
Cores[0].Init(0);
|
||||
Cores[1].Init(1);*/
|
||||
try {
|
||||
SndBuffer::Init();
|
||||
} catch (std::exception &ex) {
|
||||
fprintf(stderr, "SPU2-X Error: Could not initialize device, or something.\nReason: %s", ex.what());
|
||||
SPU2close();
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue