我知道这听起来有点傻..但我真的很困惑:
我需要将FFTProcessor类设置为主活动,或者将其移动到com.example.audioconv
包(我试过移动它但是我在加载库时遇到了问题)。
FFTProcessor
类调用in_waslos_kneo_libsimplefft_FFTProcessor.c
这是我必须打电话给班级的地方:
public class MainActivity extends Activity {
//---------------------------------------------------------variables declaration
File externalDir1=Environment.getExternalStorageDirectory();
File externalDir2=Environment.getExternalStorageDirectory();
File f1=new File(externalDir1.getAbsolutePath()+"/Test"+File.separator+"wav1.wav");
File f2=new File(externalDir2.getAbsolutePath()+"/Test"+File.separator+"wav2.wav");
//-----------------------------------load libraryv
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
//-------------------------read files
float[]raw1=bytesToFloats(read(f1));
float[]raw2=bytesToFloats(read(f2));
float[] im1=new float[raw1.length];//----imaginary parts
float[] im2=new float[raw2.length];//----
for(int j=0;j<im1.length;j++)
{
im1[j]=0;
}
for(int k=0;k<im2.length;k++)
{
im2[k]=0;
}
int convhandle= FFTProcessor.createFastConvolutionContext(raw1.length, raw1, im1);
FFTProcessor.performFastConvolution(convhandle, raw2, im2);
//------------------------------------------------convolution log
for (int i=0;i<raw2.length; i++)
Log.i("convolution", "conv output "+raw2+" "+im2);
在FFTProcessor类中:
package in.waslos.kneo.libsimplefft;
public class FFTProcessor{
public static final byte FFT_MODE_NORMAL = 0;
public static final byte FFT_MODE_INVERSE = 1;
public static final byte CPLX_TYPE_SP = 0;
public static final byte CPLX_TYPE_DP = 1;
public static final byte CPLX_TYPE_INT = 2;
static{
System.loadLibrary("simplefft");
System.loadLibrary("simplefft4j");
}
private static native int createFFTContext(int samples, byte mode, byte type);
private static native void destroyFFTContext(int handle);
....
任何帮助?
答案 0 :(得分:0)
你可以创建另一个项目如何将第二个目录包含为源代码并将其添加到项目的类路径中。