summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/aica.c
diff options
context:
space:
mode:
author MetalliC <0vetal0@gmail.com>2015-03-25 21:32:06 +0200
committer MetalliC <0vetal0@gmail.com>2015-03-25 21:32:06 +0200
commit978708879d5da6fc847aef0000c33eb2056b0856 (patch)
tree2589043fbdd188002e4c357b3ad202e46354cbce /src/emu/sound/aica.c
parent71a4103cc61a17c662f045693a7adc698142b02d (diff)
aica.c: ADPCM looping (DC swirl sound) and address masking (Red Dog) fixes [MetalliC, Wind]
Diffstat (limited to 'src/emu/sound/aica.c')
-rw-r--r--src/emu/sound/aica.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/emu/sound/aica.c b/src/emu/sound/aica.c
index a880a226361..1c5d1645fcb 100644
--- a/src/emu/sound/aica.c
+++ b/src/emu/sound/aica.c
@@ -1079,10 +1079,14 @@ INT32 aica_device::UpdateSlot(AICA_SLOT *slot)
UINT32 addr1,addr2,addr_select; // current and next sample addresses
UINT32 *addr[2] = {&addr1, &addr2}; // used for linear interpolation
UINT32 *slot_addr[2] = {&(slot->cur_addr), &(slot->nxt_addr)}; //
+ UINT32 chanlea = LEA(slot);
if(SSCTL(slot)!=0) //no FM or noise yet
return 0;
+ if(PCMS(slot) == 3) // Red Dog music relies on this
+ chanlea = (chanlea + 3) & ~3;
+
if(PLFOS(slot)!=0)
{
step=step*AICAPLFO_Step(&(slot->PLFO));
@@ -1130,7 +1134,7 @@ INT32 aica_device::UpdateSlot(AICA_SLOT *slot)
int cur_sample; //current ADPCM sample
int nxt_sample; //next ADPCM sample
INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
- UINT32 steps_to_go = addr2, curstep = slot->curstep;
+ UINT32 steps_to_go = addr1 > addr2 ? chanlea : addr2, curstep = slot->curstep;
if (slot->adbase)
{
@@ -1186,19 +1190,19 @@ INT32 aica_device::UpdateSlot(AICA_SLOT *slot)
switch(LPCTL(slot))
{
case 0: //no loop
- if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=LEA(slot))
+ if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=chanlea)
{
StopSlot(slot,0);
}
break;
case 1: //normal loop
- if(*addr[addr_select]>=LEA(slot))
+ if(*addr[addr_select]>=chanlea)
{
slot->lpend = 1;
- rem_addr = *slot_addr[addr_select] - (LEA(slot)<<SHIFT);
+ rem_addr = *slot_addr[addr_select] - (chanlea<<SHIFT);
*slot_addr[addr_select]=(LSA(slot)<<SHIFT) + rem_addr;
- if(PCMS(slot)>=2)
+ if(PCMS(slot)>=2 && addr_select == 0)
{
// restore the state @ LSA - the sampler will naturally walk to (LSA + remainder)
slot->adbase = &m_AICARAM[SA(slot)+(LSA(slot)/2)];