trunk/src/emu/sound/aica.c
| r245151 | r245152 | |
| 1079 | 1079 | UINT32 addr1,addr2,addr_select; // current and next sample addresses |
| 1080 | 1080 | UINT32 *addr[2] = {&addr1, &addr2}; // used for linear interpolation |
| 1081 | 1081 | UINT32 *slot_addr[2] = {&(slot->cur_addr), &(slot->nxt_addr)}; // |
| 1082 | UINT32 chanlea = LEA(slot); |
| 1082 | 1083 | |
| 1083 | 1084 | if(SSCTL(slot)!=0) //no FM or noise yet |
| 1084 | 1085 | return 0; |
| 1085 | 1086 | |
| 1087 | if(PCMS(slot) == 3) // Red Dog music relies on this |
| 1088 | chanlea = (chanlea + 3) & ~3; |
| 1089 | |
| 1086 | 1090 | if(PLFOS(slot)!=0) |
| 1087 | 1091 | { |
| 1088 | 1092 | step=step*AICAPLFO_Step(&(slot->PLFO)); |
| r245151 | r245152 | |
| 1130 | 1134 | int cur_sample; //current ADPCM sample |
| 1131 | 1135 | int nxt_sample; //next ADPCM sample |
| 1132 | 1136 | 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; |
| 1134 | 1138 | |
| 1135 | 1139 | if (slot->adbase) |
| 1136 | 1140 | { |
| r245151 | r245152 | |
| 1186 | 1190 | switch(LPCTL(slot)) |
| 1187 | 1191 | { |
| 1188 | 1192 | 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) |
| 1190 | 1194 | { |
| 1191 | 1195 | StopSlot(slot,0); |
| 1192 | 1196 | } |
| 1193 | 1197 | break; |
| 1194 | 1198 | case 1: //normal loop |
| 1195 | | if(*addr[addr_select]>=LEA(slot)) |
| 1199 | if(*addr[addr_select]>=chanlea) |
| 1196 | 1200 | { |
| 1197 | 1201 | slot->lpend = 1; |
| 1198 | | rem_addr = *slot_addr[addr_select] - (LEA(slot)<<SHIFT); |
| 1202 | rem_addr = *slot_addr[addr_select] - (chanlea<<SHIFT); |
| 1199 | 1203 | *slot_addr[addr_select]=(LSA(slot)<<SHIFT) + rem_addr; |
| 1200 | 1204 | |
| 1201 | | if(PCMS(slot)>=2) |
| 1205 | if(PCMS(slot)>=2 && addr_select == 0) |
| 1202 | 1206 | { |
| 1203 | 1207 | // restore the state @ LSA - the sampler will naturally walk to (LSA + remainder) |
| 1204 | 1208 | slot->adbase = &m_AICARAM[SA(slot)+(LSA(slot)/2)]; |