aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2020-07-23 12:59:19 +0200
committerArisotura <thetotalworm@gmail.com>2020-07-23 12:59:19 +0200
commit2f9a6b7c0346c31cbed34a006174d9a9b4efb79e (patch)
tree23da66d80d0c8cd8f4293e15aeb4a70c46d0ed6f
parent3827fa562fc67ae25c152a8c861c4671a68a1ccb (diff)
SPU: delay channel start until whenever it can actually start. fixes maxmod interpolated mode.
-rw-r--r--src/NDS.cpp2
-rw-r--r--src/SPU.cpp9
-rw-r--r--src/SPU.h3
3 files changed, 12 insertions, 2 deletions
diff --git a/src/NDS.cpp b/src/NDS.cpp
index 8cd7f93..2ad6bad 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -493,7 +493,7 @@ void Reset()
printf("ARM7 BIOS loaded\n");
fclose(f);
}
-
+
#ifdef JIT_ENABLED
ARMJIT::Reset();
#endif
diff --git a/src/SPU.cpp b/src/SPU.cpp
index 9f6b107..cd5c5b8 100644
--- a/src/SPU.cpp
+++ b/src/SPU.cpp
@@ -160,6 +160,8 @@ void Channel::Reset()
else
BusRead32 = NDS::ARM7Read32;
+ KeyOn = false;
+
SetCnt(0);
SrcAddr = 0;
TimerReload = 0;
@@ -187,6 +189,7 @@ void Channel::DoSavestate(Savestate* file)
file->Var8(&VolumeShift);
file->Var8(&Pan);
+ file->Var8((u8*)&KeyOn);
file->Var32(&Timer);
file->Var32((u32*)&Pos);
file->Var16((u16*)&CurSample);
@@ -417,6 +420,12 @@ void Channel::Run(s32* buf, u32 samples)
{
if (!(Cnt & (1<<31))) return;
+ if (KeyOn)
+ {
+ Start();
+ KeyOn = false;
+ }
+
for (u32 s = 0; s < samples; s++)
{
Timer += 512; // 1 sample = 512 cycles at 16MHz
diff --git a/src/SPU.h b/src/SPU.h
index 8ab17a0..964841d 100644
--- a/src/SPU.h
+++ b/src/SPU.h
@@ -69,6 +69,7 @@ public:
u8 VolumeShift;
u8 Pan;
+ bool KeyOn;
u32 Timer;
s32 Pos;
s16 CurSample;
@@ -105,7 +106,7 @@ public:
if ((val & (1<<31)) && !(oldcnt & (1<<31)))
{
- Start();
+ KeyOn = true;
}
}