Previous 199869 Revisions Next

r36640 Wednesday 25th March, 2015 at 19:32:06 UTC by MetalliC
aica.c: ADPCM looping (DC swirl sound) and address masking (Red Dog) fixes [MetalliC, Wind]
[src/emu/sound]aica.c

trunk/src/emu/sound/aica.c
r245151r245152
10791079   UINT32 addr1,addr2,addr_select;                                   // current and next sample addresses
10801080   UINT32 *addr[2]      = {&addr1, &addr2};                          // used for linear interpolation
10811081   UINT32 *slot_addr[2] = {&(slot->cur_addr), &(slot->nxt_addr)};    //
1082   UINT32 chanlea = LEA(slot);
10821083
10831084   if(SSCTL(slot)!=0)  //no FM or noise yet
10841085      return 0;
10851086
1087   if(PCMS(slot) == 3) // Red Dog music relies on this
1088      chanlea = (chanlea + 3) & ~3;
1089
10861090   if(PLFOS(slot)!=0)
10871091   {
10881092      step=step*AICAPLFO_Step(&(slot->PLFO));
r245151r245152
11301134      int cur_sample;       //current ADPCM sample
11311135      int nxt_sample;       //next ADPCM sample
11321136      INT32 fpart=slot->cur_addr&((1<<SHIFT)-1);
1133      UINT32 steps_to_go = addr2, curstep = slot->curstep;
1137      UINT32 steps_to_go = addr1 > addr2 ? chanlea : addr2, curstep = slot->curstep;
11341138
11351139      if (slot->adbase)
11361140      {
r245151r245152
11861190      switch(LPCTL(slot))
11871191      {
11881192      case 0: //no loop
1189         if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=LEA(slot))
1193         if(*addr[addr_select]>=LSA(slot) && *addr[addr_select]>=chanlea)
11901194         {
11911195            StopSlot(slot,0);
11921196         }
11931197         break;
11941198      case 1: //normal loop
1195         if(*addr[addr_select]>=LEA(slot))
1199         if(*addr[addr_select]>=chanlea)
11961200         {
11971201            slot->lpend = 1;
1198            rem_addr = *slot_addr[addr_select] - (LEA(slot)<<SHIFT);
1202            rem_addr = *slot_addr[addr_select] - (chanlea<<SHIFT);
11991203            *slot_addr[addr_select]=(LSA(slot)<<SHIFT) + rem_addr;
12001204
1201            if(PCMS(slot)>=2)
1205            if(PCMS(slot)>=2 && addr_select == 0)
12021206            {
12031207               // restore the state @ LSA - the sampler will naturally walk to (LSA + remainder)
12041208               slot->adbase = &m_AICARAM[SA(slot)+(LSA(slot)/2)];


Previous 199869 Revisions Next


© 1997-2024 The MAME Team