view org/vamp_plugins/Plugin.java @ 18:530bf5009ee2

Pull out Feature to a separate file; JNI doesn't seem to be able to find its constructor otherwise. Also a couple of other fixes
author Chris Cannam
date Tue, 07 Feb 2012 12:12:36 +0000
parents 7b1740a9020a
children cf6c69871f9c
line wrap: on
line source

package org.vamp_plugins;

import java.util.TreeMap;
import java.util.ArrayList;

public class Plugin
{
    private long nativeHandle;
    protected Plugin(long handle) { nativeHandle = handle; }

    // PluginBase methods

    public native int getVampApiVersion();
    public native String getIdentifier();
    public native String getName();
    public native String getDescription();
    public native String getMaker();
    public native String getCopyright();
    public native int getPluginVersion();

    public native ParameterDescriptor[] getParameterDescriptors();
    public native float getParameter(String identifier);
    public native void setParameter(String identifier, float value);

    public native String[] getPrograms();
    public native String getCurrentProgram();
    public native void selectProgram(String program);

    // Plugin methods

    public native boolean initialise(int inputChannels,
				     int stepSize,
				     int blockSize);

    public native void reset();
    
    public static enum InputDomain { TimeDomain, FrequencyDomain };
    public native InputDomain getInputDomain();
    
    public native int getPreferredBlockSize();
    public native int getPreferredStepSize();
    public native int getMinChannelCount();
    public native int getMaxChannelCount();

    public native OutputDescriptor[] getOutputDescriptors();

// "Pseudo-typedef antipattern - don't do this": http://www.ibm.com/developerworks/java/library/j-jtp02216/index.html
// (I would like to!)
//    public class FeatureList extends ArrayList<Feature>;
//    public class FeatureSet extends TreeMap<Integer, FeatureList>;

    public native TreeMap<Integer, ArrayList<Feature>>
	process(float[][] inputBuffers,
		RealTime timestamp);

    public native TreeMap<Integer, ArrayList<Feature>>
	getRemainingFeatures();
}