Mercurial > hg > jvamp
changeset 2:d0ecf12b9d7b
Add the rest of the Plugin methods to the Java class
author | Chris Cannam |
---|---|
date | Wed, 18 Jan 2012 09:35:22 +0000 |
parents | ed1972408c28 |
children | 7b1740a9020a |
files | org/vamp_plugins/OutputDescriptor.java org/vamp_plugins/Plugin.java org/vamp_plugins/RealTime.java src/org_vamp_plugins_Plugin.h |
diffstat | 4 files changed, 164 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/vamp_plugins/OutputDescriptor.java Wed Jan 18 09:35:22 2012 +0000 @@ -0,0 +1,31 @@ + +package org.vamp_plugins; + +public class OutputDescriptor { + public String identifier; + public String name; + public String description; + public String unit; + public boolean hasFixedBinCount; + public int binCount; + public String[] binNames; + public boolean hasKnownExtents; + public float minValue; + public float maxValue; + public boolean isQuantized; + public float quantizeStep; + public static enum SampleType { + OneSamplePerStep, FixedSampleRate, VariableSampleRate + }; + public SampleType sampleType; + public float sampleRate; + public boolean hasDuration; + + OutputDescriptor() { + hasFixedBinCount = false; + hasKnownExtents = false; + isQuantized = false; + sampleType = SampleType.OneSamplePerStep; + hasDuration = false; + } +};
--- a/org/vamp_plugins/Plugin.java Fri Jan 13 17:36:22 2012 +0000 +++ b/org/vamp_plugins/Plugin.java Wed Jan 18 09:35:22 2012 +0000 @@ -1,6 +1,9 @@ package org.vamp_plugins; +import java.util.TreeMap; +import java.util.ArrayList; + public class Plugin { private long nativeHandle; @@ -10,5 +13,45 @@ public native String getName(); public native String getDescription(); public native int getPluginVersion(); + + 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(); + + public class Feature { + public boolean hasTimestamp; + public RealTime timestamp; + public boolean hasDuration; + public RealTime duration; + public float[] values; + public String label; + Feature() { + hasTimestamp = false; hasDuration = false; + } + }; + +// "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(); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/vamp_plugins/RealTime.java Wed Jan 18 09:35:22 2012 +0000 @@ -0,0 +1,10 @@ + +package org.vamp_plugins; + +public class RealTime { + public int sec; + public int nsec; + + RealTime(int s, int n) { sec = s; nsec = n; } +} +
--- a/src/org_vamp_plugins_Plugin.h Fri Jan 13 17:36:22 2012 +0000 +++ b/src/org_vamp_plugins_Plugin.h Wed Jan 18 09:35:22 2012 +0000 @@ -39,6 +39,86 @@ JNIEXPORT jint JNICALL Java_org_vamp_1plugins_Plugin_getPluginVersion (JNIEnv *, jobject); +/* + * Class: org_vamp_plugins_Plugin + * Method: initialise + * Signature: (III)Z + */ +JNIEXPORT jboolean JNICALL Java_org_vamp_1plugins_Plugin_initialise + (JNIEnv *, jobject, jint, jint, jint); + +/* + * Class: org_vamp_plugins_Plugin + * Method: reset + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_vamp_1plugins_Plugin_reset + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getInputDomain + * Signature: ()Lorg/vamp_plugins/Plugin/InputDomain; + */ +JNIEXPORT jobject JNICALL Java_org_vamp_1plugins_Plugin_getInputDomain + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getPreferredBlockSize + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_vamp_1plugins_Plugin_getPreferredBlockSize + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getPreferredStepSize + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_vamp_1plugins_Plugin_getPreferredStepSize + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getMinChannelCount + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_vamp_1plugins_Plugin_getMinChannelCount + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getMaxChannelCount + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_vamp_1plugins_Plugin_getMaxChannelCount + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getOutputDescriptors + * Signature: ()[Lorg/vamp_plugins/OutputDescriptor; + */ +JNIEXPORT jobjectArray JNICALL Java_org_vamp_1plugins_Plugin_getOutputDescriptors + (JNIEnv *, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: process + * Signature: ([[FLorg/vamp_plugins/RealTime;)Ljava/util/TreeMap; + */ +JNIEXPORT jobject JNICALL Java_org_vamp_1plugins_Plugin_process + (JNIEnv *, jobject, jobjectArray, jobject); + +/* + * Class: org_vamp_plugins_Plugin + * Method: getRemainingFeatures + * Signature: ()Ljava/util/TreeMap; + */ +JNIEXPORT jobject JNICALL Java_org_vamp_1plugins_Plugin_getRemainingFeatures + (JNIEnv *, jobject); + #ifdef __cplusplus } #endif