MCPcopy Create free account
hub / github.com/TASEmulators/fceux / NeoFilterSound

Function NeoFilterSound

src/filter.cpp:96–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94*/
95
96int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
97{
98 uint32 x;
99 uint32 max;
100 int32 *outsave=out;
101 int32 count=0;
102
103// for(x=0;x<inlen;x++)
104// {
105// if(in[x]>mva){ mva=in[x]; printf("%ld\n",in[x]);}
106// }
107 max=(inlen-1)<<16;
108
109 if(FSettings.soundq==2)
110 for(x=mrindex;x<max;x+=mrratio)
111 {
112 int32 acc=0,acc2=0;
113 unsigned int c;
114 int32 *S,*D;
115
116 for(c=SQ2NCOEFFS,S=&in[(x>>16)-SQ2NCOEFFS],D=sq2coeffs;c;c--,D++)
117 {
118 acc+=(S[c]**D)>>6;
119 acc2+=(S[1+c]**D)>>6;
120 }
121
122 acc=((int64)acc*(65536-(x&65535))+(int64)acc2*(x&65535))>>(16+11);
123 *out=acc;
124 out++;
125 count++;
126 }
127 else
128 for(x=mrindex;x<max;x+=mrratio)
129 {
130 int32 acc=0,acc2=0;
131 unsigned int c;
132 const int32 *S,*D;
133
134 for(c=NCOEFFS,S=&in[(x>>16)-NCOEFFS],D=coeffs;c;c--,D++)
135 {
136 acc+=(S[c]**D)>>6;
137 acc2+=(S[1+c]**D)>>6;
138 }
139
140 acc=((int64)acc*(65536-(x&65535))+(int64)acc2*(x&65535))>>(16+11);
141 *out=acc;
142 out++;
143 count++;
144 }
145
146 mrindex=x-max;
147
148 if(FSettings.soundq==2)
149 {
150 mrindex+=SQ2NCOEFFS*65536;
151 *leftover=SQ2NCOEFFS+1;
152 }
153 else

Callers 1

FlushEmulateSoundFunction · 0.85

Calls 2

SexyFilterFunction · 0.85
SexyFilter2Function · 0.85

Tested by

no test coverage detected