int resample( short *in_buf, short *out_buf, int n, int f_need, int f_out, int *last_t )
{
int t0 = *last_t, t1 = 0, t = t0, i = 0, j = 0;
while( j <= n )
{
while( t1 < t )
{
j++;
t1 += f_out;
}
if( j > 1024 )
{
*last_t = f_out - (t1 - t);
NSLog(@"%d",*last_t);
in_buf[0] = in_buf[1024];
return i;
}
else
{
// if (i!=j)
{
NSLog(@"i %d j%d %d",i,j,t1-t);
}
NSLog(@"%d",in_buf[-1]);
out_buf[i] = in_buf[j] - (t1 - t)*(in_buf[j] - in_buf[j-1])/f_out;
i++;
t += f_need;
}
}
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载