Mercurial > hg > jvamp
changeset 45:5cb76aa45ee5
Add getPluginPath (it's useful for looking up other resources, e.g. cat/ttl files, besides plugins)
author | Chris Cannam |
---|---|
date | Mon, 25 Feb 2013 21:47:00 +0000 |
parents | 1fa3d63bfeac |
children | 91259f3449ae |
files | org/vamp_plugins/PluginLoader.java src/PluginLoader.cpp src/org_vamp_plugins_PluginLoader.h |
diffstat | 3 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/org/vamp_plugins/PluginLoader.java Mon Jan 28 14:17:40 2013 +0000 +++ b/org/vamp_plugins/PluginLoader.java Mon Feb 25 21:47:00 2013 +0000 @@ -165,6 +165,15 @@ */ public native String[] getPluginCategory(String key); + /** + * Return the plugin path, that is, the series of local file + * folders that will be searched for plugin files. This is + * platform-specific; it may be a default path, or it may be + * determined by factors such as the VAMP_PATH environment + * variable. + */ + public native String[] getPluginPath(); + private PluginLoader() { initialise(); } private native long loadPluginNative(String key, float inputSampleRate, int adapterFlags);
--- a/src/PluginLoader.cpp Mon Jan 28 14:17:40 2013 +0000 +++ b/src/PluginLoader.cpp Mon Feb 25 21:47:00 2013 +0000 @@ -35,6 +35,7 @@ #include "org_vamp_plugins_PluginLoader.h" #include <vamp-hostsdk/PluginLoader.h> +#include <vamp-hostsdk/PluginHostAdapter.h> #include "handle.h" @@ -90,4 +91,16 @@ return result; } +JNIEXPORT jobjectArray JNICALL +Java_org_vamp_1plugins_PluginLoader_getPluginPath(JNIEnv *env, jobject obj) +{ + std::vector<std::string> path = Vamp::PluginHostAdapter::getPluginPath(); + jobjectArray result = env->NewObjectArray + (path.size(), env->FindClass("java/lang/String"), 0); + for (int i = 0; i < path.size(); ++i) { + env->SetObjectArrayElement(result, i, + env->NewStringUTF(path[i].c_str())); + } + return result; +}
--- a/src/org_vamp_plugins_PluginLoader.h Mon Jan 28 14:17:40 2013 +0000 +++ b/src/org_vamp_plugins_PluginLoader.h Mon Feb 25 21:47:00 2013 +0000 @@ -20,6 +20,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_vamp_1plugins_PluginLoader_getPluginCategory (JNIEnv *, jobject, jstring); +JNIEXPORT jobjectArray JNICALL Java_org_vamp_1plugins_PluginLoader_getPluginPath +(JNIEnv *, jobject); + #ifdef __cplusplus } #endif