| 49 | } |
| 50 | |
| 51 | void SexyFilter(int32 *in, int32 *out, int32 count) |
| 52 | { |
| 53 | static int64 acc1=0,acc2=0; |
| 54 | int32 mul1,mul2,vmul; |
| 55 | |
| 56 | mul1=(94<<16)/FSettings.SndRate; |
| 57 | mul2=(24<<16)/FSettings.SndRate; |
| 58 | vmul=(FSettings.SoundVolume<<16)*3/4/100; |
| 59 | |
| 60 | //FCEU_DispMessage("SoundVolume %d, vmul %d",0,FSettings.SoundVolume,vmul); |
| 61 | if(FSettings.soundq) vmul/=4; |
| 62 | else vmul*=2; /* TODO: Increase volume in low quality sound rendering code itself */ |
| 63 | |
| 64 | while(count) |
| 65 | { |
| 66 | int64 ino=(int64)*in*vmul; |
| 67 | acc1+=((ino-acc1)*mul1)>>16; |
| 68 | acc2+=((ino-acc1-acc2)*mul2)>>16; |
| 69 | //printf("%d ",*in); |
| 70 | *in=0; |
| 71 | { |
| 72 | int32 t=(acc1-ino+acc2)>>16; |
| 73 | //if(t>32767 || t<-32768) printf("Flow: %d\n",t); |
| 74 | if(t>32767) t=32767; |
| 75 | if(t<-32768) t=-32768; |
| 76 | *out=t; |
| 77 | } |
| 78 | in++; |
| 79 | out++; |
| 80 | count--; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /* Returns number of samples written to out. */ |
| 85 | /* leftover is set to the number of samples that need to be copied |
no outgoing calls
no test coverage detected