commit 27871b1f55b843d8d2dd67fea185ee234ac79c47 Author: MysaaJava Date: Fri Jan 12 16:14:54 2024 +0100 Premier commit - Base de la structure et API LV2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..587beb8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin/ +build/ +gradle/ diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..de7a402 --- /dev/null +++ b/build.gradle @@ -0,0 +1,25 @@ +plugins { + id 'application' + id 'eclipse' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'com.nativelibs4java:bridj:0.7.0' + + implementation 'com.illposed.osc:javaosc-core:0.8' + + implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3' + implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.2' + + implementation 'org.apache.logging.log4j:log4j-core:2.17.1' + + testImplementation 'junit:junit:4.13.2' +} + +application { + mainClass = 'com.bernard.sboard.SBoard' +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..5117c7d --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'SBoard' diff --git a/src/main/java/com/bernard/sboard/AddressRegistry.java b/src/main/java/com/bernard/sboard/AddressRegistry.java new file mode 100644 index 0000000..afe3cc7 --- /dev/null +++ b/src/main/java/com/bernard/sboard/AddressRegistry.java @@ -0,0 +1,11 @@ +package com.bernard.sboard; + +import java.util.Map; + +import com.bernard.sboard.saddr.SAddr; + +public class AddressRegistry { + + Map> adressesMap; + +} diff --git a/src/main/java/com/bernard/sboard/JackController.java b/src/main/java/com/bernard/sboard/JackController.java new file mode 100644 index 0000000..cde541f --- /dev/null +++ b/src/main/java/com/bernard/sboard/JackController.java @@ -0,0 +1,142 @@ +package com.bernard.sboard; + +import static com.bernard.sboard.bridj.LibJack.JackPortFlags.JackPortIsInput; +import static com.bernard.sboard.bridj.LibJack.JackPortFlags.JackPortIsOutput; + +import java.io.IOException; + +import org.bridj.Pointer; + +import com.bernard.sboard.bridj.LibJack; +import com.bernard.sboard.bridj.LibJack.JackPortFlags; +import com.bernard.sboard.bridj.LibJack.JackProcessCallback; +import com.bernard.sboard.config.SBoardConfig; +import com.bernard.sboard.effects.EffectsBox; + +public class JackController { + + SBoardConfig config; + + // Boxes + EffectsBox effectBox; + RepeatBox repeatBox; + SoundBox soundBox; + MixerBox mixerBox; + + Pointer client; + + // Input ports + Pointer micPort, computerInPort; + + // Output ports + Pointer effectsMicPort, soundsPort, repeatedMicPort; + Pointer fakeMicPort, earLoopbackPort; + + int bufferSize; + + + + public JackController(SBoardConfig config, EffectsBox effectBox, RepeatBox repeatBox, SoundBox soundBox, MixerBox mixerBox) { + this.config = config; + this.effectBox = effectBox; + this.repeatBox = repeatBox; + this.soundBox = soundBox; + this.mixerBox = mixerBox; + } + + public void effectsBox(int nframes) { + Pointer inBuffer = LibJack.jack_port_get_buffer(micPort, nframes).as(Float.class); + Pointer outBuffer = LibJack.jack_port_get_buffer(effectsMicPort, nframes).as(Float.class); + + effectBox.applyEffects(nframes, inBuffer, outBuffer); + } + + public void soundBox(int nframes) { + Pointer outBuffer = LibJack.jack_port_get_buffer(soundsPort, nframes); + + soundBox.produceFrame(nframes, outBuffer); + } + + public void repeatBoxIn(int nframes) { + Pointer inBuffer = LibJack.jack_port_get_buffer(repeatedMicPort, nframes); + + repeatBox.recordBuffer(nframes, inBuffer); + } + + public void repeatBoxOut(int nframes) { + Pointer outBuffer = LibJack.jack_port_get_buffer(micPort, nframes); + + repeatBox.retieveBuffer(nframes, outBuffer); + } + + public void mixerBox(int nframes) { + Pointer effectsMicBuffer = LibJack.jack_port_get_buffer(effectsMicPort, nframes); + Pointer soundsBuffer = LibJack.jack_port_get_buffer(soundsPort, nframes); + Pointer repeatedMicBuffer = LibJack.jack_port_get_buffer(repeatedMicPort, nframes); + Pointer computerInBuffer = LibJack.jack_port_get_buffer(computerInPort, nframes); + Pointer fakeMicBuffer = LibJack.jack_port_get_buffer(fakeMicPort, nframes); + Pointer loopbackEarBuffer = LibJack.jack_port_get_buffer(earLoopbackPort, nframes); + + mixerBox.mixFrames(nframes, effectsMicBuffer, soundsBuffer, repeatedMicBuffer, computerInBuffer, fakeMicBuffer, loopbackEarBuffer); + } + + public void setup() { + client = LibJack.jack_client_open(Pointer.pointerToCString(config.jackControllerName), 0 /*JackNullOption*/, null); + + setupPorts(); + + bufferSize = LibJack.jack_get_buffer_size(client); + + LibJack.jackSetProcessCallback(client, Pointer.getPointer(new InternalJackCallback()), Pointer.NULL); + + if(LibJack.jack_activate(client)!=0) { + throw new IllegalStateException("Le client jack n'a pas pu être créé."); + } + } + + private void setupPorts() { + micPort = addAudioPort(config.micPortName , config.jackAudioType, JackPortIsInput ); + computerInPort = addAudioPort(config.computerInPortName , config.jackAudioType, JackPortIsInput ); + effectsMicPort = addAudioPort(config.effectsMicPortName , config.jackAudioType, JackPortIsOutput); + soundsPort = addAudioPort(config.soundsPortName , config.jackAudioType, JackPortIsOutput); + repeatedMicPort = addAudioPort(config.repeatedMicName , config.jackAudioType, JackPortIsOutput); + fakeMicPort = addAudioPort(config.fakeMicPortName , config.jackAudioType, JackPortIsOutput); + earLoopbackPort = addAudioPort(config.earLoopbackPortName, config.jackAudioType, JackPortIsOutput); + + } + + private Pointer addAudioPort(String name, String audioType, JackPortFlags type) { + return LibJack.jack_port_register(client, Pointer.pointerToCString(name), Pointer.pointerToCString(audioType), type.value, 0); + } + + private class InternalJackCallback extends JackProcessCallback { + + @Override + public int apply(int nframes, Pointer arg) { + + // mic --> effects_mic + effectsBox(nframes); + + // X --> sounds + soundBox(nframes); + + // repeat_mic --> X + repeatBoxIn(nframes); + + // X --> repeated_mic + repeatBoxOut(nframes); + + // Balance + mixerBox(nframes); + + return 0; + } + + } + + public void close() throws IOException{ + if(LibJack.jack_client_close(client)!=0) + throw new IOException("Le client jack n'a pas pu être fermé."); + } + +} diff --git a/src/main/java/com/bernard/sboard/MixerBox.java b/src/main/java/com/bernard/sboard/MixerBox.java new file mode 100644 index 0000000..6949f46 --- /dev/null +++ b/src/main/java/com/bernard/sboard/MixerBox.java @@ -0,0 +1,34 @@ +package com.bernard.sboard; + +import org.bridj.Pointer; + +public class MixerBox { + + float effectsMicVolume = 1.0f; + float soundsVolume = 1.0f; + float repeatedMicVolume = 1.0f; + float computerInputVolume = 1.0f; + + float master = 1.0f; + + float fakeMicVolume = 1.0f; + float loopbackEarVolume = 1.0f; + + public void mixFrames(int nframes,Pointer effectsBuffer, Pointer soundsBuffer, Pointer repeatedMicBuffer, Pointer computerInBuffer, Pointer fakeMicBuffer, Pointer loopbackEarBuffer) { + float volumeSum = effectsMicVolume + soundsVolume + repeatedMicVolume + computerInputVolume; + for (int frame=0;frame inBuffer) { + + } + + public void retieveBuffer(int nframes, Pointer outBuffer) { + + } + + public void close() { + + } +} diff --git a/src/main/java/com/bernard/sboard/SBoard.java b/src/main/java/com/bernard/sboard/SBoard.java new file mode 100644 index 0000000..5f89a79 --- /dev/null +++ b/src/main/java/com/bernard/sboard/SBoard.java @@ -0,0 +1,141 @@ +package com.bernard.sboard; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Random; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +import com.bernard.sboard.config.SBoardConfig; +import com.bernard.sboard.effects.EffectsBox; +import com.bernard.sboard.osc.OscServer; +import com.bernard.sboard.osc.OscUtils; +import com.bernard.sboard.osc.SOscMessage; +import com.fasterxml.jackson.databind.DatabindException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; + +public class SBoard { + + public SBoardConfig config; + + public Random random; + + public static final String configFilename = System.getProperty("user.home")+"/.config/sboard.yml"; + + public Logger log = LogManager.getLogger(SBoard.class); + + + EffectsBox ebox; + RepeatBox rbox; + SoundBox sbox; + MixerBox mbox; + JackController jackc; + OscServer oscserv; + + public SBoard(SBoardConfig config) { + this.config = config; + this.random = new Random(); + + ebox = new EffectsBox(this, config.effects); + ebox.setup(); + + rbox = new RepeatBox(); + + sbox = new SoundBox(); + + mbox = new MixerBox(); + + jackc = new JackController(config, ebox, rbox, sbox, mbox); + jackc.setup(); + + oscserv = new OscServer(this, config.osc); + try { + oscserv.setup(); + } catch (IOException e) { + log.error("Could not start the oscserver",e); + } + } + public static void main(String[] args) throws InterruptedException, IOException { + + //TODO: passer sur quelque chose de plus configurable + BasicConfigurator.configure(); + + SBoardConfig config = readConfig(configFilename); + + SBoard sboard = new SBoard(config); + + Thread.sleep(100_000); + + sboard.close(); + + System.exit(0); + } + + public void close() { + + try { + oscserv.close(); + }catch(IOException e) { + log.error("Could not close osc server", e); + } + + try{ + jackc.close(); + }catch(IOException e){ + log.error("Could not close jack server", e); + } + + ebox.close(); + rbox.close(); + sbox.close(); + mbox.close(); + + } + + public static SBoardConfig readConfig(String configFName) { + Logger configLog = LogManager.getLogger("Config Loader"); + + SBoardConfig output = null; + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + + File configFile = new File(configFName); + + if(!configFile.exists()) { + // On écrit le fichier + configLog.info("Création d'un nouveau fichier de configuration."); + try { + configFile.createNewFile(); + mapper.writeValue(new FileOutputStream(configFile), new SBoardConfig()); + } catch (DatabindException e) { + configLog.error("Le fichier écrit n'est pas un fichier de configuration valide !",e); + } catch (IOException e) { + configLog.error("Impossible d'écrire le fichier de configuration par défaut !",e); + } + } + + configLog.info("Lecture du fichier de configuration."); + try { + output = mapper.readValue(configFile,SBoardConfig.class); + if(output==null) + configLog.error("Impossible de lire le fichier de configuration !"); + } catch (DatabindException e) { + configLog.error("Le fichier lu n'est pas un fichier de configuration valide !",e); + } catch (IOException e) { + configLog.error("Impossible d'écrire le fichier de configuration par défaut !",e); + } + + if(output==null) + System.exit(13); + + return output; + } + public void dispatchOscMessage(SOscMessage message) { + if(OscUtils.addrMatch(message.getContainer(0),"effectsbox")) { + ebox.receiveOscMessage(message); + } + } +} diff --git a/src/main/java/com/bernard/sboard/SoundBox.java b/src/main/java/com/bernard/sboard/SoundBox.java new file mode 100644 index 0000000..dfbd268 --- /dev/null +++ b/src/main/java/com/bernard/sboard/SoundBox.java @@ -0,0 +1,15 @@ +package com.bernard.sboard; + +import org.bridj.Pointer; + +public class SoundBox { + + + public void produceFrame(int nframes, Pointer outBuffer) { + + } + + public void close() { + + } +} diff --git a/src/main/java/com/bernard/sboard/bridj/LV2_Descriptor.java b/src/main/java/com/bernard/sboard/bridj/LV2_Descriptor.java new file mode 100644 index 0000000..20c03e5 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LV2_Descriptor.java @@ -0,0 +1,392 @@ +package com.bernard.sboard.bridj; +import org.bridj.Callback; +import org.bridj.Pointer; +import org.bridj.StructObject; +import org.bridj.ann.Field; +import org.bridj.ann.Library; +/** + * native declaration : /usr/lib/lv2/core.lv2/lv2.h
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java or BridJ . + */ +@Library("lilv-0") +public class LV2_Descriptor extends StructObject { + public LV2_Descriptor() { + super(); + } + /** + * A globally unique, case-sensitive identifier for this plugin.
+ * This MUST be a valid URI string as defined by RFC 3986. All plugins with
+ * the same URI MUST be compatible to some degree, see
+ * http://lv2plug.in/ns/lv2core for details.
+ * C type : const char* + */ + @Field(0) + public Pointer URI() { + return this.io.getPointerField(this, 0); + } + /** + * A globally unique, case-sensitive identifier for this plugin.
+ * This MUST be a valid URI string as defined by RFC 3986. All plugins with
+ * the same URI MUST be compatible to some degree, see
+ * http://lv2plug.in/ns/lv2core for details.
+ * C type : const char* + */ + @Field(0) + public LV2_Descriptor URI(Pointer URI) { + this.io.setPointerField(this, 0, URI); + return this; + } + /** + * Instantiate the plugin.
+ * Note that instance initialisation should generally occur in activate()
+ * rather than here. If a host calls instantiate(), it MUST call cleanup()
+ * at some point in the future.
+ * @param descriptor Descriptor of the plugin to instantiate.
+ * @param sample_rate Sample rate, in Hz, for the new plugin instance.
+ * @param bundle_path Path to the LV2 bundle which contains this plugin
+ * binary. It MUST include the trailing directory separator so that simply
+ * appending a filename will yield the path to that file in the bundle.
+ * @param features A NULL terminated array of LV2_Feature structs which
+ * represent the features the host supports. Plugins may refuse to
+ * instantiate if required features are not found here. However, hosts MUST
+ * NOT use this as a discovery mechanism: instead, use the RDF data to
+ * determine which features are required and do not attempt to instantiate
+ * unsupported plugins at all. This parameter MUST NOT be NULL, i.e. a host
+ * that supports no features MUST pass a single element array containing
+ * NULL.
+ * @return A handle for the new plugin instance, or NULL if instantiation
+ * has failed.
+ * C type : instantiate_callback + */ + @Field(1) + public Pointer instantiate() { + return this.io.getPointerField(this, 1); + } + /** + * Instantiate the plugin.
+ * Note that instance initialisation should generally occur in activate()
+ * rather than here. If a host calls instantiate(), it MUST call cleanup()
+ * at some point in the future.
+ * @param descriptor Descriptor of the plugin to instantiate.
+ * @param sample_rate Sample rate, in Hz, for the new plugin instance.
+ * @param bundle_path Path to the LV2 bundle which contains this plugin
+ * binary. It MUST include the trailing directory separator so that simply
+ * appending a filename will yield the path to that file in the bundle.
+ * @param features A NULL terminated array of LV2_Feature structs which
+ * represent the features the host supports. Plugins may refuse to
+ * instantiate if required features are not found here. However, hosts MUST
+ * NOT use this as a discovery mechanism: instead, use the RDF data to
+ * determine which features are required and do not attempt to instantiate
+ * unsupported plugins at all. This parameter MUST NOT be NULL, i.e. a host
+ * that supports no features MUST pass a single element array containing
+ * NULL.
+ * @return A handle for the new plugin instance, or NULL if instantiation
+ * has failed.
+ * C type : instantiate_callback + */ + @Field(1) + public LV2_Descriptor instantiate(Pointer instantiate) { + this.io.setPointerField(this, 1, instantiate); + return this; + } + /** + * Connect a port on a plugin instance to a memory location.
+ * Plugin writers should be aware that the host may elect to use the same
+ * buffer for more than one port and even use the same buffer for both
+ * input and output (see lv2:inPlaceBroken in lv2.ttl).
+ * If the plugin has the feature lv2:hardRTCapable then there are various
+ * things that the plugin MUST NOT do within the connect_port() function;
+ * see lv2core.ttl for details.
+ * connect_port() MUST be called at least once for each port before run()
+ * is called, unless that port is lv2:connectionOptional. The plugin must
+ * pay careful attention to the block size passed to run() since the block
+ * allocated may only just be large enough to contain the data, and is not
+ * guaranteed to remain constant between run() calls.
+ * connect_port() may be called more than once for a plugin instance to
+ * allow the host to change the buffers that the plugin is reading or
+ * writing. These calls may be made before or after activate() or
+ * deactivate() calls.
+ * @param instance Plugin instance containing the port.
+ * @param port Index of the port to connect. The host MUST NOT try to
+ * connect a port index that is not defined in the plugin's RDF data. If
+ * it does, the plugin's behaviour is undefined (a crash is likely).
+ * @param data_location Pointer to data of the type defined by the port
+ * type in the plugin's RDF data (for example, an array of float for an
+ * lv2:AudioPort). This pointer must be stored by the plugin instance and
+ * used to read/write data when run() is called. Data present at the time
+ * of the connect_port() call MUST NOT be considered meaningful.
+ * C type : connect_port_callback + */ + @Field(2) + public Pointer connect_port() { + return this.io.getPointerField(this, 2); + } + /** + * Connect a port on a plugin instance to a memory location.
+ * Plugin writers should be aware that the host may elect to use the same
+ * buffer for more than one port and even use the same buffer for both
+ * input and output (see lv2:inPlaceBroken in lv2.ttl).
+ * If the plugin has the feature lv2:hardRTCapable then there are various
+ * things that the plugin MUST NOT do within the connect_port() function;
+ * see lv2core.ttl for details.
+ * connect_port() MUST be called at least once for each port before run()
+ * is called, unless that port is lv2:connectionOptional. The plugin must
+ * pay careful attention to the block size passed to run() since the block
+ * allocated may only just be large enough to contain the data, and is not
+ * guaranteed to remain constant between run() calls.
+ * connect_port() may be called more than once for a plugin instance to
+ * allow the host to change the buffers that the plugin is reading or
+ * writing. These calls may be made before or after activate() or
+ * deactivate() calls.
+ * @param instance Plugin instance containing the port.
+ * @param port Index of the port to connect. The host MUST NOT try to
+ * connect a port index that is not defined in the plugin's RDF data. If
+ * it does, the plugin's behaviour is undefined (a crash is likely).
+ * @param data_location Pointer to data of the type defined by the port
+ * type in the plugin's RDF data (for example, an array of float for an
+ * lv2:AudioPort). This pointer must be stored by the plugin instance and
+ * used to read/write data when run() is called. Data present at the time
+ * of the connect_port() call MUST NOT be considered meaningful.
+ * C type : connect_port_callback + */ + @Field(2) + public LV2_Descriptor connect_port(Pointer connect_port) { + this.io.setPointerField(this, 2, connect_port); + return this; + } + /** + * Initialise a plugin instance and activate it for use.
+ * This is separated from instantiate() to aid real-time support and so
+ * that hosts can reinitialise a plugin instance by calling deactivate()
+ * and then activate(). In this case the plugin instance MUST reset all
+ * state information dependent on the history of the plugin instance except
+ * for any data locations provided by connect_port(). If there is nothing
+ * for activate() to do then this field may be NULL.
+ * When present, hosts MUST call this function once before run() is called
+ * for the first time. This call SHOULD be made as close to the run() call
+ * as possible and indicates to real-time plugins that they are now live,
+ * however plugins MUST NOT rely on a prompt call to run() after
+ * activate().
+ * The host MUST NOT call activate() again until deactivate() has been
+ * called first. If a host calls activate(), it MUST call deactivate() at
+ * some point in the future. Note that connect_port() may be called before
+ * or after activate().
+ * C type : activate_callback + */ + @Field(3) + public Pointer activate() { + return this.io.getPointerField(this, 3); + } + /** + * Initialise a plugin instance and activate it for use.
+ * This is separated from instantiate() to aid real-time support and so
+ * that hosts can reinitialise a plugin instance by calling deactivate()
+ * and then activate(). In this case the plugin instance MUST reset all
+ * state information dependent on the history of the plugin instance except
+ * for any data locations provided by connect_port(). If there is nothing
+ * for activate() to do then this field may be NULL.
+ * When present, hosts MUST call this function once before run() is called
+ * for the first time. This call SHOULD be made as close to the run() call
+ * as possible and indicates to real-time plugins that they are now live,
+ * however plugins MUST NOT rely on a prompt call to run() after
+ * activate().
+ * The host MUST NOT call activate() again until deactivate() has been
+ * called first. If a host calls activate(), it MUST call deactivate() at
+ * some point in the future. Note that connect_port() may be called before
+ * or after activate().
+ * C type : activate_callback + */ + @Field(3) + public LV2_Descriptor activate(Pointer activate) { + this.io.setPointerField(this, 3, activate); + return this; + } + /** + * Run a plugin instance for a block.
+ * Note that if an activate() function exists then it must be called before
+ * run(). If deactivate() is called for a plugin instance then run() may
+ * not be called until activate() has been called again.
+ * If the plugin has the feature lv2:hardRTCapable then there are various
+ * things that the plugin MUST NOT do within the run() function (see
+ * lv2core.ttl for details).
+ * As a special case, when `sample_count` is 0, the plugin should update
+ * any output ports that represent a single instant in time (for example,
+ * control ports, but not audio ports). This is particularly useful for
+ * latent plugins, which should update their latency output port so hosts
+ * can pre-roll plugins to compute latency. Plugins MUST NOT crash when
+ * `sample_count` is 0.
+ * @param instance Instance to be run.
+ * @param sample_count The block size (in samples) for which the plugin
+ * instance must run.
+ * C type : run_callback + */ + @Field(4) + public Pointer run() { + return this.io.getPointerField(this, 4); + } + /** + * Run a plugin instance for a block.
+ * Note that if an activate() function exists then it must be called before
+ * run(). If deactivate() is called for a plugin instance then run() may
+ * not be called until activate() has been called again.
+ * If the plugin has the feature lv2:hardRTCapable then there are various
+ * things that the plugin MUST NOT do within the run() function (see
+ * lv2core.ttl for details).
+ * As a special case, when `sample_count` is 0, the plugin should update
+ * any output ports that represent a single instant in time (for example,
+ * control ports, but not audio ports). This is particularly useful for
+ * latent plugins, which should update their latency output port so hosts
+ * can pre-roll plugins to compute latency. Plugins MUST NOT crash when
+ * `sample_count` is 0.
+ * @param instance Instance to be run.
+ * @param sample_count The block size (in samples) for which the plugin
+ * instance must run.
+ * C type : run_callback + */ + @Field(4) + public LV2_Descriptor run(Pointer run) { + this.io.setPointerField(this, 4, run); + return this; + } + /** + * Deactivate a plugin instance (counterpart to activate()).
+ * Hosts MUST deactivate all activated instances after they have been run()
+ * for the last time. This call SHOULD be made as close to the last run()
+ * call as possible and indicates to real-time plugins that they are no
+ * longer live, however plugins MUST NOT rely on prompt deactivation. If
+ * there is nothing for deactivate() to do then this field may be NULL
+ * Deactivation is not similar to pausing since the plugin instance will be
+ * reinitialised by activate(). However, deactivate() itself MUST NOT fully
+ * reset plugin state. For example, the host may deactivate a plugin, then
+ * store its state (using some extension to do so).
+ * Hosts MUST NOT call deactivate() unless activate() was previously
+ * called. Note that connect_port() may be called before or after
+ * deactivate().
+ * C type : deactivate_callback + */ + @Field(5) + public Pointer deactivate() { + return this.io.getPointerField(this, 5); + } + /** + * Deactivate a plugin instance (counterpart to activate()).
+ * Hosts MUST deactivate all activated instances after they have been run()
+ * for the last time. This call SHOULD be made as close to the last run()
+ * call as possible and indicates to real-time plugins that they are no
+ * longer live, however plugins MUST NOT rely on prompt deactivation. If
+ * there is nothing for deactivate() to do then this field may be NULL
+ * Deactivation is not similar to pausing since the plugin instance will be
+ * reinitialised by activate(). However, deactivate() itself MUST NOT fully
+ * reset plugin state. For example, the host may deactivate a plugin, then
+ * store its state (using some extension to do so).
+ * Hosts MUST NOT call deactivate() unless activate() was previously
+ * called. Note that connect_port() may be called before or after
+ * deactivate().
+ * C type : deactivate_callback + */ + @Field(5) + public LV2_Descriptor deactivate(Pointer deactivate) { + this.io.setPointerField(this, 5, deactivate); + return this; + } + /** + * Clean up a plugin instance (counterpart to instantiate()).
+ * Once an instance of a plugin has been finished with it must be deleted
+ * using this function. The instance handle passed ceases to be valid after
+ * this call.
+ * If activate() was called for a plugin instance then a corresponding call
+ * to deactivate() MUST be made before cleanup() is called. Hosts MUST NOT
+ * call cleanup() unless instantiate() was previously called.
+ * C type : cleanup_callback + */ + @Field(6) + public Pointer cleanup() { + return this.io.getPointerField(this, 6); + } + /** + * Clean up a plugin instance (counterpart to instantiate()).
+ * Once an instance of a plugin has been finished with it must be deleted
+ * using this function. The instance handle passed ceases to be valid after
+ * this call.
+ * If activate() was called for a plugin instance then a corresponding call
+ * to deactivate() MUST be made before cleanup() is called. Hosts MUST NOT
+ * call cleanup() unless instantiate() was previously called.
+ * C type : cleanup_callback + */ + @Field(6) + public LV2_Descriptor cleanup(Pointer cleanup) { + this.io.setPointerField(this, 6, cleanup); + return this; + } + /** + * Return additional plugin data defined by some extension.
+ * A typical use of this facility is to return a struct containing function
+ * pointers to extend the LV2_Descriptor API.
+ * The actual type and meaning of the returned object MUST be specified
+ * precisely by the extension. This function MUST return NULL for any
+ * unsupported URI. If a plugin does not support any extension data, this
+ * field may be NULL.
+ * The host is never responsible for freeing the returned value.
+ * C type : extension_data_callback + */ + @Field(7) + public Pointer extension_data() { + return this.io.getPointerField(this, 7); + } + /** + * Return additional plugin data defined by some extension.
+ * A typical use of this facility is to return a struct containing function
+ * pointers to extend the LV2_Descriptor API.
+ * The actual type and meaning of the returned object MUST be specified
+ * precisely by the extension. This function MUST return NULL for any
+ * unsupported URI. If a plugin does not support any extension data, this
+ * field may be NULL.
+ * The host is never responsible for freeing the returned value.
+ * C type : extension_data_callback + */ + @Field(7) + public LV2_Descriptor extension_data(Pointer extension_data) { + this.io.setPointerField(this, 7, extension_data); + return this; + } + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class instantiate_callback extends Callback { + abstract public Pointer apply(Pointer descriptor, double sample_rate, Pointer bundle_path, Pointer > features); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class connect_port_callback extends Callback { + abstract public void apply(Pointer instance, int port, Pointer data_location); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class activate_callback extends Callback { + abstract public void apply(Pointer instance); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class run_callback extends Callback { + abstract public void apply(Pointer instance, int sample_count); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class deactivate_callback extends Callback { + abstract public void apply(Pointer instance); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class cleanup_callback extends Callback { + abstract public void apply(Pointer instance); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class extension_data_callback extends Callback { + abstract public Pointer apply(Pointer uri); + }; + public LV2_Descriptor(Pointer pointer) { + super(pointer); + } +} diff --git a/src/main/java/com/bernard/sboard/bridj/LV2_Feature.java b/src/main/java/com/bernard/sboard/bridj/LV2_Feature.java new file mode 100644 index 0000000..d35a2a3 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LV2_Feature.java @@ -0,0 +1,60 @@ +package com.bernard.sboard.bridj; +import org.bridj.Pointer; +import org.bridj.StructObject; +import org.bridj.ann.Field; +import org.bridj.ann.Library; +/** + * native declaration : /usr/lib/lv2/core.lv2/lv2.h
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java or BridJ . + */ +@Library("lv2") +public class LV2_Feature extends StructObject { + public LV2_Feature() { + super(); + } + /** + * A globally unique, case-sensitive identifier (URI) for this feature.
+ * This MUST be a valid URI string as defined by RFC 3986.
+ * C type : const char* + */ + @Field(0) + public Pointer URI() { + return this.io.getPointerField(this, 0); + } + /** + * A globally unique, case-sensitive identifier (URI) for this feature.
+ * This MUST be a valid URI string as defined by RFC 3986.
+ * C type : const char* + */ + @Field(0) + public LV2_Feature URI(Pointer URI) { + this.io.setPointerField(this, 0, URI); + return this; + } + /** + * Pointer to arbitrary data.
+ * The format of this data is defined by the extension which describes the
+ * feature with the given `URI`.
+ * C type : void* + */ + @Field(1) + public Pointer data() { + return this.io.getPointerField(this, 1); + } + /** + * Pointer to arbitrary data.
+ * The format of this data is defined by the extension which describes the
+ * feature with the given `URI`.
+ * C type : void* + */ + @Field(1) + public LV2_Feature data(Pointer data) { + this.io.setPointerField(this, 1, data); + return this; + } + public LV2_Feature(Pointer pointer) { + super(pointer); + } +} diff --git a/src/main/java/com/bernard/sboard/bridj/LV2_Lib_Descriptor.java b/src/main/java/com/bernard/sboard/bridj/LV2_Lib_Descriptor.java new file mode 100644 index 0000000..9aebaa7 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LV2_Lib_Descriptor.java @@ -0,0 +1,111 @@ +package com.bernard.sboard.bridj; +import org.bridj.Callback; +import org.bridj.Pointer; +import org.bridj.StructObject; +import org.bridj.ann.Field; +import org.bridj.ann.Library; +/** + * native declaration : /usr/lib/lv2/core.lv2/lv2.h
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java or BridJ . + */ +@Library("lv2") +public class LV2_Lib_Descriptor extends StructObject { + public LV2_Lib_Descriptor() { + super(); + } + /** + * Opaque library data which must be passed as the first parameter to all
+ * the methods of this struct.
+ * C type : LV2_Lib_Handle + */ + @Field(0) + public Pointer handle() { + return this.io.getPointerField(this, 0); + } + /** + * Opaque library data which must be passed as the first parameter to all
+ * the methods of this struct.
+ * C type : LV2_Lib_Handle + */ + @Field(0) + public LV2_Lib_Descriptor handle(Pointer handle) { + this.io.setPointerField(this, 0, handle); + return this; + } + /** + * The total size of this struct. This allows for this struct to be
+ * expanded in the future if necessary. This MUST be set by the library to
+ * sizeof(LV2_Lib_Descriptor). The host MUST NOT access any fields of this
+ * struct beyond get_plugin() unless this field indicates they are present. + */ + @Field(1) + public int size() { + return this.io.getIntField(this, 1); + } + /** + * The total size of this struct. This allows for this struct to be
+ * expanded in the future if necessary. This MUST be set by the library to
+ * sizeof(LV2_Lib_Descriptor). The host MUST NOT access any fields of this
+ * struct beyond get_plugin() unless this field indicates they are present. + */ + @Field(1) + public LV2_Lib_Descriptor size(int size) { + this.io.setIntField(this, 1, size); + return this; + } + /** + * Destroy this library descriptor and free all related resources.
+ * C type : cleanup_callback + */ + @Field(2) + public Pointer cleanup() { + return this.io.getPointerField(this, 2); + } + /** + * Destroy this library descriptor and free all related resources.
+ * C type : cleanup_callback + */ + @Field(2) + public LV2_Lib_Descriptor cleanup(Pointer cleanup) { + this.io.setPointerField(this, 2, cleanup); + return this; + } + /** + * Plugin accessor.
+ * Plugins are accessed by index using values from 0 upwards. Out of range
+ * indices MUST result in this function returning NULL, so the host can
+ * enumerate plugins by increasing `index` until NULL is returned.
+ * C type : get_plugin_callback + */ + @Field(3) + public Pointer get_plugin() { + return this.io.getPointerField(this, 3); + } + /** + * Plugin accessor.
+ * Plugins are accessed by index using values from 0 upwards. Out of range
+ * indices MUST result in this function returning NULL, so the host can
+ * enumerate plugins by increasing `index` until NULL is returned.
+ * C type : get_plugin_callback + */ + @Field(3) + public LV2_Lib_Descriptor get_plugin(Pointer get_plugin) { + this.io.setPointerField(this, 3, get_plugin); + return this; + } + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class cleanup_callback extends Callback { + abstract public void apply(Pointer handle); + }; + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + /// native declaration : /usr/lib/lv2/core.lv2/lv2.h + public static abstract class get_plugin_callback extends Callback { + abstract public Pointer apply(Pointer handle, int index); + }; + public LV2_Lib_Descriptor(Pointer pointer) { + super(pointer); + } +} diff --git a/src/main/java/com/bernard/sboard/bridj/LibJack.java b/src/main/java/com/bernard/sboard/bridj/LibJack.java new file mode 100644 index 0000000..2f52b77 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LibJack.java @@ -0,0 +1,160 @@ +package com.bernard.sboard.bridj; + +import java.util.Collections; +import java.util.Iterator; + +import org.bridj.BridJ; +import org.bridj.CRuntime; +import org.bridj.Callback; +import org.bridj.FlagSet; +import org.bridj.IntValuedEnum; +import org.bridj.Pointer; +import org.bridj.ann.Library; +import org.bridj.ann.Name; +import org.bridj.ann.Runtime; + +@Library("jack") +@Runtime(CRuntime.class) +public class LibJack { + static { + BridJ.register(); + } + + public native static int jack_client_close(Pointer client); + + public native static int jack_activate(Pointer client); + + public native static int jack_get_buffer_size(Pointer client); + + public native static Pointer jack_midi_event_reserve(Pointer port_buffer, int time, int data_size); + + public native static void jack_midi_clear_buffer(Pointer port_buffer); + + public native static Pointer jack_port_get_buffer(Pointer output_port, int nframes); + + public native static Pointer jack_port_register(Pointer client, Pointer port_name, Pointer port_type, long flags, long buffer_size); + + public native static Pointer jack_client_open(Pointer client_name, int options, Pointer status); + + @Name("jack_set_process_callback") + native public static int jackSetProcessCallback(Pointer client, Pointer process_callback, Pointer arg); + + public static abstract class JackProcessCallback extends Callback { + abstract public int apply(int nframes, Pointer arg); + } + + public enum JackStatus implements IntValuedEnum { + /// Overall operation failed. + JackFailure(1), + /// The operation contained an invalid or unsupported option. + JackInvalidOption(2), + /** + * The desired client name was not unique. With the @ref
+ * JackUseExactName option this situation is fatal. Otherwise,
+ * the name was modified by appending a dash and a two-digit
+ * number in the range "-01" to "-99". The
+ * jack_get_client_name() function will return the exact string
+ * that was used. If the specified @a client_name plus these
+ * extra characters would be too long, the open fails instead. + */ + JackNameNotUnique(4), + /** + * The JACK server was started as a result of this operation.
+ * Otherwise, it was running already. In either case the caller
+ * is now connected to jackd, so there is no race condition.
+ * When the server shuts down, the client will find out. + */ + JackServerStarted(8), + /// Unable to connect to the JACK server. + JackServerFailed(16), + /// Communication error with the JACK server. + JackServerError(32), + /// Requested client does not exist. + JackNoSuchClient(64), + /// Unable to load internal client + JackLoadFailure(128), + /// Unable to initialize client + JackInitFailure(256), + /// Unable to access shared memory + JackShmFailure(512), + /// Client's protocol version does not match + JackVersionError(1024), + /// Backend error + JackBackendError(2048), + /// Client zombified failure + JackClientZombie(4096); + JackStatus(long value) { + this.value = value; + } + public final long value; + public long value() { + return this.value; + } + public Iterator iterator() { + return Collections.singleton(this).iterator(); + } + public static IntValuedEnum fromValue(int value) { + return FlagSet.fromValue(value, values()); + } + } + + /** + * enum values
+ * native declaration : line 8 + */ + public enum JackPortFlags implements IntValuedEnum { + /** + * if JackPortIsInput is set, then the port can receive
+ * data. + */ + JackPortIsInput(1), + /** + * if JackPortIsOutput is set, then data can be read from
+ * the port. + */ + JackPortIsOutput(2), + /** + * if JackPortIsPhysical is set, then the port corresponds
+ * to some kind of physical I/O connector. + */ + JackPortIsPhysical(4), + /** + * if JackPortCanMonitor is set, then a call to
+ * jack_port_request_monitor() makes sense.
+ * * Precisely what this means is dependent on the client. A typical
+ * result of it being called with TRUE as the second argument is
+ * that data that would be available from an output port (with
+ * JackPortIsPhysical set) is sent to a physical output connector
+ * as well, so that it can be heard/seen/whatever.
+ * * Clients that do not control physical interfaces
+ * should never create ports with this bit set. + */ + JackPortCanMonitor(8), + /** + * JackPortIsTerminal means:
+ * * for an input port: the data received by the port
+ * will not be passed on or made
+ * available at any other port
+ * * for an output port: the data available at the port
+ * does not originate from any other port
+ * * Audio synthesizers, I/O hardware interface clients, HDR
+ * systems are examples of clients that would set this flag for
+ * their ports. + */ + JackPortIsTerminal(16); + JackPortFlags(long value) { + this.value = value; + } + public final long value; + public long value() { + return this.value; + } + public Iterator iterator() { + return Collections.singleton(this).iterator(); + } + public static IntValuedEnum fromValue(int value) { + return FlagSet.fromValue(value, values()); + } + } + +} diff --git a/src/main/java/com/bernard/sboard/bridj/LibLilv.java b/src/main/java/com/bernard/sboard/bridj/LibLilv.java new file mode 100644 index 0000000..ae6dd84 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LibLilv.java @@ -0,0 +1,2137 @@ +package com.bernard.sboard.bridj; +import java.util.ArrayList; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; + +import org.bridj.BridJ; +import org.bridj.CRuntime; +import org.bridj.Callback; +import org.bridj.Pointer; +import org.bridj.Pointer.Releaser; +import org.bridj.StructObject; +import org.bridj.ann.Library; +import org.bridj.ann.Name; +import org.bridj.ann.Ptr; +import org.bridj.ann.Runtime; +/** + * Wrapper for library lilv
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java or BridJ . + */ +@Library("lilv-0") +@Runtime(CRuntime.class) +public class LibLilv { + static { + BridJ.register(); + } + + public static final Releaser noReleaser = new Pointer.Releaser() { + + @Override + public void release(Pointer p) { + // Doing nothing + } + }; + + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_FOAF = (String)"http://xmlns.com/foaf/0.1/"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_RDFS = (String)"http://www.w3.org/2000/01/rdf-schema#"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_RDF = (String)"http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_OPTION_DYN_MANIFEST = (String)"http://drobilla.net/ns/lilv#dyn-manifest"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_XSD = (String)"http://www.w3.org/2001/XMLSchema#"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_ATOM_PORT = (String)"http://lv2plug.in/ns/ext/atom#AtomPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_EVENT_PORT = (String)"http://lv2plug.in/ns/ext/event#EventPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_LILV = (String)"http://drobilla.net/ns/lilv#"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_INPUT_PORT = (String)"http://lv2plug.in/ns/lv2core#InputPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_MIDI_EVENT = (String)"http://lv2plug.in/ns/ext/midi#MidiEvent"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_OPTION_FILTER_LANG = (String)"http://drobilla.net/ns/lilv#filter-lang"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_PORT = (String)"http://lv2plug.in/ns/lv2core#Port"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_OPTION_LV2_PATH = (String)"http://drobilla.net/ns/lilv#lv2-path"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_CONTROL_PORT = (String)"http://lv2plug.in/ns/lv2core#ControlPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_OUTPUT_PORT = (String)"http://lv2plug.in/ns/lv2core#OutputPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_OWL = (String)"http://www.w3.org/2002/07/owl#"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_AUDIO_PORT = (String)"http://lv2plug.in/ns/lv2core#AudioPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_DOAP = (String)"http://usefulinc.com/ns/doap#"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_URI_CV_PORT = (String)"http://lv2plug.in/ns/lv2core#CVPort"; + /// native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + public static final String LILV_NS_LV2 = (String)"http://lv2plug.in/ns/lv2core#"; + /** + * Function to get a port value.
+ * @param port_symbol The symbol of the port.
+ * @param user_data The user_data passed to lilv_state_new_from_instance().
+ * @param size (Output) The size of the returned value.
+ * @param type (Output) The URID of the type of the returned value.
+ * @return A pointer to the port value.
+ * This function MUST set `size` and `type` appropriately.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1274 + */ + /** + * Function to get a port value.
+ * @param port_symbol The symbol of the port.
+ * @param user_data The user_data passed to lilv_state_new_from_instance().
+ * @param size (Output) The size of the returned value.
+ * @param type (Output) The URID of the type of the returned value.
+ * @return A pointer to the port value.
+ * This function MUST set `size` and `type` appropriately.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1274 + */ + public static abstract class LilvGetPortValueFunc extends Callback { + abstract public Pointer apply(Pointer port_symbol, Pointer user_data, Pointer size, Pointer type); + }; + /** + * Function to set a port value.
+ * @param port_symbol The symbol of the port.
+ * @param user_data The user_data passed to lilv_state_restore().
+ * @param size The size of `value`.
+ * @param type The URID of the type of `value`.
+ * @param value A pointer to the port value.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + */ + /** + * Function to set a port value.
+ * @param port_symbol The symbol of the port.
+ * @param user_data The user_data passed to lilv_state_restore().
+ * @param size The size of `value`.
+ * @param type The URID of the type of `value`.
+ * @param value A pointer to the port value.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + */ + public static abstract class LilvSetPortValueFunc extends Callback { + abstract public void apply(Pointer port_symbol, Pointer user_data, Pointer value, int size, int type); + }; + /** + * Function to determine whether a UI type is supported.
+ * This is provided by the user and must return non-zero iff using a UI of type
+ * `ui_type_uri` in a container of type `container_type_uri` is supported.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + */ + /** + * Function to determine whether a UI type is supported.
+ * This is provided by the user and must return non-zero iff using a UI of type
+ * `ui_type_uri` in a container of type `container_type_uri` is supported.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h + */ + public static abstract class LilvUISupportedFunc extends Callback { + abstract public int apply(Pointer container_type_uri, Pointer ui_type_uri); + }; + /** + * Free memory allocated by Lilv.
+ * This function exists because some systems require memory allocated by a
+ * library to be freed by code in the same library. It is otherwise equivalent
+ * to the standard C free() function.
+ * Original signature : void lilv_free(void*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:111 + */ + public static void lilv_free(Pointer ptr) { + lilv_free(Pointer.getPeer(ptr)); + } + protected native static void lilv_free(@Ptr long ptr); + /** + * Convert a file URI string to a local path string.
+ * For example, "file://foo/bar/baz.ttl" returns "/foo/bar/baz.ttl".
+ * Return value is shared and must not be deleted by caller.
+ * This function does not handle escaping correctly and should not be used for
+ * general file URIs. Use lilv_file_uri_parse() instead.
+ * @return `uri` converted to a path, or NULL on failure (URI is not local).
+ * Original signature : char* lilv_uri_to_path(const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:127 + */ + public static Pointer lilv_uri_to_path(Pointer uri) { + return Pointer.pointerToAddress(lilv_uri_to_path(Pointer.getPeer(uri)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_uri_to_path(@Ptr long uri); + /** + * Convert a file URI string to a local path string.
+ * For example, "file://foo/bar%20one/baz.ttl" returns "/foo/bar one/baz.ttl".
+ * Return value must be freed by caller with lilv_free().
+ * @param uri The file URI to parse.
+ * @param hostname If non-NULL, set to the hostname in the URI, if any.
+ * @return `uri` converted to a path, or NULL on failure (URI is not local).
+ * Original signature : char* lilv_file_uri_parse(const char*, char**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:138 + */ + public static Pointer lilv_file_uri_parse(Pointer uri, Pointer > hostname) { + return Pointer.pointerToAddress(lilv_file_uri_parse(Pointer.getPeer(uri), Pointer.getPeer(hostname)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_file_uri_parse(@Ptr long uri, @Ptr long hostname); + /** + * Create a new URI value.
+ * Returned value must be freed by caller with lilv_node_free().
+ * Original signature : LilvNode* lilv_new_uri(LilvWorld*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:145 + */ + public static Pointer lilv_new_uri(Pointer world, Pointer uri) { + return Pointer.pointerToAddress(lilv_new_uri(Pointer.getPeer(world), Pointer.getPeer(uri)), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_new_uri(@Ptr long world, @Ptr long uri); + /** + * Create a new file URI value.
+ * @param world The world.
+ * @param host Host name, or NULL.
+ * @param path Path on host.
+ * @return A new node that must be freed by caller.
+ * Relative paths are resolved against the current working directory. Note
+ * that this may yield unexpected results if `host` is another machine.
+ * Original signature : LilvNode* lilv_new_file_uri(LilvWorld*, const char*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:158 + */ + public static Pointer lilv_new_file_uri(Pointer world, Pointer host, Pointer path) { + return Pointer.pointerToAddress(lilv_new_file_uri(Pointer.getPeer(world), Pointer.getPeer(host), Pointer.getPeer(path)), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_new_file_uri(@Ptr long world, @Ptr long host, @Ptr long path); + /** + * Create a new string value (with no language).
+ * Returned value must be freed by caller with lilv_node_free().
+ * Original signature : LilvNode* lilv_new_string(LilvWorld*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:165 + */ + public static Pointer lilv_new_string(Pointer world, Pointer str) { + return Pointer.pointerToAddress(lilv_new_string(Pointer.getPeer(world), Pointer.getPeer(str)), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_new_string(@Ptr long world, @Ptr long str); + /** + * Create a new integer value.
+ * Returned value must be freed by caller with lilv_node_free().
+ * Original signature : LilvNode* lilv_new_int(LilvWorld*, int)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:172 + */ + public static Pointer lilv_new_int(Pointer world, int val) { + return Pointer.pointerToAddress(lilv_new_int(Pointer.getPeer(world), val), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_new_int(@Ptr long world, int val); + /** + * Create a new floating point value.
+ * Returned value must be freed by caller with lilv_node_free().
+ * Original signature : LilvNode* lilv_new_float(LilvWorld*, float)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:179 + */ + public static Pointer lilv_new_float(Pointer world, float val) { + return Pointer.pointerToAddress(lilv_new_float(Pointer.getPeer(world), val), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_new_float(@Ptr long world, float val); + /** + * Create a new boolean value.
+ * Returned value must be freed by caller with lilv_node_free().
+ * Original signature : LilvNode* lilv_new_bool(LilvWorld*, bool)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:186 + */ + public static Pointer lilv_new_bool(Pointer world, boolean val) { + return Pointer.pointerToAddress(lilv_new_bool(Pointer.getPeer(world), val), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_new_bool(@Ptr long world, boolean val); + /** + * Free a LilvNode.
+ * It is safe to call this function on NULL.
+ * Original signature : void lilv_node_free(LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:193 + */ + public static void lilv_node_free(Pointer val) { + lilv_node_free(Pointer.getPeer(val)); + } + protected native static void lilv_node_free(@Ptr long val); + /** + * Duplicate a LilvNode.
+ * Original signature : LilvNode* lilv_node_duplicate(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:199 + */ + public static Pointer lilv_node_duplicate(Pointer val) { + return Pointer.pointerToAddress(lilv_node_duplicate(Pointer.getPeer(val)), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_node_duplicate(@Ptr long val); + /** + * Return whether two values are equivalent.
+ * Original signature : bool lilv_node_equals(const LilvNode*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:205 + */ + public static boolean lilv_node_equals(Pointer value, Pointer other) { + return lilv_node_equals(Pointer.getPeer(value), Pointer.getPeer(other)); + } + protected native static boolean lilv_node_equals(@Ptr long value, @Ptr long other); + /** + * Return this value as a Turtle/SPARQL token.
+ * Returned value must be freed by caller with lilv_free().
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
Example Turtle Tokens
URI<http://example.org/foo >
QNamedoap:name
String"this is a string"
Float1.0
Integer1
Booleantrue

+ * Original signature : char* lilv_node_get_turtle_token(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:221 + */ + public static Pointer lilv_node_get_turtle_token(Pointer value) { + return Pointer.pointerToAddress(lilv_node_get_turtle_token(Pointer.getPeer(value)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_node_get_turtle_token(@Ptr long value); + /** + * Return whether the value is a URI (resource).
+ * Original signature : bool lilv_node_is_uri(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:227 + */ + public static boolean lilv_node_is_uri(Pointer value) { + return lilv_node_is_uri(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_uri(@Ptr long value); + /** + * Return this value as a URI string, e.g. "http://example.org/foo".
+ * Valid to call only if `lilv_node_is_uri(value)` returns true.
+ * Returned value is owned by `value` and must not be freed by caller.
+ * Original signature : char* lilv_node_as_uri(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:235 + */ + public static Pointer lilv_node_as_uri(Pointer value) { + return Pointer.pointerToAddress(lilv_node_as_uri(Pointer.getPeer(value)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_node_as_uri(@Ptr long value); + /** + * Return whether the value is a blank node (resource with no URI).
+ * Original signature : bool lilv_node_is_blank(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:241 + */ + public static boolean lilv_node_is_blank(Pointer value) { + return lilv_node_is_blank(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_blank(@Ptr long value); + /** + * Return this value as a blank node identifier, e.g. "genid03".
+ * Valid to call only if `lilv_node_is_blank(value)` returns true.
+ * Returned value is owned by `value` and must not be freed by caller.
+ * Original signature : char* lilv_node_as_blank(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:249 + */ + public static Pointer lilv_node_as_blank(Pointer value) { + return Pointer.pointerToAddress(lilv_node_as_blank(Pointer.getPeer(value)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_node_as_blank(@Ptr long value); + /** + * Return whether this value is a literal (i.e. not a URI).
+ * Returns true if `value` is a string or numeric value.
+ * Original signature : bool lilv_node_is_literal(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:256 + */ + public static boolean lilv_node_is_literal(Pointer value) { + return lilv_node_is_literal(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_literal(@Ptr long value); + /** + * Return whether this value is a string literal.
+ * Returns true if `value` is a string value (and not numeric).
+ * Original signature : bool lilv_node_is_string(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:263 + */ + public static boolean lilv_node_is_string(Pointer value) { + return lilv_node_is_string(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_string(@Ptr long value); + /** + * Return `value` as a string.
+ * Original signature : char* lilv_node_as_string(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:269 + */ + public static Pointer lilv_node_as_string(Pointer value) { + return Pointer.pointerToAddress(lilv_node_as_string(Pointer.getPeer(value)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_node_as_string(@Ptr long value); + /** + * Return the path of a file URI node.
+ * Returns NULL if `value` is not a file URI.
+ * Returned value must be freed by caller with lilv_free().
+ * Original signature : char* lilv_node_get_path(const LilvNode*, char**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:277 + */ + public static Pointer lilv_node_get_path(Pointer value, Pointer> hostname) { + return Pointer.pointerToAddress(lilv_node_get_path(Pointer.getPeer(value), Pointer.getPeer(hostname)), + Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_node_get_path(@Ptr long value, @Ptr long hostname); + /** + * Return whether this value is a decimal literal.
+ * Original signature : bool lilv_node_is_float(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:283 + */ + public static boolean lilv_node_is_float(Pointer value) { + return lilv_node_is_float(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_float(@Ptr long value); + /** + * Return `value` as a float.
+ * Valid to call only if `lilv_node_is_float(value)` or
+ * `lilv_node_is_int(value)` returns true.
+ * Original signature : float lilv_node_as_float(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:291 + */ + public static float lilv_node_as_float(Pointer value) { + return lilv_node_as_float(Pointer.getPeer(value)); + } + protected native static float lilv_node_as_float(@Ptr long value); + /** + * Return whether this value is an integer literal.
+ * Original signature : bool lilv_node_is_int(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:297 + */ + public static boolean lilv_node_is_int(Pointer value) { + return lilv_node_is_int(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_int(@Ptr long value); + /** + * Return `value` as an integer.
+ * Valid to call only if `lilv_node_is_int(value)` returns true.
+ * Original signature : int lilv_node_as_int(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:304 + */ + public static int lilv_node_as_int(Pointer value) { + return lilv_node_as_int(Pointer.getPeer(value)); + } + protected native static int lilv_node_as_int(@Ptr long value); + /** + * Return whether this value is a boolean.
+ * Original signature : bool lilv_node_is_bool(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:310 + */ + public static boolean lilv_node_is_bool(Pointer value) { + return lilv_node_is_bool(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_is_bool(@Ptr long value); + /** + * Return `value` as a bool.
+ * Valid to call only if `lilv_node_is_bool(value)` returns true.
+ * Original signature : bool lilv_node_as_bool(const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:317 + */ + public static boolean lilv_node_as_bool(Pointer value) { + return lilv_node_as_bool(Pointer.getPeer(value)); + } + protected native static boolean lilv_node_as_bool(@Ptr long value); + /** + * Original signature : void lilv_plugin_classes_free(LilvPluginClasses*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:360 + */ + public static void lilv_plugin_classes_free(Pointer collection) { + lilv_plugin_classes_free(Pointer.getPeer(collection)); + } + protected native static void lilv_plugin_classes_free(@Ptr long collection); + /** + * Original signature : int lilv_plugin_classes_size(const LilvPluginClasses*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:363 + */ + public static int lilv_plugin_classes_size(Pointer collection) { + return lilv_plugin_classes_size(Pointer.getPeer(collection)); + } + protected native static int lilv_plugin_classes_size(@Ptr long collection); + /** + * Original signature : LilvIter* lilv_plugin_classes_begin(const LilvPluginClasses*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:366 + */ + public static Pointer lilv_plugin_classes_begin(Pointer collection) { + return Pointer.pointerToAddress(lilv_plugin_classes_begin(Pointer.getPeer(collection)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_classes_begin(@Ptr long collection); + /** + * Original signature : LilvPluginClass* lilv_plugin_classes_get(const LilvPluginClasses*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:369 + */ + public static Pointer lilv_plugin_classes_get(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_plugin_classes_get(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvPluginClass.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_classes_get(@Ptr long collection, @Ptr long i); + /** + * Original signature : LilvIter* lilv_plugin_classes_next(const LilvPluginClasses*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:372 + */ + public static Pointer lilv_plugin_classes_next(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_plugin_classes_next(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_classes_next(@Ptr long collection, @Ptr long i); + /** + * Original signature : bool lilv_plugin_classes_is_end(const LilvPluginClasses*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:375 + */ + public static boolean lilv_plugin_classes_is_end(Pointer collection, Pointer i) { + return lilv_plugin_classes_is_end(Pointer.getPeer(collection), Pointer.getPeer(i)); + } + protected native static boolean lilv_plugin_classes_is_end(@Ptr long collection, @Ptr long i); + /** + * Get a plugin class from `classes` by URI.
+ * Return value is shared (stored in `classes`) and must not be freed or
+ * modified by the caller in any way.
+ * @return NULL if no plugin class with `uri` is found in `classes`.
+ * Original signature : LilvPluginClass* lilv_plugin_classes_get_by_uri(const LilvPluginClasses*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:384 + */ + public static Pointer lilv_plugin_classes_get_by_uri(Pointer classes, Pointer uri) { + return Pointer.pointerToAddress(lilv_plugin_classes_get_by_uri(Pointer.getPeer(classes), Pointer.getPeer(uri)), LilvPluginClass.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_classes_get_by_uri(@Ptr long classes, @Ptr long uri); + /** + * Original signature : void lilv_scale_points_free(LilvScalePoints*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:390 + */ + public static void lilv_scale_points_free(Pointer collection) { + lilv_scale_points_free(Pointer.getPeer(collection)); + } + protected native static void lilv_scale_points_free(@Ptr long collection); + /** + * Original signature : int lilv_scale_points_size(const LilvScalePoints*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:393 + */ + public static int lilv_scale_points_size(Pointer collection) { + return lilv_scale_points_size(Pointer.getPeer(collection)); + } + protected native static int lilv_scale_points_size(@Ptr long collection); + /** + * Original signature : LilvIter* lilv_scale_points_begin(const LilvScalePoints*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:396 + */ + public static Pointer lilv_scale_points_begin(Pointer collection) { + return Pointer.pointerToAddress(lilv_scale_points_begin(Pointer.getPeer(collection)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_scale_points_begin(@Ptr long collection); + /** + * Original signature : LilvScalePoint* lilv_scale_points_get(const LilvScalePoints*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:399 + */ + public static Pointer lilv_scale_points_get(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_scale_points_get(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvScalePoint.class, noReleaser); + } + @Ptr + protected native static long lilv_scale_points_get(@Ptr long collection, @Ptr long i); + /** + * Original signature : LilvIter* lilv_scale_points_next(const LilvScalePoints*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:402 + */ + public static Pointer lilv_scale_points_next(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_scale_points_next(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_scale_points_next(@Ptr long collection, @Ptr long i); + /** + * Original signature : bool lilv_scale_points_is_end(const LilvScalePoints*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:405 + */ + public static boolean lilv_scale_points_is_end(Pointer collection, Pointer i) { + return lilv_scale_points_is_end(Pointer.getPeer(collection), Pointer.getPeer(i)); + } + protected native static boolean lilv_scale_points_is_end(@Ptr long collection, @Ptr long i); + /** + * Original signature : void lilv_uis_free(LilvUIs*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:410 + */ + public static void lilv_uis_free(Pointer collection) { + lilv_uis_free(Pointer.getPeer(collection)); + } + protected native static void lilv_uis_free(@Ptr long collection); + /** + * Original signature : int lilv_uis_size(const LilvUIs*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:413 + */ + public static int lilv_uis_size(Pointer collection) { + return lilv_uis_size(Pointer.getPeer(collection)); + } + protected native static int lilv_uis_size(@Ptr long collection); + /** + * Original signature : LilvIter* lilv_uis_begin(const LilvUIs*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:416 + */ + public static Pointer lilv_uis_begin(Pointer collection) { + return Pointer.pointerToAddress(lilv_uis_begin(Pointer.getPeer(collection)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_uis_begin(@Ptr long collection); + /** + * Original signature : LilvUI* lilv_uis_get(const LilvUIs*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:419 + */ + public static Pointer lilv_uis_get(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_uis_get(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvUI.class, noReleaser); + } + @Ptr + protected native static long lilv_uis_get(@Ptr long collection, @Ptr long i); + /** + * Original signature : LilvIter* lilv_uis_next(const LilvUIs*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:422 + */ + public static Pointer lilv_uis_next(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_uis_next(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_uis_next(@Ptr long collection, @Ptr long i); + /** + * Original signature : bool lilv_uis_is_end(const LilvUIs*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:425 + */ + public static boolean lilv_uis_is_end(Pointer collection, Pointer i) { + return lilv_uis_is_end(Pointer.getPeer(collection), Pointer.getPeer(i)); + } + protected native static boolean lilv_uis_is_end(@Ptr long collection, @Ptr long i); + /** + * Get a UI from `uis` by URI.
+ * Return value is shared (stored in `uis`) and must not be freed or
+ * modified by the caller in any way.
+ * @return NULL if no UI with `uri` is found in `list`.
+ * Original signature : LilvUI* lilv_uis_get_by_uri(const LilvUIs*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:434 + */ + public static Pointer lilv_uis_get_by_uri(Pointer uis, Pointer uri) { + return Pointer.pointerToAddress(lilv_uis_get_by_uri(Pointer.getPeer(uis), Pointer.getPeer(uri)), LilvUI.class, noReleaser); + } + @Ptr + protected native static long lilv_uis_get_by_uri(@Ptr long uis, @Ptr long uri); + /** + * Original signature : void lilv_nodes_free(LilvNodes*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:440 + */ + public static void lilv_nodes_free(Pointer collection) { + lilv_nodes_free(Pointer.getPeer(collection)); + } + protected native static void lilv_nodes_free(@Ptr long collection); + /** + * Original signature : int lilv_nodes_size(const LilvNodes*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:443 + */ + public static int lilv_nodes_size(Pointer collection) { + return lilv_nodes_size(Pointer.getPeer(collection)); + } + protected native static int lilv_nodes_size(@Ptr long collection); + /** + * Original signature : LilvIter* lilv_nodes_begin(const LilvNodes*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:446 + */ + public static Pointer lilv_nodes_begin(Pointer collection) { + return Pointer.pointerToAddress(lilv_nodes_begin(Pointer.getPeer(collection)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_nodes_begin(@Ptr long collection); + /** + * Original signature : LilvNode* lilv_nodes_get(const LilvNodes*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:449 + */ + public static Pointer lilv_nodes_get(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_nodes_get(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_nodes_get(@Ptr long collection, @Ptr long i); + /** + * Original signature : LilvIter* lilv_nodes_next(const LilvNodes*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:452 + */ + public static Pointer lilv_nodes_next(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_nodes_next(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_nodes_next(@Ptr long collection, @Ptr long i); + /** + * Original signature : bool lilv_nodes_is_end(const LilvNodes*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:455 + */ + public static boolean lilv_nodes_is_end(Pointer collection, Pointer i) { + return lilv_nodes_is_end(Pointer.getPeer(collection), Pointer.getPeer(i)); + } + protected native static boolean lilv_nodes_is_end(@Ptr long collection, @Ptr long i); + /** + * Original signature : LilvNode* lilv_nodes_get_first(const LilvNodes*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:458 + */ + public static Pointer lilv_nodes_get_first(Pointer collection) { + return Pointer.pointerToAddress(lilv_nodes_get_first(Pointer.getPeer(collection)), LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_nodes_get_first(@Ptr long collection); + /** + * Return whether `values` contains `value`.
+ * Original signature : bool lilv_nodes_contains(const LilvNodes*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:464 + */ + public static boolean lilv_nodes_contains(Pointer nodes, Pointer value) { + return lilv_nodes_contains(Pointer.getPeer(nodes), Pointer.getPeer(value)); + } + protected native static boolean lilv_nodes_contains(@Ptr long nodes, @Ptr long value); + /** + * Return a new LilvNodes that contains all nodes from both `a` and `b`.
+ * Original signature : LilvNodes* lilv_nodes_merge(const LilvNodes*, const LilvNodes*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:470 + */ + public static Pointer lilv_nodes_merge(Pointer a, Pointer b) { + return Pointer.pointerToAddress(lilv_nodes_merge(Pointer.getPeer(a), Pointer.getPeer(b)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_nodes_merge(@Ptr long a, @Ptr long b); + /** + * Original signature : int lilv_plugins_size(const LilvPlugins*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:475 + */ + public static int lilv_plugins_size(Pointer collection) { + return lilv_plugins_size(Pointer.getPeer(collection)); + } + protected native static int lilv_plugins_size(@Ptr long collection); + /** + * Original signature : LilvIter* lilv_plugins_begin(const LilvPlugins*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:478 + */ + public static Pointer lilv_plugins_begin(Pointer collection) { + return Pointer.pointerToAddress(lilv_plugins_begin(Pointer.getPeer(collection)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_plugins_begin(@Ptr long collection); + /** + * Original signature : LilvPlugin* lilv_plugins_get(const LilvPlugins*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:481 + */ + public static Pointer lilv_plugins_get(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_plugins_get(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvPlugin.class, noReleaser); + } + @Ptr + protected native static long lilv_plugins_get(@Ptr long collection, @Ptr long i); + /** + * Original signature : LilvIter* lilv_plugins_next(const LilvPlugins*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:484 + */ + public static Pointer lilv_plugins_next(Pointer collection, Pointer i) { + return Pointer.pointerToAddress(lilv_plugins_next(Pointer.getPeer(collection), Pointer.getPeer(i)), LilvIter.class, noReleaser); + } + @Ptr + protected native static long lilv_plugins_next(@Ptr long collection, @Ptr long i); + /** + * Original signature : bool lilv_plugins_is_end(const LilvPlugins*, LilvIter*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:487 + */ + public static boolean lilv_plugins_is_end(Pointer collection, Pointer i) { + return lilv_plugins_is_end(Pointer.getPeer(collection), Pointer.getPeer(i)); + } + protected native static boolean lilv_plugins_is_end(@Ptr long collection, @Ptr long i); + /** + * Get a plugin from `plugins` by URI.
+ * Return value is shared (stored in `plugins`) and must not be freed or
+ * modified by the caller in any way.
+ * @return NULL if no plugin with `uri` is found in `plugins`.
+ * Original signature : LilvPlugin* lilv_plugins_get_by_uri(const LilvPlugins*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:496 + */ + public static Pointer lilv_plugins_get_by_uri(Pointer plugins, Pointer uri) { + return Pointer.pointerToAddress(lilv_plugins_get_by_uri(Pointer.getPeer(plugins), Pointer.getPeer(uri)), LilvPlugin.class, noReleaser); + } + @Ptr + protected native static long lilv_plugins_get_by_uri(@Ptr long plugins, @Ptr long uri); + /** + * Initialize a new, empty world.
+ * If initialization fails, NULL is returned.
+ * Original signature : LilvWorld* lilv_world_new()
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:514 + */ + public static Pointer lilv_world_new() { + return Pointer.pointerToAddress(lilv_world_new$2(), LilvWorld.class, noReleaser); + } + @Ptr + @Name("lilv_world_new") + protected native static long lilv_world_new$2(); + /** + * Set an option option for `world`.
+ * Currently recognized options:
+ * @ref LILV_OPTION_FILTER_LANG
+ * @ref LILV_OPTION_DYN_MANIFEST
+ * @ref LILV_OPTION_LV2_PATH
+ * Original signature : void lilv_world_set_option(LilvWorld*, const char*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:547 + */ + public static void lilv_world_set_option(Pointer world, Pointer uri, Pointer value) { + lilv_world_set_option(Pointer.getPeer(world), Pointer.getPeer(uri), Pointer.getPeer(value)); + } + protected native static void lilv_world_set_option(@Ptr long world, @Ptr long uri, @Ptr long value); + /** + * Destroy the world, mwahaha.
+ * It is safe to call this function on NULL.
+ * Note that destroying `world` will destroy all the objects it contains
+ * (e.g. instances of LilvPlugin). Do not destroy the world until you are
+ * finished with all objects that came from it.
+ * Original signature : void lilv_world_free(LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:559 + */ + public static void lilv_world_free(Pointer world) { + lilv_world_free(Pointer.getPeer(world)); + } + protected native static void lilv_world_free(@Ptr long world); + /** + * Load all installed LV2 bundles on the system.
+ * This is the recommended way for hosts to load LV2 data. It implements the
+ * established/standard best practice for discovering all LV2 data on the
+ * system. The environment variable LV2_PATH may be used to control where
+ * this function will look for bundles.
+ * Hosts should use this function rather than explicitly load bundles, except
+ * in special circumstances (e.g. development utilities, or hosts that ship
+ * with special plugin bundles which are installed to a known location).
+ * Original signature : void lilv_world_load_all(LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:573 + */ + public static void lilv_world_load_all(Pointer world) { + lilv_world_load_all(Pointer.getPeer(world)); + } + protected native static void lilv_world_load_all(@Ptr long world); + /** + * Load a specific bundle.
+ * `bundle_uri` must be a fully qualified URI to the bundle directory,
+ * with the trailing slash, eg. file:///usr/lib/lv2/foo.lv2/
+ * Normal hosts should not need this function (use lilv_world_load_all()).
+ * Hosts MUST NOT attach any long-term significance to bundle paths
+ * (e.g. in save files), since there are no guarantees they will remain
+ * unchanged between (or even during) program invocations. Plugins (among
+ * other things) MUST be identified by URIs (not paths) in save files.
+ * Original signature : void lilv_world_load_bundle(LilvWorld*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:588 + */ + public static void lilv_world_load_bundle(Pointer world, Pointer bundle_uri) { + lilv_world_load_bundle(Pointer.getPeer(world), Pointer.getPeer(bundle_uri)); + } + protected native static void lilv_world_load_bundle(@Ptr long world, @Ptr long bundle_uri); + /** + * Load all specifications from currently loaded bundles.
+ * This is for hosts that explicitly load specific bundles, its use is not
+ * necessary when using lilv_world_load_all(). This function parses the
+ * specifications and adds them to the model.
+ * Original signature : void lilv_world_load_specifications(LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:599 + */ + public static void lilv_world_load_specifications(Pointer world) { + lilv_world_load_specifications(Pointer.getPeer(world)); + } + protected native static void lilv_world_load_specifications(@Ptr long world); + /** + * Load all plugin classes from currently loaded specifications.
+ * Must be called after lilv_world_load_specifications(). This is for hosts
+ * that explicitly load specific bundles, its use is not necessary when using
+ * lilv_world_load_all().
+ * Original signature : void lilv_world_load_plugin_classes(LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:609 + */ + public static void lilv_world_load_plugin_classes(Pointer world) { + lilv_world_load_plugin_classes(Pointer.getPeer(world)); + } + protected native static void lilv_world_load_plugin_classes(@Ptr long world); + /** + * Unload a specific bundle.
+ * This unloads statements loaded by lilv_world_load_bundle(). Note that this
+ * is not necessarily all information loaded from the bundle. If any resources
+ * have been separately loaded with lilv_world_load_resource(), they must be
+ * separately unloaded with lilv_world_unload_resource().
+ * Original signature : int lilv_world_unload_bundle(LilvWorld*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:620 + */ + public static int lilv_world_unload_bundle(Pointer world, Pointer bundle_uri) { + return lilv_world_unload_bundle(Pointer.getPeer(world), Pointer.getPeer(bundle_uri)); + } + protected native static int lilv_world_unload_bundle(@Ptr long world, @Ptr long bundle_uri); + /** + * Load all the data associated with the given `resource`.
+ * @param world The world.
+ * @param resource Must be a subject (i.e. a URI or a blank node).
+ * @return The number of files parsed, or -1 on error
+ * All accessible data files linked to `resource` with rdfs:seeAlso will be
+ * loaded into the world model.
+ * Original signature : int lilv_world_load_resource(LilvWorld*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:632 + */ + public static int lilv_world_load_resource(Pointer world, Pointer resource) { + return lilv_world_load_resource(Pointer.getPeer(world), Pointer.getPeer(resource)); + } + protected native static int lilv_world_load_resource(@Ptr long world, @Ptr long resource); + /** + * Unload all the data associated with the given `resource`.
+ * @param world The world.
+ * @param resource Must be a subject (i.e. a URI or a blank node).
+ * This unloads all data loaded by a previous call to
+ * lilv_world_load_resource() with the given `resource`.
+ * Original signature : int lilv_world_unload_resource(LilvWorld*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:644 + */ + public static int lilv_world_unload_resource(Pointer world, Pointer resource) { + return lilv_world_unload_resource(Pointer.getPeer(world), Pointer.getPeer(resource)); + } + protected native static int lilv_world_unload_resource(@Ptr long world, @Ptr long resource); + /** + * Get the parent of all other plugin classes, lv2:Plugin.
+ * Original signature : LilvPluginClass* lilv_world_get_plugin_class(const LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:651 + */ + public static Pointer lilv_world_get_plugin_class(Pointer world) { + return Pointer.pointerToAddress(lilv_world_get_plugin_class(Pointer.getPeer(world)), LibLilv.LilvPluginClass.class, noReleaser); + } + @Ptr + protected native static long lilv_world_get_plugin_class(@Ptr long world); + /** + * Return a list of all found plugin classes.
+ * Returned list is owned by world and must not be freed by the caller.
+ * Original signature : LilvPluginClasses* lilv_world_get_plugin_classes(const LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:658 + */ + public static Pointer lilv_world_get_plugin_classes(Pointer world) { + return Pointer.pointerToAddress(lilv_world_get_plugin_classes(Pointer.getPeer(world)), LilvPluginClasses.class, noReleaser); + } + @Ptr + protected native static long lilv_world_get_plugin_classes(@Ptr long world); + /** + * Return a list of all found plugins.
+ * The returned list contains just enough references to query
+ * or instantiate plugins. The data for a particular plugin will not be
+ * loaded into memory until a call to an lilv_plugin_* function results in
+ * a query (at which time the data is cached with the LilvPlugin so future
+ * queries are very fast).
+ * The returned list and the plugins it contains are owned by `world`
+ * and must not be freed by caller.
+ * Original signature : LilvPlugins* lilv_world_get_all_plugins(const LilvWorld*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:672 + */ + public static Pointer lilv_world_get_all_plugins(Pointer world) { + return Pointer.pointerToAddress(lilv_world_get_all_plugins(Pointer.getPeer(world)), LilvPlugins.class, noReleaser); + } + @Ptr + protected native static long lilv_world_get_all_plugins(@Ptr long world); + /** + * Find nodes matching a triple pattern.
+ * Either `subject` or `object` may be NULL (i.e. a wildcard), but not both.
+ * @return All matches for the wildcard field, or NULL.
+ * Original signature : LilvNodes* lilv_world_find_nodes(LilvWorld*, const LilvNode*, const LilvNode*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:680 + */ + public static Pointer lilv_world_find_nodes(Pointer world, Pointer subject, Pointer predicate, Pointer object) { + return Pointer.pointerToAddress(lilv_world_find_nodes(Pointer.getPeer(world), Pointer.getPeer(subject), Pointer.getPeer(predicate), Pointer.getPeer(object)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_world_find_nodes(@Ptr long world, @Ptr long subject, @Ptr long predicate, @Ptr long object); + /** + * Find a single node that matches a pattern.
+ * Exactly one of `subject`, `predicate`, `object` must be NULL.
+ * This function is equivalent to
+ * lilv_nodes_get_first(lilv_world_find_nodes(...)) but simplifies the common
+ * case of only wanting a single value.
+ * @return the first matching node, or NULL if no matches are found.
+ * Original signature : LilvNode* lilv_world_get(LilvWorld*, const LilvNode*, const LilvNode*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:694 + */ + public static Pointer lilv_world_get(Pointer world, Pointer subject, Pointer predicate, Pointer object) { + return Pointer.pointerToAddress(lilv_world_get(Pointer.getPeer(world), Pointer.getPeer(subject), Pointer.getPeer(predicate), Pointer.getPeer(object)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_world_get(@Ptr long world, @Ptr long subject, @Ptr long predicate, @Ptr long object); + /** + * Return true iff a statement matching a certain pattern exists.
+ * This is useful for checking if particular statement exists without having to
+ * bother with collections and memory management.
+ * @param world The world.
+ * @param subject Subject of statement, or NULL for anything.
+ * @param predicate Predicate (key) of statement, or NULL for anything.
+ * @param object Object (value) of statement, or NULL for anything.
+ * Original signature : bool lilv_world_ask(LilvWorld*, const LilvNode*, const LilvNode*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:711 + */ + public static boolean lilv_world_ask(Pointer world, Pointer subject, Pointer predicate, Pointer object) { + return lilv_world_ask(Pointer.getPeer(world), Pointer.getPeer(subject), Pointer.getPeer(predicate), Pointer.getPeer(object)); + } + protected native static boolean lilv_world_ask(@Ptr long world, @Ptr long subject, @Ptr long predicate, @Ptr long object); + /** + * Get an LV2 symbol for some subject.
+ * This will return the lv2:symbol property of the subject if it is given
+ * explicitly, and otherwise will attempt to derive a symbol from the URI.
+ * @return A string node that is a valid LV2 symbol, or NULL on error.
+ * Original signature : LilvNode* lilv_world_get_symbol(LilvWorld*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:724 + */ + public static Pointer lilv_world_get_symbol(Pointer world, Pointer subject) { + return Pointer.pointerToAddress(lilv_world_get_symbol(Pointer.getPeer(world), Pointer.getPeer(subject)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_world_get_symbol(@Ptr long world, @Ptr long subject); + /** + * Check if `plugin` is valid.
+ * This is not a rigorous validator, but can be used to reject some malformed
+ * plugins that could cause bugs (e.g. plugins with missing required fields).
+ * Note that normal hosts do NOT need to use this - lilv does not
+ * load invalid plugins into plugin lists. This is included for plugin
+ * testing utilities, etc.
+ * @return true iff `plugin` is valid.
+ * Original signature : bool lilv_plugin_verify(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:743 + */ + public static boolean lilv_plugin_verify(Pointer plugin) { + return lilv_plugin_verify(Pointer.getPeer(plugin)); + } + protected native static boolean lilv_plugin_verify(@Ptr long plugin); + /** + * Get the URI of `plugin`.
+ * Any serialization that refers to plugins should refer to them by this.
+ * Hosts SHOULD NOT save any filesystem paths, plugin indexes, etc. in saved
+ * files; save only the URI.
+ * The URI is a globally unique identifier for one specific plugin. Two
+ * plugins with the same URI are compatible in port signature, and should
+ * be guaranteed to work in a compatible and consistent way. If a plugin
+ * is upgraded in an incompatible way (eg if it has different ports), it
+ * MUST have a different URI than it's predecessor.
+ * @return A shared URI value which must not be modified or freed.
+ * Original signature : LilvNode* lilv_plugin_get_uri(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:760 + */ + public static Pointer lilv_plugin_get_uri(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_uri(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_uri(@Ptr long plugin); + /** + * Get the (resolvable) URI of the plugin's "main" bundle.
+ * This returns the URI of the bundle where the plugin itself was found. Note
+ * that the data for a plugin may be spread over many bundles, that is,
+ * lilv_plugin_get_data_uris() may return URIs which are not within this
+ * bundle.
+ * Typical hosts should not need to use this function.
+ * Note this always returns a fully qualified URI. If you want a local
+ * filesystem path, use lilv_file_uri_parse().
+ * @return a shared string which must not be modified or freed.
+ * Original signature : LilvNode* lilv_plugin_get_bundle_uri(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:775 + */ + public static Pointer lilv_plugin_get_bundle_uri(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_bundle_uri(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_bundle_uri(@Ptr long plugin); + /** + * Get the (resolvable) URIs of the RDF data files that define a plugin.
+ * Typical hosts should not need to use this function.
+ * Note this always returns fully qualified URIs. If you want local
+ * filesystem paths, use lilv_file_uri_parse().
+ * @return a list of complete URLs eg. "file:///foo/ABundle.lv2/aplug.ttl",
+ * which is shared and must not be modified or freed.
+ * Original signature : LilvNodes* lilv_plugin_get_data_uris(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:786 + */ + public static Pointer lilv_plugin_get_data_uris(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_data_uris(Pointer.getPeer(plugin)),LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_data_uris(@Ptr long plugin); + /** + * Get the (resolvable) URI of the shared library for `plugin`.
+ * Note this always returns a fully qualified URI. If you want a local
+ * filesystem path, use lilv_file_uri_parse().
+ * @return a shared string which must not be modified or freed.
+ * Original signature : LilvNode* lilv_plugin_get_library_uri(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:795 + */ + public static Pointer lilv_plugin_get_library_uri(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_library_uri(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_library_uri(@Ptr long plugin); + /** + * Get the name of `plugin`.
+ * This returns the name (doap:name) of the plugin. The name may be
+ * translated according to the current locale, this value MUST NOT be used
+ * as a plugin identifier (use the URI for that).
+ * Returned value must be freed by the caller.
+ * Original signature : LilvNode* lilv_plugin_get_name(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:805 + */ + public static Pointer lilv_plugin_get_name(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_name(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_name(@Ptr long plugin); + /** + * Get the class this plugin belongs to (e.g. Filters).
+ * Original signature : LilvPluginClass* lilv_plugin_get_class(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:811 + */ + public static Pointer lilv_plugin_get_class(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_class(Pointer.getPeer(plugin)), LibLilv.LilvPluginClass.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_class(@Ptr long plugin); + /** + * Get a value associated with the plugin in a plugin's data files.
+ * `predicate` must be either a URI or a QName.
+ * Returns the ?object of all triples found of the form:
+ * <plugin-uri> predicate ?object
+ * May return NULL if the property was not found, or if object(s) is not
+ * sensibly represented as a LilvNodes (e.g. blank nodes).
+ * Return value must be freed by caller with lilv_nodes_free().
+ * Original signature : LilvNodes* lilv_plugin_get_value(const LilvPlugin*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:826 + */ + public static Pointer lilv_plugin_get_value(Pointer plugin, Pointer predicate) { + return Pointer.pointerToAddress(lilv_plugin_get_value(Pointer.getPeer(plugin), Pointer.getPeer(predicate)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_value(@Ptr long plugin, @Ptr long predicate); + /** + * Return whether a feature is supported by a plugin.
+ * This will return true if the feature is an optional or required feature
+ * of the plugin.
+ * Original signature : bool lilv_plugin_has_feature(const LilvPlugin*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:835 + */ + public static boolean lilv_plugin_has_feature(Pointer plugin, Pointer feature) { + return lilv_plugin_has_feature(Pointer.getPeer(plugin), Pointer.getPeer(feature)); + } + protected native static boolean lilv_plugin_has_feature(@Ptr long plugin, @Ptr long feature); + /** + * Get the LV2 Features supported (required or optionally) by a plugin.
+ * A feature is "supported" by a plugin if it is required OR optional.
+ * Since required features have special rules the host must obey, this function
+ * probably shouldn't be used by normal hosts. Using lilv_plugin_get_optional_features()
+ * and lilv_plugin_get_required_features() separately is best in most cases.
+ * Returned value must be freed by caller with lilv_nodes_free().
+ * Original signature : LilvNodes* lilv_plugin_get_supported_features(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:849 + */ + public static Pointer lilv_plugin_get_supported_features(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_supported_features(Pointer.getPeer(plugin)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_supported_features(@Ptr long plugin); + /** + * Get the LV2 Features required by a plugin.
+ * If a feature is required by a plugin, hosts MUST NOT use the plugin if they do not
+ * understand (or are unable to support) that feature.
+ * All values returned here MUST be passed to the plugin's instantiate method
+ * (along with data, if necessary, as defined by the feature specification)
+ * or plugin instantiation will fail.
+ * Return value must be freed by caller with lilv_nodes_free().
+ * Original signature : LilvNodes* lilv_plugin_get_required_features(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:863 + */ + public static Pointer lilv_plugin_get_required_features(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_required_features(Pointer.getPeer(plugin)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_required_features(@Ptr long plugin); + /** + * Get the LV2 Features optionally supported by a plugin.
+ * Hosts MAY ignore optional plugin features for whatever reasons. Plugins
+ * MUST operate (at least somewhat) if they are instantiated without being
+ * passed optional features.
+ * Return value must be freed by caller with lilv_nodes_free().
+ * Original signature : LilvNodes* lilv_plugin_get_optional_features(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:874 + */ + public static Pointer lilv_plugin_get_optional_features(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_optional_features(Pointer.getPeer(plugin)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_optional_features(@Ptr long plugin); + /** + * Return whether or not a plugin provides a specific extension data.
+ * Original signature : bool lilv_plugin_has_extension_data(const LilvPlugin*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:880 + */ + public static boolean lilv_plugin_has_extension_data(Pointer plugin, Pointer uri) { + return lilv_plugin_has_extension_data(Pointer.getPeer(plugin), Pointer.getPeer(uri)); + } + protected native static boolean lilv_plugin_has_extension_data(@Ptr long plugin, @Ptr long uri); + /** + * Get a sequence of all extension data provided by a plugin.
+ * This can be used to find which URIs lilv_instance_get_extension_data()
+ * will return a value for without instantiating the plugin.
+ * Original signature : LilvNodes* lilv_plugin_get_extension_data(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:889 + */ + public static Pointer lilv_plugin_get_extension_data(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_extension_data(Pointer.getPeer(plugin)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_extension_data(@Ptr long plugin); + /** + * Get the number of ports on this plugin.
+ * Original signature : uint32_t lilv_plugin_get_num_ports(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:895 + */ + public static int lilv_plugin_get_num_ports(Pointer plugin) { + return lilv_plugin_get_num_ports(Pointer.getPeer(plugin)); + } + protected native static int lilv_plugin_get_num_ports(@Ptr long plugin); + /** + * Get the port ranges (minimum, maximum and default values) for all ports.
+ * `min_values`, `max_values` and `def_values` must either point to an array
+ * of N floats, where N is the value returned by lilv_plugin_get_num_ports()
+ * for this plugin, or NULL. The elements of the array will be set to the
+ * the minimum, maximum and default values of the ports on this plugin,
+ * with array index corresponding to port index. If a port doesn't have a
+ * minimum, maximum or default value, or the port's type is not float, the
+ * corresponding array element will be set to NAN.
+ * This is a convenience method for the common case of getting the range of
+ * all float ports on a plugin, and may be significantly faster than
+ * repeated calls to lilv_port_get_range().
+ * Original signature : void lilv_plugin_get_port_ranges_float(const LilvPlugin*, float*, float*, float*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:912 + */ + public static void lilv_plugin_get_port_ranges_float(Pointer plugin, Pointer min_values, Pointer max_values, Pointer def_values) { + lilv_plugin_get_port_ranges_float(Pointer.getPeer(plugin), Pointer.getPeer(min_values), Pointer.getPeer(max_values), Pointer.getPeer(def_values)); + } + protected native static void lilv_plugin_get_port_ranges_float(@Ptr long plugin, @Ptr long min_values, @Ptr long max_values, @Ptr long def_values); + /** + * Get the number of ports on this plugin that are members of some class(es).
+ * Note that this is a varargs function so ports fitting any type 'profile'
+ * desired can be found quickly. REMEMBER TO TERMINATE THE PARAMETER LIST
+ * OF THIS FUNCTION WITH NULL OR VERY NASTY THINGS WILL HAPPEN.
+ * Original signature : uint32_t lilv_plugin_get_num_ports_of_class(const LilvPlugin*, const LilvNode*, null)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:924 + */ + public static int lilv_plugin_get_num_ports_of_class(Pointer plugin, Pointer class_1, Object... varargs) { + return lilv_plugin_get_num_ports_of_class(Pointer.getPeer(plugin), Pointer.getPeer(class_1)); + } + protected native static int lilv_plugin_get_num_ports_of_class(@Ptr long plugin, @Ptr long class_1, Object... varargs); + /** + * Variant of lilv_plugin_get_num_ports_of_class() that takes a va_list.
+ * This function calls va_arg() on `args` but does not call va_end().
+ * Original signature : uint32_t lilv_plugin_get_num_ports_of_class_va(const LilvPlugin*, const LilvNode*, va_list)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:934 + */ + public static int lilv_plugin_get_num_ports_of_class_va(Pointer plugin, Pointer class_1, Pointer args) { + return lilv_plugin_get_num_ports_of_class_va(Pointer.getPeer(plugin), Pointer.getPeer(class_1), Pointer.getPeer(args)); + } + protected native static int lilv_plugin_get_num_ports_of_class_va(@Ptr long plugin, @Ptr long class_1, @Ptr long args); + /** + * Return whether or not the plugin introduces (and reports) latency.
+ * The index of the latency port can be found with
+ * lilv_plugin_get_latency_port() ONLY if this function returns true.
+ * Original signature : bool lilv_plugin_has_latency(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:945 + */ + public static boolean lilv_plugin_has_latency(Pointer plugin) { + return lilv_plugin_has_latency(Pointer.getPeer(plugin)); + } + protected native static boolean lilv_plugin_has_latency(@Ptr long plugin); + /** + * Return the index of the plugin's latency port.
+ * It is a fatal error to call this on a plugin without checking if the port
+ * exists by first calling lilv_plugin_has_latency().
+ * Any plugin that introduces unwanted latency that should be compensated for
+ * (by hosts with the ability/need) MUST provide this port, which is a control
+ * rate output port that reports the latency for each cycle in frames.
+ * Original signature : uint32_t lilv_plugin_get_latency_port_index(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:957 + */ + public static int lilv_plugin_get_latency_port_index(Pointer plugin) { + return lilv_plugin_get_latency_port_index(Pointer.getPeer(plugin)); + } + protected native static int lilv_plugin_get_latency_port_index(@Ptr long plugin); + /** + * Get a port on `plugin` by `index`.
+ * Original signature : LilvPort* lilv_plugin_get_port_by_index(const LilvPlugin*, uint32_t)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:963 + */ + public static Pointer lilv_plugin_get_port_by_index(Pointer plugin, int index) { + return Pointer.pointerToAddress(lilv_plugin_get_port_by_index(Pointer.getPeer(plugin), index), LibLilv.LilvPort.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_port_by_index(@Ptr long plugin, int index); + /** + * Get a port on `plugin` by `symbol`.
+ * Note this function is slower than lilv_plugin_get_port_by_index(),
+ * especially on plugins with a very large number of ports.
+ * Original signature : LilvPort* lilv_plugin_get_port_by_symbol(const LilvPlugin*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:972 + */ + public static Pointer lilv_plugin_get_port_by_symbol(Pointer plugin, Pointer symbol) { + return Pointer.pointerToAddress(lilv_plugin_get_port_by_symbol(Pointer.getPeer(plugin), Pointer.getPeer(symbol)), LibLilv.LilvPort.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_port_by_symbol(@Ptr long plugin, @Ptr long symbol); + /** + * Get a port on `plugin` by its lv2:designation.
+ * The designation of a port describes the meaning, assignment, allocation or
+ * role of the port, e.g. "left channel" or "gain". If found, the port with
+ * matching `port_class` and `designation` is be returned, otherwise NULL is
+ * returned. The `port_class` can be used to distinguish the input and output
+ * ports for a particular designation. If `port_class` is NULL, any port with
+ * the given designation will be returned.
+ * Original signature : LilvPort* lilv_plugin_get_port_by_designation(const LilvPlugin*, const LilvNode*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:986 + */ + public static Pointer lilv_plugin_get_port_by_designation(Pointer plugin, Pointer port_class, Pointer designation) { + return Pointer.pointerToAddress(lilv_plugin_get_port_by_designation(Pointer.getPeer(plugin), Pointer.getPeer(port_class), Pointer.getPeer(designation)), LibLilv.LilvPort.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_port_by_designation(@Ptr long plugin, @Ptr long port_class, @Ptr long designation); + /** + * Get the project the plugin is a part of.
+ * More information about the project can be read via lilv_world_find_nodes(),
+ * typically using properties from DOAP (e.g. doap:name).
+ * Original signature : LilvNode* lilv_plugin_get_project(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:997 + */ + public static Pointer lilv_plugin_get_project(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_project(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_project(@Ptr long plugin); + /** + * Get the full name of the plugin's author.
+ * Returns NULL if author name is not present.
+ * Returned value must be freed by caller.
+ * Original signature : LilvNode* lilv_plugin_get_author_name(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1005 + */ + public static Pointer lilv_plugin_get_author_name(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_author_name(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_author_name(@Ptr long plugin); + /** + * Get the email address of the plugin's author.
+ * Returns NULL if author email address is not present.
+ * Returned value must be freed by caller.
+ * Original signature : LilvNode* lilv_plugin_get_author_email(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1013 + */ + public static Pointer lilv_plugin_get_author_email(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_author_email(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_author_email(@Ptr long plugin); + /** + * Get the address of the plugin author's home page.
+ * Returns NULL if author homepage is not present.
+ * Returned value must be freed by caller.
+ * Original signature : LilvNode* lilv_plugin_get_author_homepage(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1021 + */ + public static Pointer lilv_plugin_get_author_homepage(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_author_homepage(Pointer.getPeer(plugin)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_author_homepage(@Ptr long plugin); + /** + * Return true iff `plugin` has been replaced by another plugin.
+ * The plugin will still be usable, but hosts should hide them from their
+ * user interfaces to prevent users from using deprecated plugins.
+ * Original signature : bool lilv_plugin_is_replaced(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1030 + */ + public static boolean lilv_plugin_is_replaced(Pointer plugin) { + return lilv_plugin_is_replaced(Pointer.getPeer(plugin)); + } + protected native static boolean lilv_plugin_is_replaced(@Ptr long plugin); + /** + * Write the Turtle description of `plugin` to `plugin_file`.
+ * This function is particularly useful for porting plugins in conjunction with
+ * an LV2 bridge such as NASPRO.
+ * Original signature : void lilv_plugin_write_description(LilvWorld*, const LilvPlugin*, const LilvNode*, FILE*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1039 + */ + public static void lilv_plugin_write_description(Pointer world, Pointer plugin, Pointer base_uri, Pointer plugin_file) { + lilv_plugin_write_description(Pointer.getPeer(world), Pointer.getPeer(plugin), Pointer.getPeer(base_uri), Pointer.getPeer(plugin_file)); + } + protected native static void lilv_plugin_write_description(@Ptr long world, @Ptr long plugin, @Ptr long base_uri, @Ptr long plugin_file); + /** + * Write a manifest entry for `plugin` to `manifest_file`.
+ * This function is intended for use with lilv_plugin_write_description() to
+ * write a complete description of a plugin to a bundle.
+ * Original signature : void lilv_plugin_write_manifest_entry(LilvWorld*, const LilvPlugin*, const LilvNode*, FILE*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1051 + */ + public static void lilv_plugin_write_manifest_entry(Pointer world, Pointer plugin, Pointer base_uri, Pointer manifest_file, Pointer plugin_file_path) { + lilv_plugin_write_manifest_entry(Pointer.getPeer(world), Pointer.getPeer(plugin), Pointer.getPeer(base_uri), Pointer.getPeer(manifest_file), Pointer.getPeer(plugin_file_path)); + } + protected native static void lilv_plugin_write_manifest_entry(@Ptr long world, @Ptr long plugin, @Ptr long base_uri, @Ptr long manifest_file, @Ptr long plugin_file_path); + /** + * Get the resources related to `plugin` with lv2:appliesTo.
+ * Some plugin-related resources are not linked directly to the plugin with
+ * rdfs:seeAlso and thus will not be automatically loaded along with the plugin
+ * data (usually for performance reasons). All such resources of the given @c
+ * type related to `plugin` can be accessed with this function.
+ * If `type` is NULL, all such resources will be returned, regardless of type.
+ * To actually load the data for each returned resource, use
+ * lilv_world_load_resource().
+ * Original signature : LilvNodes* lilv_plugin_get_related(const LilvPlugin*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1071 + */ + public static Pointer lilv_plugin_get_related(Pointer plugin, Pointer type) { + return Pointer.pointerToAddress(lilv_plugin_get_related(Pointer.getPeer(plugin), Pointer.getPeer(type)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_related(@Ptr long plugin, @Ptr long type); + /** + * Get the RDF node of `port`.
+ * Ports nodes may be may be URIs or blank nodes.
+ * @return A shared node which must not be modified or freed.
+ * Original signature : LilvNode* lilv_port_get_node(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1087 + */ + public static Pointer lilv_port_get_node(Pointer plugin, Pointer port) { + return Pointer.pointerToAddress(lilv_port_get_node(Pointer.getPeer(plugin), Pointer.getPeer(port)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_node(@Ptr long plugin, @Ptr long port); + /** + * Port analog of lilv_plugin_get_value().
+ * Original signature : LilvNodes* lilv_port_get_value(const LilvPlugin*, const LilvPort*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1094 + */ + public static Pointer lilv_port_get_value(Pointer plugin, Pointer port, Pointer predicate) { + return Pointer.pointerToAddress(lilv_port_get_value(Pointer.getPeer(plugin), Pointer.getPeer(port), Pointer.getPeer(predicate)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_value(@Ptr long plugin, @Ptr long port, @Ptr long predicate); + /** + * Get a single property value of a port.
+ * This is equivalent to lilv_nodes_get_first(lilv_port_get_value(...)) but is
+ * simpler to use in the common case of only caring about one value. The
+ * caller is responsible for freeing the returned node.
+ * Original signature : LilvNode* lilv_port_get(const LilvPlugin*, const LilvPort*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1106 + */ + public static Pointer lilv_port_get(Pointer plugin, Pointer port, Pointer predicate) { + return Pointer.pointerToAddress(lilv_port_get(Pointer.getPeer(plugin), Pointer.getPeer(port), Pointer.getPeer(predicate)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get(@Ptr long plugin, @Ptr long port, @Ptr long predicate); + /** + * Return the LV2 port properties of a port.
+ * Original signature : LilvNodes* lilv_port_get_properties(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1114 + */ + public static Pointer lilv_port_get_properties(Pointer plugin, Pointer port) { + return Pointer.pointerToAddress(lilv_port_get_properties(Pointer.getPeer(plugin), Pointer.getPeer(port)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_properties(@Ptr long plugin, @Ptr long port); + /** + * Return whether a port has a certain property.
+ * Original signature : bool lilv_port_has_property(const LilvPlugin*, const LilvPort*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1121 + */ + public static boolean lilv_port_has_property(Pointer plugin, Pointer port, Pointer property) { + return lilv_port_has_property(Pointer.getPeer(plugin), Pointer.getPeer(port), Pointer.getPeer(property)); + } + protected native static boolean lilv_port_has_property(@Ptr long plugin, @Ptr long port, @Ptr long property); + /** + * Return whether a port supports a certain event type.
+ * More precisely, this returns true iff the port has an atom:supports or an
+ * ev:supportsEvent property with `event_type` as the value.
+ * Original signature : bool lilv_port_supports_event(const LilvPlugin*, const LilvPort*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1132 + */ + public static boolean lilv_port_supports_event(Pointer plugin, Pointer port, Pointer event_type) { + return lilv_port_supports_event(Pointer.getPeer(plugin), Pointer.getPeer(port), Pointer.getPeer(event_type)); + } + protected native static boolean lilv_port_supports_event(@Ptr long plugin, @Ptr long port, @Ptr long event_type); + /** + * Get the index of a port.
+ * The index is only valid for the life of the plugin and may change between
+ * versions. For a stable identifier, use the symbol.
+ * Original signature : uint32_t lilv_port_get_index(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1142 + */ + public static int lilv_port_get_index(Pointer plugin, Pointer port) { + return lilv_port_get_index(Pointer.getPeer(plugin), Pointer.getPeer(port)); + } + protected native static int lilv_port_get_index(@Ptr long plugin, @Ptr long port); + /** + * Get the symbol of a port.
+ * The 'symbol' is a short string, a valid C identifier.
+ * Returned value is owned by `port` and must not be freed.
+ * Original signature : LilvNode* lilv_port_get_symbol(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1151 + */ + public static Pointer lilv_port_get_symbol(Pointer plugin, Pointer port) { + return Pointer.pointerToAddress(lilv_port_get_symbol(Pointer.getPeer(plugin), Pointer.getPeer(port)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_symbol(@Ptr long plugin, @Ptr long port); + /** + * Get the name of a port.
+ * This is guaranteed to return the untranslated name (the doap:name in the
+ * data file without a language tag). Returned value must be freed by
+ * the caller.
+ * Original signature : LilvNode* lilv_port_get_name(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1161 + */ + public static Pointer lilv_port_get_name(Pointer plugin, Pointer port) { + return Pointer.pointerToAddress(lilv_port_get_name(Pointer.getPeer(plugin), Pointer.getPeer(port)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_name(@Ptr long plugin, @Ptr long port); + /** + * Get all the classes of a port.
+ * This can be used to determine if a port is an input, output, audio,
+ * control, midi, etc, etc, though it's simpler to use lilv_port_is_a().
+ * The returned list does not include lv2:Port, which is implied.
+ * Returned value is shared and must not be destroyed by caller.
+ * Original signature : LilvNodes* lilv_port_get_classes(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1172 + */ + public static Pointer lilv_port_get_classes(Pointer plugin, Pointer port) { + return Pointer.pointerToAddress(lilv_port_get_classes(Pointer.getPeer(plugin), Pointer.getPeer(port)), LilvPluginClasses.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_classes(@Ptr long plugin, @Ptr long port); + /** + * Determine if a port is of a given class (input, output, audio, etc).
+ * For convenience/performance/extensibility reasons, hosts are expected to
+ * create a LilvNode for each port class they "care about". Well-known type
+ * URI strings are defined (e.g. LILV_URI_INPUT_PORT) for convenience, but
+ * this function is designed so that Lilv is usable with any port types
+ * without requiring explicit support in Lilv.
+ * Original signature : bool lilv_port_is_a(const LilvPlugin*, const LilvPort*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1184 + */ + public static boolean lilv_port_is_a(Pointer plugin, Pointer port, Pointer port_class) { + return lilv_port_is_a(Pointer.getPeer(plugin), Pointer.getPeer(port), Pointer.getPeer(port_class)); + } + protected native static boolean lilv_port_is_a(@Ptr long plugin, @Ptr long port, @Ptr long port_class); + /** + * Get the default, minimum, and maximum values of a port.
+ * `def`, `min`, and `max` are outputs, pass pointers to uninitialized
+ * LilvNode* variables. These will be set to point at new values (which must
+ * be freed by the caller using lilv_node_free()), or NULL if the value does
+ * not exist.
+ * Original signature : void lilv_port_get_range(const LilvPlugin*, const LilvPort*, LilvNode**, LilvNode**, LilvNode**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1197 + */ + public static void lilv_port_get_range(Pointer plugin, Pointer port, Pointer > def, Pointer > min, Pointer > max) { + lilv_port_get_range(Pointer.getPeer(plugin), Pointer.getPeer(port), Pointer.getPeer(def), Pointer.getPeer(min), Pointer.getPeer(max)); + } + protected native static void lilv_port_get_range(@Ptr long plugin, @Ptr long port, @Ptr long def, @Ptr long min, @Ptr long max); + /** + * Get the scale points (enumeration values) of a port.
+ * This returns a collection of 'interesting' named values of a port
+ * (e.g. appropriate entries for a UI selector associated with this port).
+ * Returned value may be NULL if `port` has no scale points, otherwise it
+ * must be freed by caller with lilv_scale_points_free().
+ * Original signature : LilvScalePoints* lilv_port_get_scale_points(const LilvPlugin*, const LilvPort*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1211 + */ + public static Pointer lilv_port_get_scale_points(Pointer plugin, Pointer port) { + return Pointer.pointerToAddress(lilv_port_get_scale_points(Pointer.getPeer(plugin), Pointer.getPeer(port)), LilvScalePoints.class, noReleaser); + } + @Ptr + protected native static long lilv_port_get_scale_points(@Ptr long plugin, @Ptr long port); + /** + * Load a state snapshot from the world RDF model.
+ * This function can be used to load the default state of a plugin by passing
+ * the plugin URI as the `subject` parameter.
+ * @param world The world.
+ * @param map URID mapper.
+ * @param node The subject of the state description (e.g. a preset URI).
+ * @return A new LilvState which must be freed with lilv_state_free(), or NULL.
+ * Original signature : LilvState* lilv_state_new_from_world(LilvWorld*, LV2_URID_Map*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1230 + */ + public static Pointer lilv_state_new_from_world(Pointer world, Pointer map, Pointer node) { + return Pointer.pointerToAddress(lilv_state_new_from_world(Pointer.getPeer(world), Pointer.getPeer(map), Pointer.getPeer(node)), LibLilv.LilvState.class, noReleaser); + } + @Ptr + protected native static long lilv_state_new_from_world(@Ptr long world, @Ptr long map, @Ptr long node); + /** + * Load a state snapshot from a file.
+ * @param world The world.
+ * @param map URID mapper.
+ * @param subject The subject of the state description (e.g. a preset URI).
+ * @param path The path of the file containing the state description.
+ * @return A new LilvState which must be freed with lilv_state_free().
+ * If `subject` is NULL, it is taken to be the URI of the file (i.e.
+ * "<>" in Turtle).
+ * This function parses the file separately to create the state, it does not
+ * parse the file into the world model, i.e. the returned state is the only
+ * new memory consumed once this function returns.
+ * Original signature : LilvState* lilv_state_new_from_file(LilvWorld*, LV2_URID_Map*, const LilvNode*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1250 + */ + public static Pointer lilv_state_new_from_file(Pointer world, Pointer map, Pointer subject, Pointer path) { + return Pointer.pointerToAddress(lilv_state_new_from_file(Pointer.getPeer(world), Pointer.getPeer(map), Pointer.getPeer(subject), Pointer.getPeer(path)), LibLilv.LilvState.class, noReleaser); + } + @Ptr + protected native static long lilv_state_new_from_file(@Ptr long world, @Ptr long map, @Ptr long subject, @Ptr long path); + /** + * Load a state snapshot from a string made by lilv_state_to_string().
+ * Original signature : LilvState* lilv_state_new_from_string(LilvWorld*, LV2_URID_Map*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1259 + */ + public static Pointer lilv_state_new_from_string(Pointer world, Pointer map, Pointer str) { + return Pointer.pointerToAddress(lilv_state_new_from_string(Pointer.getPeer(world), Pointer.getPeer(map), Pointer.getPeer(str)), LibLilv.LilvState.class, noReleaser); + } + @Ptr + protected native static long lilv_state_new_from_string(@Ptr long world, @Ptr long map, @Ptr long str); + /** + * Create a new state snapshot from a plugin instance.
+ * @param plugin The plugin this state applies to.
+ * @param instance An instance of `plugin`.
+ * @param map The map to use for mapping URIs in state.
+ * @param scratch_dir Directory of files created by the plugin earlier, or
+ * NULL. This is for hosts that support file creation at any time with state
+ * state:makePath. These files will be copied as necessary to `copy_dir` and
+ * not be referred to directly in state (a temporary directory is appropriate).
+ * @param copy_dir Directory of copies of files in `scratch_dir`, or NULL.
+ * This directory will have the same structure as `scratch_dir` but with
+ * possibly modified file names to distinguish revisions. This allows the
+ * saved state to contain the exact contents of the scratch file at save time,
+ * so that the state is not ruined if the file is later modified (for example,
+ * by the plugin continuing to record). This can be the same as `save_dir` to
+ * create a copy in the state bundle, but can also be a separate directory
+ * which allows multiple state snapshots to share a single copy if the file has
+ * not changed.
+ * @param link_dir Directory of links to external files, or NULL. A link will
+ * be made in this directory to any external files referred to in plugin state.
+ * In turn, links will be created in the save directory to these links (e.g.
+ * save_dir/file => link_dir/file => /foo/bar/file). This allows many state
+ * snapshots to share a single link to an external file, so archival (e.g. with
+ * tar -h) will not create several copies of the file. If this is not
+ * required, it can be the same as `save_dir`.
+ * @param save_dir Directory of files created by plugin during save (or NULL).
+ * This is typically the bundle directory later passed to lilv_state_save().
+ * @param get_value Function to get port values (or NULL). If NULL, the
+ * returned state will not represent port values. This should only be NULL in
+ * hosts that save and restore port values via some other mechanism.
+ * @param user_data User data to pass to `get_value`.
+ * @param flags Bitwise OR of LV2_State_Flags values.
+ * @param features Features to pass LV2_State_Interface.save().
+ * @return A new LilvState which must be freed with lilv_state_free().
+ * This function may be called simultaneously with any instance function
+ * (except discovery functions) unless the threading class of that function
+ * explicitly disallows this.
+ * To support advanced file functionality, there are several directory
+ * parameters. Simple hosts that only wish to save a single plugins state once
+ * may simply use the same directory for all of them (or pass NULL to not
+ * support files at all). The multiple parameters are necessary to support
+ * saving an instances state many times while avoiding any duplication of data.
+ * If supported (via state:makePath passed to LV2_Descriptor::instantiate()),
+ * `scratch_dir` should be the directory where any files created by the plugin
+ * (not during save time, e.g. during instantiation) are stored. These files
+ * will be copied to preserve their state at this time.plugin-created files are
+ * stored. Lilv will assume any files within this directory (recursively) are
+ * created by the plugin and all other files are immutable. Note that this
+ * function does not save the state, use lilv_state_save() for that.
+ * See state.h from the
+ * LV2 State extension for details on the `flags` and `features` parameters.
+ * Original signature : LilvState* lilv_state_new_from_instance(const LilvPlugin*, LilvInstance*, LV2_URID_Map*, const char*, const char*, const char*, const char*, LilvGetPortValueFunc, void*, uint32_t, const const LV2_Feature**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1347 + */ + public static Pointer lilv_state_new_from_instance(Pointer plugin, Pointer instance, Pointer map, Pointer scratch_dir, Pointer copy_dir, Pointer link_dir, Pointer save_dir, Pointer get_value, Pointer user_data, int flags, Pointer > features) { + return Pointer.pointerToAddress(lilv_state_new_from_instance(Pointer.getPeer(plugin), Pointer.getPeer(instance), Pointer.getPeer(map), Pointer.getPeer(scratch_dir), Pointer.getPeer(copy_dir), Pointer.getPeer(link_dir), Pointer.getPeer(save_dir), Pointer.getPeer(get_value), Pointer.getPeer(user_data), flags, Pointer.getPeer(features)), LibLilv.LilvState.class, noReleaser); + } + @Ptr + protected native static long lilv_state_new_from_instance(@Ptr long plugin, @Ptr long instance, @Ptr long map, @Ptr long scratch_dir, @Ptr long copy_dir, @Ptr long link_dir, @Ptr long save_dir, @Ptr long get_value, @Ptr long user_data, int flags, @Ptr long features); + /** + * Free `state`.
+ * Original signature : void lilv_state_free(LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1363 + */ + public static void lilv_state_free(Pointer state) { + lilv_state_free(Pointer.getPeer(state)); + } + protected native static void lilv_state_free(@Ptr long state); + /** + * Return true iff `a` is equivalent to `b`.
+ * Original signature : bool lilv_state_equals(const LilvState*, const LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1369 + */ + public static boolean lilv_state_equals(Pointer a, Pointer b) { + return lilv_state_equals(Pointer.getPeer(a), Pointer.getPeer(b)); + } + protected native static boolean lilv_state_equals(@Ptr long a, @Ptr long b); + /** + * Return the number of properties in `state`.
+ * Original signature : int lilv_state_get_num_properties(const LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1375 + */ + public static int lilv_state_get_num_properties(Pointer state) { + return lilv_state_get_num_properties(Pointer.getPeer(state)); + } + protected native static int lilv_state_get_num_properties(@Ptr long state); + /** + * Get the URI of the plugin `state` applies to.
+ * Original signature : LilvNode* lilv_state_get_plugin_uri(const LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1381 + */ + public static Pointer lilv_state_get_plugin_uri(Pointer state) { + return Pointer.pointerToAddress(lilv_state_get_plugin_uri(Pointer.getPeer(state)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_state_get_plugin_uri(@Ptr long state); + /** + * Get the URI of `state`.
+ * This may return NULL if the state has not been saved and has no URI.
+ * Original signature : LilvNode* lilv_state_get_uri(const LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1389 + */ + public static Pointer lilv_state_get_uri(Pointer state) { + return Pointer.pointerToAddress(lilv_state_get_uri(Pointer.getPeer(state)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_state_get_uri(@Ptr long state); + /** + * Get the label of `state`.
+ * Original signature : char* lilv_state_get_label(const LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1395 + */ + public static Pointer lilv_state_get_label(Pointer state) { + return Pointer.pointerToAddress(lilv_state_get_label(Pointer.getPeer(state)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_state_get_label(@Ptr long state); + /** + * Set the label of `state`.
+ * Original signature : void lilv_state_set_label(LilvState*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1401 + */ + public static void lilv_state_set_label(Pointer state, Pointer label) { + lilv_state_set_label(Pointer.getPeer(state), Pointer.getPeer(label)); + } + protected native static void lilv_state_set_label(@Ptr long state, @Ptr long label); + /** + * Set a metadata property on `state`.
+ * @param state The state to set the metadata for.
+ * @param key The key to store `value` under (URID).
+ * @param value Pointer to the value to be stored.
+ * @param size The size of `value` in bytes.
+ * @param type The type of `value` (URID).
+ * @param flags LV2_State_Flags for `value`.
+ * @return 0 on success.
+ * This is a generic version of lilv_state_set_label(), which sets metadata
+ * properties visible to hosts, but not plugins. This allows storing useful
+ * information such as comments or preset banks.
+ * Original signature : int lilv_state_set_metadata(LilvState*, uint32_t, const void*, size_t, uint32_t, uint32_t)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1419 + */ + public static int lilv_state_set_metadata(Pointer state, int key, Pointer value, @Ptr long size, int type, int flags) { + return lilv_state_set_metadata(Pointer.getPeer(state), key, Pointer.getPeer(value), size, type, flags); + } + protected native static int lilv_state_set_metadata(@Ptr long state, int key, @Ptr long value, @Ptr long size, int type, int flags); + /** + * Enumerate the port values in a state snapshot.
+ * @param state The state to retrieve port values from.
+ * @param set_value A function to receive port values.
+ * @param user_data User data to pass to `set_value`.
+ * This function is a subset of lilv_state_restore() that only fires the
+ * `set_value` callback and does not directly affect a plugin instance. This
+ * is useful in hosts that need to retrieve the port values in a state snapshot
+ * for special handling.
+ * Original signature : void lilv_state_emit_port_values(const LilvState*, LilvSetPortValueFunc, void*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1452 + */ + public static void lilv_state_emit_port_values(Pointer state, Pointer set_value, Pointer user_data) { + lilv_state_emit_port_values(Pointer.getPeer(state), Pointer.getPeer(set_value), Pointer.getPeer(user_data)); + } + protected native static void lilv_state_emit_port_values(@Ptr long state, @Ptr long set_value, @Ptr long user_data); + /** + * Restore a plugin instance from a state snapshot.
+ * @param state The state to restore, which must apply to the correct plugin.
+ * @param instance An instance of the plugin `state` applies to, or NULL.
+ * @param set_value A function to set a port value (may be NULL).
+ * @param user_data User data to pass to `set_value`.
+ * @param flags Bitwise OR of LV2_State_Flags values.
+ * @param features Features to pass LV2_State_Interface.restore().
+ * This will set all the properties of `instance`, if given, to the values
+ * stored in `state`. If `set_value` is provided, it will be called (with the
+ * given `user_data`) to restore each port value, otherwise the host must
+ * restore the port values itself (using lilv_state_get_port_value()) in order
+ * to completely restore `state`.
+ * If the state has properties and `instance` is given, this function is in
+ * the "instantiation" threading class, i.e. it MUST NOT be called
+ * simultaneously with any function on the same plugin instance. If the state
+ * has no properties, only port values are set via `set_value`.
+ * See state.h from the
+ * LV2 State extension for details on the `flags` and `features` parameters.
+ * Original signature : void lilv_state_restore(const LilvState*, LilvInstance*, LilvSetPortValueFunc, void*, uint32_t, const const LV2_Feature**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1480 + */ + public static void lilv_state_restore(Pointer state, Pointer instance, Pointer set_value, Pointer user_data, int flags, Pointer > features) { + lilv_state_restore(Pointer.getPeer(state), Pointer.getPeer(instance), Pointer.getPeer(set_value), Pointer.getPeer(user_data), flags, Pointer.getPeer(features)); + } + protected native static void lilv_state_restore(@Ptr long state, @Ptr long instance, @Ptr long set_value, @Ptr long user_data, int flags, @Ptr long features); + /** + * Save state to a file.
+ * @param world The world.
+ * @param map URID mapper.
+ * @param unmap URID unmapper.
+ * @param state State to save.
+ * @param uri URI of state, may be NULL.
+ * @param dir Path of the bundle directory to save into.
+ * @param filename Path of the state file relative to `dir`.
+ * The format of state on disk is compatible with that defined in the LV2
+ * preset extension, i.e. this function may be used to save presets which can
+ * be loaded by any host.
+ * If `uri` is NULL, the preset URI will be a file URI, but the bundle
+ * can safely be moved (i.e. the state file will use "<>" as the subject).
+ * Original signature : int lilv_state_save(LilvWorld*, LV2_URID_Map*, LV2_URID_Unmap*, const LilvState*, const char*, const char*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1505 + */ + public static int lilv_state_save(Pointer world, Pointer map, Pointer unmap, Pointer state, Pointer uri, Pointer dir, Pointer filename) { + return lilv_state_save(Pointer.getPeer(world), Pointer.getPeer(map), Pointer.getPeer(unmap), Pointer.getPeer(state), Pointer.getPeer(uri), Pointer.getPeer(dir), Pointer.getPeer(filename)); + } + protected native static int lilv_state_save(@Ptr long world, @Ptr long map, @Ptr long unmap, @Ptr long state, @Ptr long uri, @Ptr long dir, @Ptr long filename); + /** + * Save state to a string. This function does not use the filesystem.
+ * @param world The world.
+ * @param map URID mapper.
+ * @param unmap URID unmapper.
+ * @param state The state to serialize.
+ * @param uri URI for the state description (mandatory).
+ * @param base_uri Base URI for serialisation. Unless you know what you are
+ * doing, pass NULL for this, otherwise the state may not be restorable via
+ * lilv_state_new_from_string().
+ * Original signature : char* lilv_state_to_string(LilvWorld*, LV2_URID_Map*, LV2_URID_Unmap*, const LilvState*, const char*, const char*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1526 + */ + public static Pointer lilv_state_to_string(Pointer world, Pointer map, Pointer unmap, Pointer state, Pointer uri, Pointer base_uri) { + return Pointer.pointerToAddress(lilv_state_to_string(Pointer.getPeer(world), Pointer.getPeer(map), Pointer.getPeer(unmap), Pointer.getPeer(state), Pointer.getPeer(uri), Pointer.getPeer(base_uri)), Byte.class, noReleaser); + } + @Ptr + protected native static long lilv_state_to_string(@Ptr long world, @Ptr long map, @Ptr long unmap, @Ptr long state, @Ptr long uri, @Ptr long base_uri); + /** + * Unload a state from the world and delete all associated files.
+ * @param world The world.
+ * @param state State to remove from the system.
+ * This function DELETES FILES/DIRECTORIES FROM THE FILESYSTEM! It is intended
+ * for removing user-saved presets, but can delete any state the user has
+ * permission to delete, including presets shipped with plugins.
+ * The rdfs:seeAlso file for the state will be removed. The entry in the
+ * bundle's manifest.ttl is removed, and if this results in an empty manifest,
+ * then the manifest file is removed. If this results in an empty bundle, then
+ * the bundle directory is removed as well.
+ * Original signature : int lilv_state_delete(LilvWorld*, const LilvState*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1548 + */ + public static int lilv_state_delete(Pointer world, Pointer state) { + return lilv_state_delete(Pointer.getPeer(world), Pointer.getPeer(state)); + } + protected native static int lilv_state_delete(@Ptr long world, @Ptr long state); + /** + * Get the label of this scale point (enumeration value)
+ * Returned value is owned by `point` and must not be freed.
+ * Original signature : LilvNode* lilv_scale_point_get_label(const LilvScalePoint*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1562 + */ + public static Pointer lilv_scale_point_get_label(Pointer point) { + return Pointer.pointerToAddress(lilv_scale_point_get_label(Pointer.getPeer(point)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_scale_point_get_label(@Ptr long point); + /** + * Get the value of this scale point (enumeration value)
+ * Returned value is owned by `point` and must not be freed.
+ * Original signature : LilvNode* lilv_scale_point_get_value(const LilvScalePoint*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1569 + */ + public static Pointer lilv_scale_point_get_value(Pointer point) { + return Pointer.pointerToAddress(lilv_scale_point_get_value(Pointer.getPeer(point)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_scale_point_get_value(@Ptr long point); + /** + * Get the URI of this class' superclass.
+ * Returned value is owned by `plugin_class` and must not be freed by caller.
+ * Returned value may be NULL, if class has no parent.
+ * Original signature : LilvNode* lilv_plugin_class_get_parent_uri(const LilvPluginClass*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1583 + */ + public static Pointer lilv_plugin_class_get_parent_uri(Pointer plugin_class) { + return Pointer.pointerToAddress(lilv_plugin_class_get_parent_uri(Pointer.getPeer(plugin_class)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_class_get_parent_uri(@Ptr long plugin_class); + /** + * Get the URI of this plugin class.
+ * Returned value is owned by `plugin_class` and must not be freed by caller.
+ * Original signature : LilvNode* lilv_plugin_class_get_uri(const LilvPluginClass*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1590 + */ + public static Pointer lilv_plugin_class_get_uri(Pointer plugin_class) { + return Pointer.pointerToAddress(lilv_plugin_class_get_uri(Pointer.getPeer(plugin_class)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_class_get_uri(@Ptr long plugin_class); + /** + * Get the label of this plugin class, ie "Oscillators".
+ * Returned value is owned by `plugin_class` and must not be freed by caller.
+ * Original signature : LilvNode* lilv_plugin_class_get_label(const LilvPluginClass*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1597 + */ + public static Pointer lilv_plugin_class_get_label(Pointer plugin_class) { + return Pointer.pointerToAddress(lilv_plugin_class_get_label(Pointer.getPeer(plugin_class)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_class_get_label(@Ptr long plugin_class); + /** + * Get the subclasses of this plugin class.
+ * Returned value must be freed by caller with lilv_plugin_classes_free().
+ * Original signature : LilvPluginClasses* lilv_plugin_class_get_children(const LilvPluginClass*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1604 + */ + public static Pointer lilv_plugin_class_get_children(Pointer plugin_class) { + return Pointer.pointerToAddress(lilv_plugin_class_get_children(Pointer.getPeer(plugin_class)), LilvPluginClasses.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_class_get_children(@Ptr long plugin_class); + /** + * Instantiate a plugin.
+ * The returned value is a lightweight handle for an LV2 plugin instance,
+ * it does not refer to `plugin`, or any other Lilv state. The caller must
+ * eventually free it with lilv_instance_free().
+ * `features` is a NULL-terminated array of features the host supports.
+ * NULL may be passed if the host supports no additional features.
+ * @return NULL if instantiation failed.
+ * Original signature : LilvInstance* lilv_plugin_instantiate(const LilvPlugin*, double, const const LV2_Feature**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1643 + */ + public static Pointer lilv_plugin_instantiate(Pointer plugin, double sample_rate, Pointer> features) { + return Pointer.pointerToAddress(lilv_plugin_instantiate(Pointer.getPeer(plugin), sample_rate, Pointer.getPeer(features)), LilvInstanceImpl.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_instantiate(@Ptr long plugin, double sample_rate, @Ptr long features); + /** + * Free a plugin instance.
+ * It is safe to call this function on NULL.
+ * `instance` is invalid after this call.
+ * Original signature : void lilv_instance_free(LilvInstance*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1653 + */ + + public static void lilv_instance_run(Pointer instance, int sample_count) + { + instance.get().lv2_descriptor().get().run().get().apply(instance.get().lv2_handle(), sample_count); + //instance.instance->lv2_descriptor->run(instance->lv2_handle, sample_count); + } + + public static void lilv_instance_activate(Pointer instance) + { + if(instance.get().lv2_descriptor().get().activate().equals(Pointer.NULL)) + instance.get().lv2_descriptor().get().activate().get().apply(instance.get().lv2_handle()); + /* + * if (instance->lv2_descriptor->activate) { + instance->lv2_descriptor->activate(instance->lv2_handle); + } + */ + } + + public static void lilv_instance_desactivate(Pointer instance) + { + if(instance.get().lv2_descriptor().get().deactivate().equals(Pointer.NULL)) + instance.get().lv2_descriptor().get().deactivate().get().apply(instance.get().lv2_handle()); + + } + + public static void lilv_instance_connect_port(Pointer instance, int port_index, Pointer data_location) { + instance.get().lv2_descriptor().get().connect_port().get().apply(instance.get().lv2_handle(), port_index, data_location); + } + + public static Pointer lilv_instance_free(Pointer instance) { + return Pointer.pointerToAddress(lilv_instance_free(Pointer.getPeer(instance)), LilvInstanceImpl.class, noReleaser); + } + @Ptr + protected native static long lilv_instance_free(@Ptr long instance); + + + + + /** + * Get all UIs for `plugin`.
+ * Returned value must be freed by caller using lilv_uis_free().
+ * Original signature : LilvUIs* lilv_plugin_get_uis(const LilvPlugin*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1775 + */ + public static Pointer lilv_plugin_get_uis(Pointer plugin) { + return Pointer.pointerToAddress(lilv_plugin_get_uis(Pointer.getPeer(plugin)), LilvUIs.class, noReleaser); + } + @Ptr + protected native static long lilv_plugin_get_uis(@Ptr long plugin); + /** + * Get the URI of a Plugin UI.
+ * @param ui The Plugin UI
+ * @return a shared value which must not be modified or freed.
+ * Original signature : LilvNode* lilv_ui_get_uri(const LilvUI*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1783 + */ + public static Pointer lilv_ui_get_uri(Pointer ui) { + return Pointer.pointerToAddress(lilv_ui_get_uri(Pointer.getPeer(ui)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_ui_get_uri(@Ptr long ui); + /** + * Get the types (URIs of RDF classes) of a Plugin UI.
+ * @param ui The Plugin UI
+ * @return a shared value which must not be modified or freed.
+ * Note that in most cases lilv_ui_is_supported() should be used, which avoids
+ * the need to use this function (and type specific logic).
+ * Original signature : LilvNodes* lilv_ui_get_classes(const LilvUI*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1794 + */ + public static Pointer lilv_ui_get_classes(Pointer ui) { + return Pointer.pointerToAddress(lilv_ui_get_classes(Pointer.getPeer(ui)), LilvNodes.class, noReleaser); + } + @Ptr + protected native static long lilv_ui_get_classes(@Ptr long ui); + /** + * Check whether a plugin UI has a given type.
+ * @param ui The Plugin UI
+ * @param class_uri The URI of the LV2 UI type to check this UI against
+ * Original signature : bool lilv_ui_is_a(const LilvUI*, const LilvNode*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1802 + */ + public static boolean lilv_ui_is_a(Pointer ui, Pointer class_uri) { + return lilv_ui_is_a(Pointer.getPeer(ui), Pointer.getPeer(class_uri)); + } + protected native static boolean lilv_ui_is_a(@Ptr long ui, @Ptr long class_uri); + /** + * Return true iff a Plugin UI is supported as a given widget type.
+ * @param ui The Plugin UI
+ * @param supported_func User provided supported predicate.
+ * @param container_type The widget type to host the UI within.
+ * @param ui_type (Output) If non-NULL, set to the native type of the UI
+ * which is owned by `ui` and must not be freed by the caller.
+ * @return The embedding quality level returned by `supported_func`.
+ * Original signature : int lilv_ui_is_supported(const LilvUI*, LilvUISupportedFunc, const LilvNode*, const LilvNode**)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1823 + */ + public static int lilv_ui_is_supported(Pointer ui, Pointer supported_func, Pointer container_type, Pointer > ui_type) { + return lilv_ui_is_supported(Pointer.getPeer(ui), Pointer.getPeer(supported_func), Pointer.getPeer(container_type), Pointer.getPeer(ui_type)); + } + protected native static int lilv_ui_is_supported(@Ptr long ui, @Ptr long supported_func, @Ptr long container_type, @Ptr long ui_type); + /** + * Get the URI for a Plugin UI's bundle.
+ * @param ui The Plugin UI
+ * @return a shared value which must not be modified or freed.
+ * Original signature : LilvNode* lilv_ui_get_bundle_uri(const LilvUI*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1834 + */ + public static Pointer lilv_ui_get_bundle_uri(Pointer ui) { + return Pointer.pointerToAddress(lilv_ui_get_bundle_uri(Pointer.getPeer(ui)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_ui_get_bundle_uri(@Ptr long ui); + /** + * Get the URI for a Plugin UI's shared library.
+ * @param ui The Plugin UI
+ * @return a shared value which must not be modified or freed.
+ * Original signature : LilvNode* lilv_ui_get_binary_uri(const LilvUI*)
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1842 + */ + public static Pointer lilv_ui_get_binary_uri(Pointer ui) { + return Pointer.pointerToAddress(lilv_ui_get_binary_uri(Pointer.getPeer(ui)), LibLilv.LilvNode.class, noReleaser); + } + @Ptr + protected native static long lilv_ui_get_binary_uri(@Ptr long ui); + + public static interface LilvNodes {} + public static interface LilvIter {} + public static interface LilvPlugins {} + public static interface LilvPluginClasses {} + public static interface LilvScalePoints {} + public static interface LilvUIs {} + public static interface LilvPorts {} + /// Undefined type + /// Undefined type + public static interface LilvScalePoint { + + }; + /// Undefined type + /// Undefined type + public static interface LilvPlugin { + + }; + /// Undefined type + /// Undefined type + public static interface LilvPort { + + }; + /// Undefined type + /// Undefined type + public static interface LilvWorld { + + }; + /// Undefined type + /// Undefined type + public static interface LilvUI { + + }; + /// Undefined type + /// Undefined type + public static interface LilvState { + + }; + /// Undefined type + /// Undefined type + public static interface LilvPluginClass{ + + }; + /// Undefined type + /// Undefined type + public static interface LilvNode { + + }; + public static abstract class LV2_RUID_Map extends StructObject {} + public static abstract class LV2_RUID_Unmap extends StructObject {} + public static abstract class LV2_URID_Map extends StructObject {} + public static abstract class LV2_URID_Unmap extends StructObject {} + public static abstract class FILE {} + + + public static final List> lilvForeach(Pointer list, + Function,Pointer> beginFun, + BiFunction,Pointer,Boolean> endFun, + BiFunction,Pointer,Pointer> nextFun, + BiFunction,Pointer,Pointer> getFun) { + List> outList = new ArrayList<>(); + for (Pointer i = beginFun.apply(list); + !endFun.apply(list, i); + i = nextFun.apply(list, i)) + outList.add(getFun.apply(list, i)); + return outList; + } + + public static final List> lilvPluginsToList(Pointer plugins) { + return lilvForeach(plugins, LibLilv::lilv_plugins_begin, LibLilv::lilv_plugins_is_end, LibLilv::lilv_plugins_next, LibLilv::lilv_plugins_get); + } + public static final List> lilvNodesToList(Pointer nodes) { + return lilvForeach(nodes, LibLilv::lilv_nodes_begin, LibLilv::lilv_nodes_is_end, LibLilv::lilv_nodes_next, LibLilv::lilv_nodes_get); + } + public static final List> lilvPluginClassesToList(Pointer pluginClasses) { + return lilvForeach(pluginClasses, LibLilv::lilv_plugin_classes_begin, LibLilv::lilv_plugin_classes_is_end, LibLilv::lilv_plugin_classes_next, LibLilv::lilv_plugin_classes_get); + } + public static final List> lilvScalePointsToList(Pointer scalePoints) { + return lilvForeach(scalePoints, LibLilv::lilv_scale_points_begin, LibLilv::lilv_scale_points_is_end, LibLilv::lilv_scale_points_next, LibLilv::lilv_scale_points_get); + } + public static final List> lilvUIsToList(Pointer uis) { + return lilvForeach(uis, LibLilv::lilv_uis_begin, LibLilv::lilv_uis_is_end, LibLilv::lilv_uis_next, LibLilv::lilv_uis_get); + } + + +} diff --git a/src/main/java/com/bernard/sboard/bridj/LibLv2.java b/src/main/java/com/bernard/sboard/bridj/LibLv2.java new file mode 100644 index 0000000..f7da396 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LibLv2.java @@ -0,0 +1,250 @@ +package com.bernard.sboard.bridj; +import org.bridj.BridJ; +import org.bridj.CRuntime; +import org.bridj.Callback; +import org.bridj.Pointer; +import org.bridj.Pointer.Releaser; +import org.bridj.ann.Library; +import org.bridj.ann.Name; +import org.bridj.ann.Ptr; +import org.bridj.ann.Runtime; +/** + * Wrapper for library lv2
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java or BridJ . + */ +@Library("lv2") +@Runtime(CRuntime.class) +public class LibLv2 { + static { + BridJ.register(); + } + + public static final Releaser noReleaser = new Pointer.Releaser() { + + @Override + public void release(Pointer p) { + // Doing nothing + } + }; + + + public static final String LV2_CORE_PREFIX = "http://lv2plug.in/ns/lv2core#"; ///< http://lv2plug.in/ns/lv2core# + + public static final String LV2_CORE__AllpassPlugin = LV2_CORE_PREFIX + "AllpassPlugin"; ///< http://lv2plug.in/ns/lv2core#AllpassPlugin + public static final String LV2_CORE__AmplifierPlugin = LV2_CORE_PREFIX + "AmplifierPlugin"; ///< http://lv2plug.in/ns/lv2core#AmplifierPlugin + public static final String LV2_CORE__AnalyserPlugin = LV2_CORE_PREFIX + "AnalyserPlugin"; ///< http://lv2plug.in/ns/lv2core#AnalyserPlugin + public static final String LV2_CORE__AudioPort = LV2_CORE_PREFIX + "AudioPort"; ///< http://lv2plug.in/ns/lv2core#AudioPort + public static final String LV2_CORE__BandpassPlugin = LV2_CORE_PREFIX + "BandpassPlugin"; ///< http://lv2plug.in/ns/lv2core#BandpassPlugin + public static final String LV2_CORE__CVPort = LV2_CORE_PREFIX + "CVPort"; ///< http://lv2plug.in/ns/lv2core#CVPort + public static final String LV2_CORE__ChorusPlugin = LV2_CORE_PREFIX + "ChorusPlugin"; ///< http://lv2plug.in/ns/lv2core#ChorusPlugin + public static final String LV2_CORE__CombPlugin = LV2_CORE_PREFIX + "CombPlugin"; ///< http://lv2plug.in/ns/lv2core#CombPlugin + public static final String LV2_CORE__CompressorPlugin = LV2_CORE_PREFIX + "CompressorPlugin"; ///< http://lv2plug.in/ns/lv2core#CompressorPlugin + public static final String LV2_CORE__ConstantPlugin = LV2_CORE_PREFIX + "ConstantPlugin"; ///< http://lv2plug.in/ns/lv2core#ConstantPlugin + public static final String LV2_CORE__ControlPort = LV2_CORE_PREFIX + "ControlPort"; ///< http://lv2plug.in/ns/lv2core#ControlPort + public static final String LV2_CORE__ConverterPlugin = LV2_CORE_PREFIX + "ConverterPlugin"; ///< http://lv2plug.in/ns/lv2core#ConverterPlugin + public static final String LV2_CORE__DelayPlugin = LV2_CORE_PREFIX + "DelayPlugin"; ///< http://lv2plug.in/ns/lv2core#DelayPlugin + public static final String LV2_CORE__DistortionPlugin = LV2_CORE_PREFIX + "DistortionPlugin"; ///< http://lv2plug.in/ns/lv2core#DistortionPlugin + public static final String LV2_CORE__DynamicsPlugin = LV2_CORE_PREFIX + "DynamicsPlugin"; ///< http://lv2plug.in/ns/lv2core#DynamicsPlugin + public static final String LV2_CORE__EQPlugin = LV2_CORE_PREFIX + "EQPlugin"; ///< http://lv2plug.in/ns/lv2core#EQPlugin + public static final String LV2_CORE__EnvelopePlugin = LV2_CORE_PREFIX + "EnvelopePlugin"; ///< http://lv2plug.in/ns/lv2core#EnvelopePlugin + public static final String LV2_CORE__ExpanderPlugin = LV2_CORE_PREFIX + "ExpanderPlugin"; ///< http://lv2plug.in/ns/lv2core#ExpanderPlugin + public static final String LV2_CORE__ExtensionData = LV2_CORE_PREFIX + "ExtensionData"; ///< http://lv2plug.in/ns/lv2core#ExtensionData + public static final String LV2_CORE__Feature = LV2_CORE_PREFIX + "Feature"; ///< http://lv2plug.in/ns/lv2core#Feature + public static final String LV2_CORE__FilterPlugin = LV2_CORE_PREFIX + "FilterPlugin"; ///< http://lv2plug.in/ns/lv2core#FilterPlugin + public static final String LV2_CORE__FlangerPlugin = LV2_CORE_PREFIX + "FlangerPlugin"; ///< http://lv2plug.in/ns/lv2core#FlangerPlugin + public static final String LV2_CORE__FunctionPlugin = LV2_CORE_PREFIX + "FunctionPlugin"; ///< http://lv2plug.in/ns/lv2core#FunctionPlugin + public static final String LV2_CORE__GatePlugin = LV2_CORE_PREFIX + "GatePlugin"; ///< http://lv2plug.in/ns/lv2core#GatePlugin + public static final String LV2_CORE__GeneratorPlugin = LV2_CORE_PREFIX + "GeneratorPlugin"; ///< http://lv2plug.in/ns/lv2core#GeneratorPlugin + public static final String LV2_CORE__HighpassPlugin = LV2_CORE_PREFIX + "HighpassPlugin"; ///< http://lv2plug.in/ns/lv2core#HighpassPlugin + public static final String LV2_CORE__InputPort = LV2_CORE_PREFIX + "InputPort"; ///< http://lv2plug.in/ns/lv2core#InputPort + public static final String LV2_CORE__InstrumentPlugin = LV2_CORE_PREFIX + "InstrumentPlugin"; ///< http://lv2plug.in/ns/lv2core#InstrumentPlugin + public static final String LV2_CORE__LimiterPlugin = LV2_CORE_PREFIX + "LimiterPlugin"; ///< http://lv2plug.in/ns/lv2core#LimiterPlugin + public static final String LV2_CORE__LowpassPlugin = LV2_CORE_PREFIX + "LowpassPlugin"; ///< http://lv2plug.in/ns/lv2core#LowpassPlugin + public static final String LV2_CORE__MixerPlugin = LV2_CORE_PREFIX + "MixerPlugin"; ///< http://lv2plug.in/ns/lv2core#MixerPlugin + public static final String LV2_CORE__ModulatorPlugin = LV2_CORE_PREFIX + "ModulatorPlugin"; ///< http://lv2plug.in/ns/lv2core#ModulatorPlugin + public static final String LV2_CORE__MultiEQPlugin = LV2_CORE_PREFIX + "MultiEQPlugin"; ///< http://lv2plug.in/ns/lv2core#MultiEQPlugin + public static final String LV2_CORE__OscillatorPlugin = LV2_CORE_PREFIX + "OscillatorPlugin"; ///< http://lv2plug.in/ns/lv2core#OscillatorPlugin + public static final String LV2_CORE__OutputPort = LV2_CORE_PREFIX + "OutputPort"; ///< http://lv2plug.in/ns/lv2core#OutputPort + public static final String LV2_CORE__ParaEQPlugin = LV2_CORE_PREFIX + "ParaEQPlugin"; ///< http://lv2plug.in/ns/lv2core#ParaEQPlugin + public static final String LV2_CORE__PhaserPlugin = LV2_CORE_PREFIX + "PhaserPlugin"; ///< http://lv2plug.in/ns/lv2core#PhaserPlugin + public static final String LV2_CORE__PitchPlugin = LV2_CORE_PREFIX + "PitchPlugin"; ///< http://lv2plug.in/ns/lv2core#PitchPlugin + public static final String LV2_CORE__Plugin = LV2_CORE_PREFIX + "Plugin"; ///< http://lv2plug.in/ns/lv2core#Plugin + public static final String LV2_CORE__PluginBase = LV2_CORE_PREFIX + "PluginBase"; ///< http://lv2plug.in/ns/lv2core#PluginBase + public static final String LV2_CORE__Point = LV2_CORE_PREFIX + "Point"; ///< http://lv2plug.in/ns/lv2core#Point + public static final String LV2_CORE__Port = LV2_CORE_PREFIX + "Port"; ///< http://lv2plug.in/ns/lv2core#Port + public static final String LV2_CORE__PortProperty = LV2_CORE_PREFIX + "PortProperty"; ///< http://lv2plug.in/ns/lv2core#PortProperty + public static final String LV2_CORE__Resource = LV2_CORE_PREFIX + "Resource"; ///< http://lv2plug.in/ns/lv2core#Resource + public static final String LV2_CORE__ReverbPlugin = LV2_CORE_PREFIX + "ReverbPlugin"; ///< http://lv2plug.in/ns/lv2core#ReverbPlugin + public static final String LV2_CORE__ScalePoint = LV2_CORE_PREFIX + "ScalePoint"; ///< http://lv2plug.in/ns/lv2core#ScalePoint + public static final String LV2_CORE__SimulatorPlugin = LV2_CORE_PREFIX + "SimulatorPlugin"; ///< http://lv2plug.in/ns/lv2core#SimulatorPlugin + public static final String LV2_CORE__SpatialPlugin = LV2_CORE_PREFIX + "SpatialPlugin"; ///< http://lv2plug.in/ns/lv2core#SpatialPlugin + public static final String LV2_CORE__Specification = LV2_CORE_PREFIX + "Specification"; ///< http://lv2plug.in/ns/lv2core#Specification + public static final String LV2_CORE__SpectralPlugin = LV2_CORE_PREFIX + "SpectralPlugin"; ///< http://lv2plug.in/ns/lv2core#SpectralPlugin + public static final String LV2_CORE__UtilityPlugin = LV2_CORE_PREFIX + "UtilityPlugin"; ///< http://lv2plug.in/ns/lv2core#UtilityPlugin + public static final String LV2_CORE__WaveshaperPlugin = LV2_CORE_PREFIX + "WaveshaperPlugin"; ///< http://lv2plug.in/ns/lv2core#WaveshaperPlugin + public static final String LV2_CORE__appliesTo = LV2_CORE_PREFIX + "appliesTo"; ///< http://lv2plug.in/ns/lv2core#appliesTo + public static final String LV2_CORE__binary = LV2_CORE_PREFIX + "binary"; ///< http://lv2plug.in/ns/lv2core#binary + public static final String LV2_CORE__connectionOptional= LV2_CORE_PREFIX + "connectionOptional"; ///< http://lv2plug.in/ns/lv2core#connectionOptional + public static final String LV2_CORE__control = LV2_CORE_PREFIX + "control"; ///< http://lv2plug.in/ns/lv2core#control + public static final String LV2_CORE__default = LV2_CORE_PREFIX + "default"; ///< http://lv2plug.in/ns/lv2core#default + public static final String LV2_CORE__designation = LV2_CORE_PREFIX + "designation"; ///< http://lv2plug.in/ns/lv2core#designation + public static final String LV2_CORE__documentation = LV2_CORE_PREFIX + "documentation"; ///< http://lv2plug.in/ns/lv2core#documentation + public static final String LV2_CORE__enabled = LV2_CORE_PREFIX + "enabled"; ///< http://lv2plug.in/ns/lv2core#enabled + public static final String LV2_CORE__enumeration = LV2_CORE_PREFIX + "enumeration"; ///< http://lv2plug.in/ns/lv2core#enumeration + public static final String LV2_CORE__extensionData = LV2_CORE_PREFIX + "extensionData"; ///< http://lv2plug.in/ns/lv2core#extensionData + public static final String LV2_CORE__freeWheeling = LV2_CORE_PREFIX + "freeWheeling"; ///< http://lv2plug.in/ns/lv2core#freeWheeling + public static final String LV2_CORE__hardRTCapable = LV2_CORE_PREFIX + "hardRTCapable"; ///< http://lv2plug.in/ns/lv2core#hardRTCapable + public static final String LV2_CORE__inPlaceBroken = LV2_CORE_PREFIX + "inPlaceBroken"; ///< http://lv2plug.in/ns/lv2core#inPlaceBroken + public static final String LV2_CORE__index = LV2_CORE_PREFIX + "index"; ///< http://lv2plug.in/ns/lv2core#index + public static final String LV2_CORE__integer = LV2_CORE_PREFIX + "integer"; ///< http://lv2plug.in/ns/lv2core#integer + public static final String LV2_CORE__isLive = LV2_CORE_PREFIX + "isLive"; ///< http://lv2plug.in/ns/lv2core#isLive + public static final String LV2_CORE__latency = LV2_CORE_PREFIX + "latency"; ///< http://lv2plug.in/ns/lv2core#latency + public static final String LV2_CORE__maximum = LV2_CORE_PREFIX + "maximum"; ///< http://lv2plug.in/ns/lv2core#maximum + public static final String LV2_CORE__microVersion = LV2_CORE_PREFIX + "microVersion"; ///< http://lv2plug.in/ns/lv2core#microVersion + public static final String LV2_CORE__minimum = LV2_CORE_PREFIX + "minimum"; ///< http://lv2plug.in/ns/lv2core#minimum + public static final String LV2_CORE__minorVersion = LV2_CORE_PREFIX + "minorVersion"; ///< http://lv2plug.in/ns/lv2core#minorVersion + public static final String LV2_CORE__name = LV2_CORE_PREFIX + "name"; ///< http://lv2plug.in/ns/lv2core#name + public static final String LV2_CORE__optionalFeature = LV2_CORE_PREFIX + "optionalFeature"; ///< http://lv2plug.in/ns/lv2core#optionalFeature + public static final String LV2_CORE__port = LV2_CORE_PREFIX + "port"; ///< http://lv2plug.in/ns/lv2core#port + public static final String LV2_CORE__portProperty = LV2_CORE_PREFIX + "portProperty"; ///< http://lv2plug.in/ns/lv2core#portProperty + public static final String LV2_CORE__project = LV2_CORE_PREFIX + "project"; ///< http://lv2plug.in/ns/lv2core#project + public static final String LV2_CORE__prototype = LV2_CORE_PREFIX + "prototype"; ///< http://lv2plug.in/ns/lv2core#prototype + public static final String LV2_CORE__reportsLatency = LV2_CORE_PREFIX + "reportsLatency"; ///< http://lv2plug.in/ns/lv2core#reportsLatency + public static final String LV2_CORE__requiredFeature = LV2_CORE_PREFIX + "requiredFeature"; ///< http://lv2plug.in/ns/lv2core#requiredFeature + public static final String LV2_CORE__sampleRate = LV2_CORE_PREFIX + "sampleRate"; ///< http://lv2plug.in/ns/lv2core#sampleRate + public static final String LV2_CORE__scalePoint = LV2_CORE_PREFIX + "scalePoint"; ///< http://lv2plug.in/ns/lv2core#scalePoint + public static final String LV2_CORE__symbol = LV2_CORE_PREFIX + "symbol"; ///< http://lv2plug.in/ns/lv2core#symbol + public static final String LV2_CORE__toggled = LV2_CORE_PREFIX + "toggled"; ///< http://lv2plug.in/ns/lv2core#toggled + + public static final String LV2_PRESETS_PREFIX = "http://lv2plug.in/ns/ext/presets#"; ///< http://lv2plug.in/ns/ext/presets# + + public static final String LV2_PRESETS__Bank = LV2_PRESETS_PREFIX + "Bank"; ///< http://lv2plug.in/ns/ext/presets#Bank + public static final String LV2_PRESETS__Preset = LV2_PRESETS_PREFIX + "Preset"; ///< http://lv2plug.in/ns/ext/presets#Preset + public static final String LV2_PRESETS__bank = LV2_PRESETS_PREFIX + "bank"; ///< http://lv2plug.in/ns/ext/presets#bank + public static final String LV2_PRESETS__preset = LV2_PRESETS_PREFIX + "preset"; ///< http://lv2plug.in/ns/ext/presets#preset + public static final String LV2_PRESETS__value = LV2_PRESETS_PREFIX + "value"; ///< http://lv2plug.in/ns/ext/presets#value + + public static final String LV2_EVENT_PREFIX = "http://lv2plug.in/ns/ext/event#" ; ///< http://lv2plug.in/ns/ext/event# + + public static final String LV2_EVENT__Event = LV2_EVENT_PREFIX + "Event"; ///< http://lv2plug.in/ns/ext/event#Event + public static final String LV2_EVENT__EventPort = LV2_EVENT_PREFIX + "EventPort"; ///< http://lv2plug.in/ns/ext/event#EventPort + public static final String LV2_EVENT__FrameStamp = LV2_EVENT_PREFIX + "FrameStamp"; ///< http://lv2plug.in/ns/ext/event#FrameStamp + public static final String LV2_EVENT__TimeStamp = LV2_EVENT_PREFIX + "TimeStamp"; ///< http://lv2plug.in/ns/ext/event#TimeStamp + public static final String LV2_EVENT__generatesTimeStamp = LV2_EVENT_PREFIX + "generatesTimeStamp"; ///< http://lv2plug.in/ns/ext/event#generatesTimeStamp + public static final String LV2_EVENT__generic = LV2_EVENT_PREFIX + "generic"; ///< http://lv2plug.in/ns/ext/event#generic + public static final String LV2_EVENT__inheritsEvent = LV2_EVENT_PREFIX + "inheritsEvent"; ///< http://lv2plug.in/ns/ext/event#inheritsEvent + public static final String LV2_EVENT__inheritsTimeStamp = LV2_EVENT_PREFIX + "inheritsTimeStamp"; ///< http://lv2plug.in/ns/ext/event#inheritsTimeStamp + public static final String LV2_EVENT__supportsEvent = LV2_EVENT_PREFIX + "supportsEvent"; ///< http://lv2plug.in/ns/ext/event#supportsEvent + public static final String LV2_EVENT__supportsTimeStamp = LV2_EVENT_PREFIX + "supportsTimeStamp"; ///< http://lv2plug.in/ns/ext/event#supportsTimeStamp + + public static final String LV2_PORT_GROUPS_PREFIX = "http://lv2plug.in/ns/ext/port-groups#"; ///< http://lv2plug.in/ns/ext/port-groups# + + public static final String LV2_PORT_GROUPS__DiscreteGroup = LV2_PORT_GROUPS_PREFIX + "DiscreteGroup"; ///< http://lv2plug.in/ns/ext/port-groups#DiscreteGroup + public static final String LV2_PORT_GROUPS__Element = LV2_PORT_GROUPS_PREFIX + "Element"; ///< http://lv2plug.in/ns/ext/port-groups#Element + public static final String LV2_PORT_GROUPS__FivePointOneGroup = LV2_PORT_GROUPS_PREFIX + "FivePointOneGroup"; ///< http://lv2plug.in/ns/ext/port-groups#FivePointOneGroup + public static final String LV2_PORT_GROUPS__FivePointZeroGroup = LV2_PORT_GROUPS_PREFIX + "FivePointZeroGroup"; ///< http://lv2plug.in/ns/ext/port-groups#FivePointZeroGroup + public static final String LV2_PORT_GROUPS__FourPointZeroGroup = LV2_PORT_GROUPS_PREFIX + "FourPointZeroGroup"; ///< http://lv2plug.in/ns/ext/port-groups#FourPointZeroGroup + public static final String LV2_PORT_GROUPS__Group = LV2_PORT_GROUPS_PREFIX + "Group"; ///< http://lv2plug.in/ns/ext/port-groups#Group + public static final String LV2_PORT_GROUPS__InputGroup = LV2_PORT_GROUPS_PREFIX + "InputGroup"; ///< http://lv2plug.in/ns/ext/port-groups#InputGroup + public static final String LV2_PORT_GROUPS__MidSideGroup = LV2_PORT_GROUPS_PREFIX + "MidSideGroup"; ///< http://lv2plug.in/ns/ext/port-groups#MidSideGroup + public static final String LV2_PORT_GROUPS__MonoGroup = LV2_PORT_GROUPS_PREFIX + "MonoGroup"; ///< http://lv2plug.in/ns/ext/port-groups#MonoGroup + public static final String LV2_PORT_GROUPS__OutputGroup = LV2_PORT_GROUPS_PREFIX + "OutputGroup"; ///< http://lv2plug.in/ns/ext/port-groups#OutputGroup + public static final String LV2_PORT_GROUPS__SevenPointOneGroup = LV2_PORT_GROUPS_PREFIX + "SevenPointOneGroup"; ///< http://lv2plug.in/ns/ext/port-groups#SevenPointOneGroup + public static final String LV2_PORT_GROUPS__SevenPointOneWideGroup = LV2_PORT_GROUPS_PREFIX + "SevenPointOneWideGroup"; ///< http://lv2plug.in/ns/ext/port-groups#SevenPointOneWideGroup + public static final String LV2_PORT_GROUPS__SixPointOneGroup = LV2_PORT_GROUPS_PREFIX + "SixPointOneGroup"; ///< http://lv2plug.in/ns/ext/port-groups#SixPointOneGroup + public static final String LV2_PORT_GROUPS__StereoGroup = LV2_PORT_GROUPS_PREFIX + "StereoGroup"; ///< http://lv2plug.in/ns/ext/port-groups#StereoGroup + public static final String LV2_PORT_GROUPS__ThreePointZeroGroup = LV2_PORT_GROUPS_PREFIX + "ThreePointZeroGroup"; ///< http://lv2plug.in/ns/ext/port-groups#ThreePointZeroGroup + public static final String LV2_PORT_GROUPS__center = LV2_PORT_GROUPS_PREFIX + "center"; ///< http://lv2plug.in/ns/ext/port-groups#center + public static final String LV2_PORT_GROUPS__centerLeft = LV2_PORT_GROUPS_PREFIX + "centerLeft"; ///< http://lv2plug.in/ns/ext/port-groups#centerLeft + public static final String LV2_PORT_GROUPS__centerRight = LV2_PORT_GROUPS_PREFIX + "centerRight"; ///< http://lv2plug.in/ns/ext/port-groups#centerRight + public static final String LV2_PORT_GROUPS__element = LV2_PORT_GROUPS_PREFIX + "element"; ///< http://lv2plug.in/ns/ext/port-groups#element + public static final String LV2_PORT_GROUPS__group = LV2_PORT_GROUPS_PREFIX + "group"; ///< http://lv2plug.in/ns/ext/port-groups#group + public static final String LV2_PORT_GROUPS__left = LV2_PORT_GROUPS_PREFIX + "left"; ///< http://lv2plug.in/ns/ext/port-groups#left + public static final String LV2_PORT_GROUPS__lowFrequencyEffects = LV2_PORT_GROUPS_PREFIX + "lowFrequencyEffects"; ///< http://lv2plug.in/ns/ext/port-groups#lowFrequencyEffects + public static final String LV2_PORT_GROUPS__mainInput = LV2_PORT_GROUPS_PREFIX + "mainInput"; ///< http://lv2plug.in/ns/ext/port-groups#mainInput + public static final String LV2_PORT_GROUPS__mainOutput = LV2_PORT_GROUPS_PREFIX + "mainOutput"; ///< http://lv2plug.in/ns/ext/port-groups#mainOutput + public static final String LV2_PORT_GROUPS__rearCenter = LV2_PORT_GROUPS_PREFIX + "rearCenter"; ///< http://lv2plug.in/ns/ext/port-groups#rearCenter + public static final String LV2_PORT_GROUPS__rearLeft = LV2_PORT_GROUPS_PREFIX + "rearLeft"; ///< http://lv2plug.in/ns/ext/port-groups#rearLeft + public static final String LV2_PORT_GROUPS__rearRight = LV2_PORT_GROUPS_PREFIX + "rearRight"; ///< http://lv2plug.in/ns/ext/port-groups#rearRight + public static final String LV2_PORT_GROUPS__right = LV2_PORT_GROUPS_PREFIX + "right"; ///< http://lv2plug.in/ns/ext/port-groups#right + public static final String LV2_PORT_GROUPS__side = LV2_PORT_GROUPS_PREFIX + "side"; ///< http://lv2plug.in/ns/ext/port-groups#side + public static final String LV2_PORT_GROUPS__sideChainOf = LV2_PORT_GROUPS_PREFIX + "sideChainOf"; ///< http://lv2plug.in/ns/ext/port-groups#sideChainOf + public static final String LV2_PORT_GROUPS__sideLeft = LV2_PORT_GROUPS_PREFIX + "sideLeft"; ///< http://lv2plug.in/ns/ext/port-groups#sideLeft + public static final String LV2_PORT_GROUPS__sideRight = LV2_PORT_GROUPS_PREFIX + "sideRight"; ///< http://lv2plug.in/ns/ext/port-groups#sideRight + public static final String LV2_PORT_GROUPS__source = LV2_PORT_GROUPS_PREFIX + "source"; ///< http://lv2plug.in/ns/ext/port-groups#source + public static final String LV2_PORT_GROUPS__subGroupOf = LV2_PORT_GROUPS_PREFIX + "subGroupOf"; ///< http://lv2plug.in/ns/ext/port-groups#subGroupOf + + + /** + * Type of the lv2_descriptor() function in a library (old discovery API).
+ * native declaration : /usr/lib/lv2/core.lv2/lv2.h:405 + */ + /** + * Type of the lv2_descriptor() function in a library (old discovery API).
+ * native declaration : /usr/lib/lv2/core.lv2/lv2.h:405 + */ + public static abstract class LV2_Descriptor_Function extends Callback { + abstract public Pointer apply(int index); + }; + /** + * Type of the lv2_lib_descriptor() function in an LV2 library.
+ * native declaration : /usr/lib/lv2/core.lv2/lv2.h:471 + */ + /** + * Type of the lv2_lib_descriptor() function in an LV2 library.
+ * native declaration : /usr/lib/lv2/core.lv2/lv2.h:471 + */ + public static abstract class LV2_Lib_Descriptor_Function extends Callback { + abstract public Pointer apply(Pointer bundle_path, Pointer > features); + }; + /** + * Prototype for plugin accessor function.
+ * Plugins are discovered by hosts using RDF data (not by loading libraries).
+ * See http://lv2plug.in for details on the discovery process, though most
+ * hosts should use an existing library to implement this functionality.
+ * This is the simple plugin discovery API, suitable for most statically
+ * defined plugins. Advanced plugins that need access to their bundle during
+ * discovery can use lv2_lib_descriptor() instead. Plugin libraries MUST
+ * include a function called "lv2_descriptor" or "lv2_lib_descriptor" with
+ * C-style linkage, but SHOULD provide "lv2_descriptor" wherever possible.
+ * When it is time to load a plugin (designated by its URI), the host loads the
+ * plugin's library, gets the lv2_descriptor() function from it, and uses this
+ * function to find the LV2_Descriptor for the desired plugin. Plugins are
+ * accessed by index using values from 0 upwards. This function MUST return
+ * NULL for out of range indices, so the host can enumerate plugins by
+ * increasing `index` until NULL is returned.
+ * Note that `index` has no meaning, hosts MUST NOT depend on it remaining
+ * consistent between loads of the plugin library.
+ * Original signature : LV2_Descriptor* lv2_descriptor(uint32_t)
+ * native declaration : /usr/lib/lv2/core.lv2/lv2.h:398 + */ + public static Pointer lv2_descriptor(int index) { + return Pointer.pointerToAddress(lv2_descriptor$2(index), LV2_Descriptor.class, noReleaser); + } + @Ptr + @Name("lv2_descriptor") + protected native static long lv2_descriptor$2(int index); + /** + * Prototype for library accessor function.
+ * This is the more advanced discovery API, which allows plugin libraries to
+ * access their bundles during discovery, which makes it possible for plugins to
+ * be dynamically defined by files in their bundle. This API also has an
+ * explicit cleanup function, removing any need for non-portable shared library
+ * destructors. Simple plugins that do not require these features may use
+ * lv2_descriptor() instead.
+ * This is the entry point for a plugin library. Hosts load this symbol from
+ * the library and call this function to obtain a library descriptor which can
+ * be used to access all the contained plugins. The returned object must not
+ * be destroyed (using LV2_Lib_Descriptor::cleanup()) until all plugins loaded
+ * from that library have been destroyed.
+ * Original signature : LV2_Lib_Descriptor* lv2_lib_descriptor(const char*, const const LV2_Feature**)
+ * native declaration : /usr/lib/lv2/core.lv2/lv2.h:464 + */ + public static Pointer lv2_lib_descriptor(Pointer bundle_path, Pointer > features) { + return Pointer.pointerToAddress(lv2_lib_descriptor(Pointer.getPeer(bundle_path), Pointer.getPeer(features)), LV2_Lib_Descriptor.class,noReleaser); + } + @Ptr + protected native static long lv2_lib_descriptor(@Ptr long bundle_path, @Ptr long features); +} diff --git a/src/main/java/com/bernard/sboard/bridj/LilvInstanceImpl.java b/src/main/java/com/bernard/sboard/bridj/LilvInstanceImpl.java new file mode 100644 index 0000000..e58a421 --- /dev/null +++ b/src/main/java/com/bernard/sboard/bridj/LilvInstanceImpl.java @@ -0,0 +1,59 @@ +package com.bernard.sboard.bridj; +import org.bridj.Pointer; +import org.bridj.StructObject; +import org.bridj.ann.Field; +import org.bridj.ann.Library; +/** + * Instance of a plugin.
+ * This is exposed in the ABI to allow inlining of performance critical
+ * functions like lilv_instance_run() (simple wrappers of functions in lv2.h).
+ * This is for performance reasons, user code should not use this definition
+ * in any way (which is why it is not machine documented).
+ * Truly private implementation details are hidden via `pimpl`.
+ * native declaration : /opt/kxstudio/include/lilv-0/lilv/lilv.h:1624
+ * This file was autogenerated by JNAerator,
+ * a tool written by Olivier Chafik that uses a few opensource projects..
+ * For help, please visit NativeLibs4Java or BridJ . + */ +@Library("lilv-0") +public class LilvInstanceImpl extends StructObject { + public LilvInstanceImpl() { + super(); + } + /// C type : LV2_Handle + @Field(0) + public Pointer lv2_descriptor() { + return this.io.getPointerField(this, 0); + } + /// C type : LV2_Handle + @Field(0) + public LilvInstanceImpl lv2_descriptor(Pointer lv2_descriptor) { + this.io.setPointerField(this, 0, lv2_descriptor); + return this; + } + /// C type : LV2_Handle + @Field(1) + public Pointer lv2_handle() { + return this.io.getPointerField(this, 1); + } + /// C type : LV2_Handle + @Field(1) + public LilvInstanceImpl lv2_handle(Pointer lv2_handle) { + this.io.setPointerField(this, 1, lv2_handle); + return this; + } + /// C type : void* + @Field(2) + public Pointer pimpl() { + return this.io.getPointerField(this, 2); + } + /// C type : void* + @Field(2) + public LilvInstanceImpl pimpl(Pointer pimpl) { + this.io.setPointerField(this, 2, pimpl); + return this; + } + public LilvInstanceImpl(Pointer pointer) { + super(); + } +} diff --git a/src/main/java/com/bernard/sboard/config/EffectsBoxConfig.java b/src/main/java/com/bernard/sboard/config/EffectsBoxConfig.java new file mode 100644 index 0000000..8ef0624 --- /dev/null +++ b/src/main/java/com/bernard/sboard/config/EffectsBoxConfig.java @@ -0,0 +1,16 @@ +package com.bernard.sboard.config; + +import java.util.HashMap; +import java.util.Map; + +public class EffectsBoxConfig { + + public Map layouts = new HashMap<>(); + + public String inputPointName = "input"; + public String outputPointName = "output"; + + public String defaultLayout = "default"; + + public int bufferDefaultSampleCount = 128; +} diff --git a/src/main/java/com/bernard/sboard/config/OscConfig.java b/src/main/java/com/bernard/sboard/config/OscConfig.java new file mode 100644 index 0000000..2b0c2a3 --- /dev/null +++ b/src/main/java/com/bernard/sboard/config/OscConfig.java @@ -0,0 +1,14 @@ +package com.bernard.sboard.config; + +import com.illposed.osc.transport.NetworkProtocol; + +public class OscConfig { + + // Every 100ms + public long frequentUpdatePeriod = 100; + + public NetworkProtocol networkProtocol = NetworkProtocol.UDP; + + public int inputport = 8775; + public int outputport = 8776; +} diff --git a/src/main/java/com/bernard/sboard/config/PluginConfig.java b/src/main/java/com/bernard/sboard/config/PluginConfig.java new file mode 100644 index 0000000..9c4a92d --- /dev/null +++ b/src/main/java/com/bernard/sboard/config/PluginConfig.java @@ -0,0 +1,15 @@ +package com.bernard.sboard.config; + +import java.util.Map; + +public class PluginConfig { + + public String name; + public String displayName; + public String uri; + + // map port symbol -> point name + public Map inputConnections; + public Map outputConnections; + +} diff --git a/src/main/java/com/bernard/sboard/config/PluginLayoutConfig.java b/src/main/java/com/bernard/sboard/config/PluginLayoutConfig.java new file mode 100644 index 0000000..92522a1 --- /dev/null +++ b/src/main/java/com/bernard/sboard/config/PluginLayoutConfig.java @@ -0,0 +1,17 @@ +package com.bernard.sboard.config; + +import java.util.List; + +public class PluginLayoutConfig { + + public String name; + public String displayName; + public List plugins; + + public static final boolean validateLayout() { + //TODO: Verifier qu'il n'y a pas de boucle + //TODO: Verifier que l'ordre des connections ne contredit pas l'ordre des plugins + //TODO: Verifier qu'à un point est toujours attaché au plus un pluginOutput + return false; + } +} diff --git a/src/main/java/com/bernard/sboard/config/SBoardConfig.java b/src/main/java/com/bernard/sboard/config/SBoardConfig.java new file mode 100644 index 0000000..0129138 --- /dev/null +++ b/src/main/java/com/bernard/sboard/config/SBoardConfig.java @@ -0,0 +1,25 @@ +package com.bernard.sboard.config; + +public class SBoardConfig { + + public String jackControllerName = "SBoard"; + + public String micPortName = "mic"; + public String computerInPortName = "computer"; + + public String effectsMicPortName = "effectsMic"; + public String soundsPortName = "sounds"; + public String repeatedMicName = "repeatedMic"; + + public String fakeMicPortName = "fakeMic"; + public String earLoopbackPortName = "earLoopback"; + + public String jackAudioType = "32 bit float mono audio"; + + //TODO: Verifier que la fréquence audio de la config correspond à celle de jack. + public float soundFrequency = 48_000f; + + public EffectsBoxConfig effects = new EffectsBoxConfig(); + + public OscConfig osc = new OscConfig(); +} diff --git a/src/main/java/com/bernard/sboard/effects/EffectsBox.java b/src/main/java/com/bernard/sboard/effects/EffectsBox.java new file mode 100644 index 0000000..0c24529 --- /dev/null +++ b/src/main/java/com/bernard/sboard/effects/EffectsBox.java @@ -0,0 +1,217 @@ +package com.bernard.sboard.effects; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.bridj.BridJ; +import org.bridj.Pointer; + +import com.bernard.sboard.SBoard; +import com.bernard.sboard.bridj.LibLilv; +import com.bernard.sboard.bridj.LibLilv.LilvPlugin; +import com.bernard.sboard.bridj.LibLilv.LilvWorld; +import com.bernard.sboard.config.EffectsBoxConfig; +import com.bernard.sboard.config.PluginConfig; +import com.bernard.sboard.config.PluginLayoutConfig; +import com.bernard.sboard.lv2.LV2Plugin; +import com.bernard.sboard.lv2.LV2Port; +import com.bernard.sboard.lv2.LV2Preset; +import com.bernard.sboard.lv2.LV2Ui; +import com.bernard.sboard.osc.OscUtils; +import com.bernard.sboard.osc.SOscMessage; + +public class EffectsBox { + + SBoard sboard; + EffectsBoxConfig config; + + Logger log = LogManager.getLogger(EffectsBox.class); + + Pointer world; + + List plugins; + Pointer pluginsObject; + + Map loadedPlugins; + PluginLayoutConfig plc; + + Pointer inBlankBuffer=null, outRandBuffer=null; + + int pointSize = 0; + Map> points; + + public EffectsBox(SBoard sboard, EffectsBoxConfig config) { + this.config = config; + this.sboard = sboard; + this.loadedPlugins = new HashMap<>(); + this.points = new HashMap<>(); + } + + + public void setup() { + this.world = LibLilv.lilv_world_new(); + + LibLilv.lilv_world_load_all(world); + + this.plugins = new ArrayList<>(); + pluginsObject = LibLilv.lilv_world_get_all_plugins(world); + for (Pointer i = LibLilv.lilv_plugins_begin(pluginsObject); + !LibLilv.lilv_plugins_is_end(pluginsObject, i); + i = LibLilv.lilv_plugins_next(pluginsObject, i)) { + Pointer plugin = LibLilv.lilv_plugins_get(pluginsObject, i); + this.plugins.add(new LV2Plugin(world,plugin)); + } + + inBlankBuffer = Pointer.allocateArray(Float.class, config.bufferDefaultSampleCount); + outRandBuffer = Pointer.allocateArray(Float.class, config.bufferDefaultSampleCount); + + // Now loading default layout + PluginLayoutConfig plc = config.layouts.get(config.defaultLayout); + if(plc==null) + log.error("Could not load find default plugin layout «"+config.defaultLayout+"»"); + else + setupPlugins(plc); + } + + public void setupPlugins(PluginLayoutConfig plc) { + for(PluginConfig pc : plc.plugins) { + this.loadedPlugins.put(pc.name, new LoadedPlugin(this, sboard.config.soundFrequency, pc)); + } + setupConnections(plc, config.bufferDefaultSampleCount); + } + + public void setupConnections(PluginLayoutConfig plc, int sampleCount) { + if(inBlankBuffer==null)inBlankBuffer = Pointer.allocateArray(Float.class, sampleCount); + if(outRandBuffer==null)outRandBuffer = Pointer.allocateArray(Float.class, sampleCount); + for(PluginConfig pc : plc.plugins) { + for(Entry e : pc.inputConnections.entrySet()) { + log.debug("Connecting "+e.getKey()+" to "+e.getValue()); + if(!points.containsKey(e.getValue())) { + Pointer newpoint = Pointer.allocateArray(Float.class,sampleCount); + if(newpoint==null)throw new RuntimeException("Coud not instanciate a point"); + points.put(e.getValue(), newpoint); + } + Pointer point = points.get(e.getValue()); + if(!loadedPlugins.get(pc.name).connectInputPort(e.getKey(), point)) + log.error("The requested port is not an input port"); + } + for(Entry e : pc.outputConnections.entrySet()) { + log.debug("Connecting "+e.getKey()+" to "+e.getValue()); + if(!points.containsKey(e.getValue())) { + Pointer newpoint = Pointer.allocateArray(Float.class,sampleCount); + if(newpoint==null)throw new RuntimeException("Coud not instanciate a point"); + points.put(e.getValue(), newpoint); + } + Pointer point = points.get(e.getValue()); + if(!loadedPlugins.get(pc.name).connectOutputPort(e.getKey(), point)) + log.error("The requested port is not an output port"); + } + + } + pointSize = sampleCount; + this.plc = plc; + } + + public void applyEffects(int nframes, Pointer inBuffer, Pointer outBuffer) { + if(plc==null) { + inBuffer.moveBytesTo(outBuffer, nframes*BridJ.sizeOf(Float.class)); + return; + } + if(pointSize < nframes) { + inBlankBuffer = null; + outRandBuffer = null; + // Reallocation de tous les points + for(String pname : points.keySet()) + points.get(pname).release(); + points.clear(); + setupConnections(plc, nframes); + } + // On copie tous l'entrée dans le inbuffer + if(points.containsKey(config.inputPointName)) + inBuffer.moveBytesTo(points.get(config.inputPointName), nframes*BridJ.sizeOf(Float.class)); + // On lance maintenant tous les plugins + for(PluginConfig p : plc.plugins) + loadedPlugins.get(p.name).run(nframes); + // Enfin, on copie dans le outbuffer + if(points.containsKey(config.outputPointName)) + points.get(config.outputPointName).moveBytesTo(outBuffer, nframes*BridJ.sizeOf(Float.class)); + } + + public void receiveOscMessage(SOscMessage message) { + if(OscUtils.addrMatch(message.getContainer(1), "plugins")) { + for(String s : OscUtils.allAddrMatch(message.getContainer(2), loadedPlugins.keySet())) + loadedPlugins.get(s).receiveOscMessage(message); + } + } + + public void close() { + + LibLilv.lilv_world_free(world); + + } + + + public void lv2info(LV2Plugin e) { + + System.out.println("Présentation du plugin "+e.getUri()); + System.out.println("| Nom : "+e.getName()); + System.out.println("| Classe : "+e.getPluginClass()); + System.out.println("| Author : "+e.getAuthorName()); + System.out.println("| Author email : "+e.getAuthorEmail()); + System.out.println("| Author website : "+e.getAuthorHomepage()); + System.out.println("| Has latency : "+e.hasLatency()); + System.out.println("| Latency port : "+e.getLatencyPort()); + System.out.println("| Bundle uri : "+e.getBundleUri()); + System.out.println("| Binary uri : "+e.getBinaryUri()); + for(LV2Ui ui : e.getPluginUIs()) { + System.out.println("| Ui : "+ui.getUri()); + for(String clazz : ui.getClassesUris()) + System.out.println("| | Class : "+clazz); + System.out.println("| | Binary : "+ui.getBinary()); + System.out.println("| | Bundle : "+ui.getBundleUri()); + } + System.out.println("| Data URIs :"); + for(String dataUri : e.getDataUris()) + System.out.println("| | "+dataUri); + System.out.println("| Required Features :"); + for(String requiredFeature : e.getRequiredFeatures()) + System.out.println("| | "+requiredFeature); + System.out.println("| Extension Features :"); + for(String extensionData : e.getExtensionData()) + System.out.println("| | "+extensionData); + System.out.println("| Presets :"); + for(LV2Preset preset : e.getPresets()) + System.out.println("| | "+preset.getFirstTitle() + " (" + preset.getUri() + ")"); + System.out.println("| Ports :"); + for(LV2Port port : e.getPorts()) { + System.out.println("| | Port #"+port.getIndex()); + System.out.println("| | | Minimum : "+port.getMinVal()); + System.out.println("| | | Maximum : "+port.getMaxVal()); + System.out.println("| | | Défaut : "+port.getDefaultVal()); + } + } + + + + public Pointer getInBlankBuffer() { + return inBlankBuffer; + } + public Pointer getOutRandBuffer() { + return outRandBuffer; + } + + public Pointer getWorld() { + return world; + } + + public Pointer getPluginsObject() { + return pluginsObject; + } + + +} diff --git a/src/main/java/com/bernard/sboard/effects/LoadedPlugin.java b/src/main/java/com/bernard/sboard/effects/LoadedPlugin.java new file mode 100644 index 0000000..f3631eb --- /dev/null +++ b/src/main/java/com/bernard/sboard/effects/LoadedPlugin.java @@ -0,0 +1,225 @@ +package com.bernard.sboard.effects; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.log4j.Logger; +import org.bridj.BridJ; +import org.bridj.Pointer; + +import com.bernard.sboard.bridj.LibLilv; +import com.bernard.sboard.bridj.LibLilv.LilvNode; +import com.bernard.sboard.bridj.LibLilv.LilvPort; +import com.bernard.sboard.bridj.LibLilv.LilvWorld; +import com.bernard.sboard.bridj.LibLv2; +import com.bernard.sboard.bridj.LilvInstanceImpl; +import com.bernard.sboard.config.PluginConfig; +import com.bernard.sboard.osc.OscRemoteController; +import com.bernard.sboard.osc.OscUtils; +import com.bernard.sboard.osc.SOscMessage; +import com.illposed.osc.OSCMessage; + +public class LoadedPlugin { + + String uri; + + String name; + + Logger log; + + Pointer world; + + Pointer plugin; + + Pointer instance; + + public Pointer controls; + + Map controlPortsIndexes; + Set inputControlPorts; + Set outputControlPorts; + + public static Pointer lv2_ControlPort = null; + public static Pointer lv2_AudioPort = null; + public static Pointer lv2_InputPort = null; + public static Pointer lv2_OutputPort = null; + + public LoadedPlugin(EffectsBox ebox, float frequency, PluginConfig pconfig) { + this.log = ebox.log; + if(lv2_ControlPort == null) + lv2_ControlPort = LibLilv.lilv_new_uri(ebox.getWorld(), Pointer.pointerToCString(LibLv2.LV2_CORE__ControlPort)); + if(lv2_AudioPort == null) + lv2_AudioPort = LibLilv.lilv_new_uri(ebox.getWorld(), Pointer.pointerToCString(LibLv2.LV2_CORE__AudioPort)); + if(lv2_InputPort == null) + lv2_InputPort = LibLilv.lilv_new_uri(ebox.getWorld(), Pointer.pointerToCString(LibLv2.LV2_CORE__InputPort)); + if(lv2_OutputPort == null) + lv2_OutputPort = LibLilv.lilv_new_uri(ebox.getWorld(), Pointer.pointerToCString(LibLv2.LV2_CORE__OutputPort)); + log.debug("Loaded URIs"); + this.world = ebox.getWorld(); + this.name = pconfig.name; + + Pointer plugin_uri = LibLilv.lilv_new_uri(ebox.getWorld(), Pointer.pointerToCString(pconfig.uri)); + + plugin = LibLilv.lilv_plugins_get_by_uri(ebox.getPluginsObject(), plugin_uri); + log.debug("Trying to instanciated plugin"); + instance = LibLilv.lilv_plugin_instantiate(plugin, frequency, null); + log.debug("Plugin instanciated"); + + int pcount = LibLilv.lilv_plugin_get_num_ports(plugin); + controlPortsIndexes = new HashMap<>(); + inputControlPorts = new HashSet<>(); + outputControlPorts = new HashSet<>(); + controls = Pointer.allocateArray(Float.class, pcount); + Pointer maxes = Pointer.allocateArray(Float.class, pcount); + Pointer mins = Pointer.allocateArray(Float.class, pcount); + + for (int i = 0; i < pcount; i++) { + Pointer port = LibLilv.lilv_plugin_get_port_by_index(plugin, i); + String pname = LibLilv.lilv_node_as_string(LibLilv.lilv_port_get_symbol(plugin, port)).getCString(); + LibLilv.lilv_plugin_get_port_ranges_float(plugin, mins, maxes, controls); + if (LibLilv.lilv_port_is_a(plugin, port, lv2_ControlPort)) { + controlPortsIndexes.put(pname, i); + if (Float.isNaN(controls.getFloatAtIndex(i))) { + if (!Float.isNaN(mins.getFloatAtIndex(i))) + controls.setFloatAtIndex(i, mins.getFloatAtIndex(i)); + else if (!Float.isNaN(maxes.getFloatAtIndex(i))) + controls.setFloatAtIndex(i, maxes.getFloatAtIndex(i)); + else + controls.setFloatAtIndex(i, 0.0f); + } + if(LibLilv.lilv_port_is_a(plugin, port, lv2_InputPort)) { + inputControlPorts.add(pname); + } else if(LibLilv.lilv_port_is_a(plugin, port, lv2_OutputPort)) { + outputControlPorts.add(pname); + } else { + log.error("Control port is neither a input or an output port"); + } + LibLilv.lilv_instance_connect_port(instance, i, Pointer.pointerToAddress(controls.getPeer() + i*BridJ.sizeOf(Float.class), Float.class, p -> {})); + } else if (LibLilv.lilv_port_is_a(plugin, port, lv2_AudioPort)){ + if(LibLilv.lilv_port_is_a(plugin, port, lv2_InputPort)) { + log.debug("Connecting input to blank buffer"); + LibLilv.lilv_instance_connect_port(instance, i, ebox.getInBlankBuffer()); + } else if(LibLilv.lilv_port_is_a(plugin, port, lv2_OutputPort)) { + log.debug("Connecting output to rand buffer"); + LibLilv.lilv_instance_connect_port(instance, i, ebox.getOutRandBuffer()); + } else { + log.error("Audio port is neither a input or an output port"); + } + } else { + log.error("The port is neither audio nor control"); + } + } + + LibLilv.lilv_instance_activate(instance); + } + + private boolean connectPortIf(String psymbol, Pointer point, Pointer portClass) { + Pointer port = LibLilv.lilv_plugin_get_port_by_symbol( + plugin, + LibLilv.lilv_new_string(world, Pointer.pointerToCString(psymbol)) + ); + int index = LibLilv.lilv_port_get_index(plugin, port); + + if(!LibLilv.lilv_port_is_a(plugin, port, lv2_AudioPort) || !LibLilv.lilv_port_is_a(plugin, port, portClass)) + return false; + log.info("Size safe: "+point.getValidBytes()); + LibLilv.lilv_instance_connect_port(instance, index, point); + return true; + } + + public boolean connectInputPort(String psymbol, Pointer point) { + return connectPortIf(psymbol, point, lv2_InputPort); + } + public boolean connectOutputPort(String psymbol, Pointer point) { + return connectPortIf(psymbol, point, lv2_OutputPort); + } + + public void run(int sampleCount) { + LibLilv.lilv_instance_run(instance, sampleCount); + } + + public Pointer getInstance() { + return instance; + } + + Map> portListeners; + + public void receiveOscMessage(SOscMessage message) { + if(OscUtils.addrMatch(message.getContainer(3), "ports")) { + for(String p : OscUtils.allAddrMatch(message.getContainer(4), controlPortsIndexes.keySet())) { + if(OscUtils.addrMatch(message.getContainer(5), "listen")) { + // LISTEN [uid] + if(outputControlPorts.contains(p)) { + message.getServer().declareFrequentUpdate(getPortAddress(p)+"/value", () -> controls.getFloatAtIndex(controlPortsIndexes.get(p)), message.getServer().getSender((int) message.getArguments().get(0))); + } else if (inputControlPorts.contains(p)){ + portListeners.putIfAbsent(p, new HashSet<>()); + portListeners.get(p).add(message.getServer().getSender((int) message.getArguments().get(0))); + } else { + //Error + } + } + if(OscUtils.addrMatch(message.getContainer(5), "ignore")) { + // IGNORE [uid] + if(outputControlPorts.contains(p)) { + message.getServer().removeRegularListen(getPortAddress(p)+"/value", message.getServer().getSender((int) message.getArguments().get(0))); + } else if (inputControlPorts.contains(p)){ + if(portListeners.containsKey(p)) + portListeners.get(p).remove(message.getServer().getSender((int) message.getArguments().get(0))); + } else { + //Error + } + } + if(OscUtils.addrMatch(message.getContainer(5), "set")) { + // SET [newValue] + log.debug("La settagation a été effectuée"); + Float value = (Float) message.getArguments().get(0); + controls.setFloatAtIndex(controlPortsIndexes.get(p), value); + } + if(OscUtils.addrMatch(message.getContainer(5), "get")) { + // GET [uid] + OSCMessage oscm = new OSCMessage(getPortAddress(p)+"/value", List.of(controls.getFloatAtIndex(controlPortsIndexes.get(p)))); + message.getServer().getSender((int) message.getArguments().get(0)).send(oscm); + } + } + } + } + + public String getPortAddress(String portName) { + return "/effectbox/plugins/"+name+"/ports/"+portName; + } + + public void notifyOfPortUpdate(String p) { + if(portListeners.containsKey(p)) + for(OscRemoteController orc : portListeners.get(p)) { + OSCMessage oscm = new OSCMessage(getPortAddress(p)+"/value",List.of(controls.getFloatAtIndex(controlPortsIndexes.get(p)))); + orc.send(oscm); + } + } + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/bernard/sboard/lv2/LV2Plugin.java b/src/main/java/com/bernard/sboard/lv2/LV2Plugin.java new file mode 100644 index 0000000..e7dad51 --- /dev/null +++ b/src/main/java/com/bernard/sboard/lv2/LV2Plugin.java @@ -0,0 +1,175 @@ +package com.bernard.sboard.lv2; + +import static com.bernard.sboard.bridj.LibLilv.lilvNodesToList; +import static com.bernard.sboard.bridj.LibLilv.lilvUIsToList; +import static com.bernard.sboard.bridj.LibLilv.lilv_node_as_string; +import static com.bernard.sboard.bridj.LibLilv.lilv_node_as_uri; +import static com.bernard.sboard.bridj.LibLilv.lilv_node_free; +import static com.bernard.sboard.bridj.LibLilv.lilv_nodes_free; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_class_get_label; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_author_email; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_author_homepage; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_author_name; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_bundle_uri; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_class; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_data_uris; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_extension_data; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_latency_port_index; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_library_uri; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_name; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_num_ports; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_optional_features; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_port_ranges_float; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_related; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_required_features; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_get_uis; +import static com.bernard.sboard.bridj.LibLilv.lilv_plugin_has_latency; +import static com.bernard.sboard.bridj.LibLilv.lilv_uis_free; + +import java.util.ArrayList; +import java.util.List; + +import org.bridj.Pointer; + +import com.bernard.sboard.bridj.LibLilv; +import com.bernard.sboard.bridj.LibLv2; +import com.bernard.sboard.bridj.LibLilv.LilvNode; +import com.bernard.sboard.bridj.LibLilv.LilvNodes; +import com.bernard.sboard.bridj.LibLilv.LilvPlugin; +import com.bernard.sboard.bridj.LibLilv.LilvPluginClass; +import com.bernard.sboard.bridj.LibLilv.LilvUIs; +import com.bernard.sboard.bridj.LibLilv.LilvWorld; + + + +public class LV2Plugin { + + Pointer world; + Pointer p; + + public LV2Plugin(Pointer world, Pointer p) { + this.world = world; + this.p = p; + } + + public String getUri() { + return lilv_node_as_uri(LibLilv.lilv_plugin_get_uri(p)).getCString(); + } + + public String getPluginClass() { + Pointer pclass = lilv_plugin_get_class(p); + Pointer class_label = lilv_plugin_class_get_label(pclass); + if (class_label!=null && class_label.getPeer()!=0) { + return lilv_node_as_string(class_label).getCString(); + } + return null; + } + + private String stringNodeGetter(Pointer val) { + String out = null; + if (val!=null && val.getPeer()!=0) { + out = lilv_node_as_string(val).getCString(); + lilv_node_free(val); + } + return out; + } + + public String getName() { + return stringNodeGetter(lilv_plugin_get_name(p)); + } + public String getAuthorName() { + return stringNodeGetter(lilv_plugin_get_author_name(p)); + } + public String getAuthorEmail() { + return stringNodeGetter(lilv_plugin_get_author_email(p)); + } + public String getAuthorHomepage() { + return stringNodeGetter(lilv_plugin_get_author_homepage(p)); + } + + public boolean hasLatency() { + return lilv_plugin_has_latency(p); + } + public int getLatencyPort() { + if (lilv_plugin_has_latency(p)) + return lilv_plugin_get_latency_port_index(p); + else + return -1; + } + + public String getBundleUri() { + return lilv_node_as_uri(lilv_plugin_get_bundle_uri(p)).getCString(); + + } + + public String getBinaryUri() { + Pointer binary_uri = lilv_plugin_get_library_uri(p); + if (binary_uri!=null && binary_uri.getPeer()!=0) { + return lilv_node_as_uri(lilv_plugin_get_library_uri(p)).getCString(); + } + return null; + } + + public List getPluginUIs() { + Pointer uis = lilv_plugin_get_uis(p); + List out = lilvUIsToList(lilv_plugin_get_uis(p)).stream().map(n -> new LV2Ui(world, n)).toList(); + lilv_uis_free(uis); + return out; + } + + public List getDataUris() { + return lilvNodesToList(lilv_plugin_get_data_uris(p)).stream().map(LibLilv::lilv_node_as_uri).map(Pointer::getCString).toList(); + } + + public List getRequiredFeatures() { + Pointer features = lilv_plugin_get_required_features(p); + if(features!=null && features.getPeer()==0) + return null; + List out = lilvNodesToList(features).stream().map(LibLilv::lilv_node_as_uri).map(Pointer::getCString).toList(); + lilv_nodes_free(features); + return out; + } + + public Object getOptionalFeatures() { + Pointer features = lilv_plugin_get_optional_features(p); + if(features!=null && features.getPeer()==0) + return null; + List out = lilvNodesToList(features).stream().map(LibLilv::lilv_node_as_uri).map(Pointer::getCString).toList(); + lilv_nodes_free(features); + return out; + } + + public List getExtensionData() { + Pointer features = lilv_plugin_get_extension_data(p); + if(features!=null && features.getPeer()==0) + return null; + List out = lilvNodesToList(features).stream().map(LibLilv::lilv_node_as_uri).map(Pointer::getCString).toList(); + lilv_nodes_free(features); + return out; + } + + public List getPresets() { + Pointer preset_class = LibLilv.lilv_new_uri(world, Pointer.pointerToCString(LibLv2.LV2_PRESETS__Preset)); + Pointer presets = lilv_plugin_get_related(p, preset_class); + if(presets==null)return List.of(); + List out = lilvNodesToList(presets).stream().map(n -> new LV2Preset(world,n)).toList(); + System.out.println(out); + //lilv_nodes_free(presets); + return out; + } + + public List getPorts() { + int num_ports = lilv_plugin_get_num_ports(p); + Pointer mins = Pointer.allocateArray(Float.class, num_ports); + Pointer maxes = Pointer.allocateArray(Float.class, num_ports); + Pointer defaults = Pointer.allocateArray(Float.class, num_ports); + lilv_plugin_get_port_ranges_float(p, mins, maxes, defaults); + + List ports = new ArrayList<>(); + for (int i = 0; i < num_ports; ++i) { + ports.add(new LV2Port(i,mins.getFloatAtIndex(i), maxes.getFloatAtIndex(i), defaults.getFloatAtIndex(i))); + } + return ports; + } + +} diff --git a/src/main/java/com/bernard/sboard/lv2/LV2Port.java b/src/main/java/com/bernard/sboard/lv2/LV2Port.java new file mode 100644 index 0000000..cf18fd4 --- /dev/null +++ b/src/main/java/com/bernard/sboard/lv2/LV2Port.java @@ -0,0 +1,33 @@ +package com.bernard.sboard.lv2; + +public class LV2Port { + + int index; + float minVal,maxVal,defaultVal; + + public LV2Port(int index, float minVal, float maxVal, float defaultVal) { + this.index = index; + this.minVal = minVal; + this.maxVal = maxVal; + this.defaultVal = defaultVal; + } + + public int getIndex() { + return index; + } + + public float getMinVal() { + return minVal; + } + + public float getMaxVal() { + return maxVal; + } + + public float getDefaultVal() { + return defaultVal; + } + + + +} diff --git a/src/main/java/com/bernard/sboard/lv2/LV2Preset.java b/src/main/java/com/bernard/sboard/lv2/LV2Preset.java new file mode 100644 index 0000000..e6d2151 --- /dev/null +++ b/src/main/java/com/bernard/sboard/lv2/LV2Preset.java @@ -0,0 +1,46 @@ +package com.bernard.sboard.lv2; + +import org.bridj.Pointer; + +import com.bernard.sboard.bridj.LibLilv; + +import static com.bernard.sboard.bridj.LibLilv.*; + +public class LV2Preset { + + Pointer world; + Pointer preset; + + boolean loaded = false; + + public LV2Preset(Pointer world, Pointer preset) { + this.world = world; + this.preset = preset; + + System.out.println(lilv_node_is_uri(preset)); + } + + public boolean loadResource() { + if(!loaded) + if(lilv_world_load_resource(world, preset)!=0) + System.err.println("Illegal preset "+lilv_node_as_uri(preset).getCString()); + else + this.loaded = true; + return loaded; + } + + public String getFirstTitle() { + if(!loadResource())return "No Resource"; + Pointer labelUri = LibLilv.lilv_new_uri(world, Pointer.pointerToCString(LibLilv.LILV_NS_RDFS + "label")); + if(!lilv_world_ask(world, preset, labelUri, null)) + return "No Title"; + Pointer title = lilv_world_get(world,preset,labelUri,null); + return lilv_node_as_string(title).getCString(); + } + + public String getUri() { + return lilv_node_as_uri(preset).getCString(); + } + + +} diff --git a/src/main/java/com/bernard/sboard/lv2/LV2Ui.java b/src/main/java/com/bernard/sboard/lv2/LV2Ui.java new file mode 100644 index 0000000..0c95c07 --- /dev/null +++ b/src/main/java/com/bernard/sboard/lv2/LV2Ui.java @@ -0,0 +1,46 @@ +package com.bernard.sboard.lv2; + +import static com.bernard.sboard.bridj.LibLilv.lilvNodesToList; +import static com.bernard.sboard.bridj.LibLilv.lilv_node_as_uri; +import static com.bernard.sboard.bridj.LibLilv.lilv_ui_get_binary_uri; +import static com.bernard.sboard.bridj.LibLilv.lilv_ui_get_bundle_uri; +import static com.bernard.sboard.bridj.LibLilv.lilv_ui_get_classes; + +import java.util.List; + +import org.bridj.Pointer; + +import com.bernard.sboard.bridj.LibLilv; +import com.bernard.sboard.bridj.LibLilv.LilvUI; +import com.bernard.sboard.bridj.LibLilv.LilvWorld; + +public class LV2Ui { + + Pointer world; + Pointer ui; + + public LV2Ui(Pointer world, Pointer ui) { + this.world = world; + this.ui = ui; + } + + public String getUri() { + return lilv_node_as_uri(lilv_ui_get_bundle_uri(ui)).getCString(); + } + + public String getBinary() { + Pointer val = lilv_node_as_uri(lilv_ui_get_binary_uri(ui)); + if(val.getPeer()!=0) + return val.getCString(); + return null; + } + + public String getBundleUri() { + return lilv_node_as_uri(lilv_ui_get_bundle_uri(ui)).getCString(); + } + + public List getClassesUris() { + return lilvNodesToList(lilv_ui_get_classes(ui)).stream().map(LibLilv::lilv_node_as_uri).map(Pointer::getCString).toList(); + } + +} diff --git a/src/main/java/com/bernard/sboard/osc/OscRemoteController.java b/src/main/java/com/bernard/sboard/osc/OscRemoteController.java new file mode 100644 index 0000000..141b5c8 --- /dev/null +++ b/src/main/java/com/bernard/sboard/osc/OscRemoteController.java @@ -0,0 +1,39 @@ +package com.bernard.sboard.osc; + +import java.io.IOException; + +import com.illposed.osc.OSCPacket; +import com.illposed.osc.OSCSerializeException; +import com.illposed.osc.transport.OSCPortOut; + +public class OscRemoteController { + + int uid; + OSCPortOut outport; + OscServer server; + String name; + + + + public OscRemoteController(OscServer server, int uid, String name, OSCPortOut outport) { + this.uid = uid; + this.name = name; + this.outport = outport; + this.server = server; + } + + public void send(OSCPacket packet) { + try { + outport.send(packet); + } catch (IOException e) { + server.log.warn("Could not send osc packet to recipient", e); + } catch (OSCSerializeException e) { + server.log.error("Tried to send malformed osc packet", e); + } + } + + public void close() throws IOException { + outport.close(); + } + +} diff --git a/src/main/java/com/bernard/sboard/osc/OscServer.java b/src/main/java/com/bernard/sboard/osc/OscServer.java new file mode 100644 index 0000000..1ad4bb1 --- /dev/null +++ b/src/main/java/com/bernard/sboard/osc/OscServer.java @@ -0,0 +1,216 @@ +package com.bernard.sboard.osc; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.time.Instant; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.function.Supplier; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +import com.bernard.sboard.SBoard; +import com.bernard.sboard.config.OscConfig; +import com.illposed.osc.OSCBadDataEvent; +import com.illposed.osc.OSCBundle; +import com.illposed.osc.OSCMessage; +import com.illposed.osc.OSCPacket; +import com.illposed.osc.OSCPacketDispatcher; +import com.illposed.osc.OSCPacketEvent; +import com.illposed.osc.OSCPacketListener; +import com.illposed.osc.transport.OSCPortIn; +import com.illposed.osc.transport.OSCPortInBuilder; +import com.illposed.osc.transport.OSCPortOut; +import com.illposed.osc.transport.OSCPortOutBuilder; + +public class OscServer implements OSCPacketListener{ + + Logger log = LogManager.getLogger(OscServer.class); + + SBoard sboard; + + OscConfig config; + + OSCPortIn inport; + + Map controllers; + + Timer globalTimer; + + OSCPacketDispatcher opd; + + Timer oscDispacher; + Lock oscLock; + + Map>> frequentListeners; + + public OscServer(SBoard sboard, OscConfig config) { + this.sboard = sboard; + this.config = config; + this.frequentListeners = new HashMap<>(); + this.controllers = new HashMap<>(); + this.oscLock = new ReentrantLock(); + } + + public void setup() throws IOException { + + oscDispacher = new Timer(); + inport = new OSCPortInBuilder() + .setNetworkProtocol(config.networkProtocol) + .setLocalPort(config.inputport) + .setPacketListener(this) + .build(); + + inport.startListening(); + + globalTimer = new Timer(); + globalTimer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + updateFrequentListeners(); + } + }, config.frequentUpdatePeriod, config.frequentUpdatePeriod); + } + + @Override + public void handlePacket(OSCPacketEvent event) { + oscLock.lock(); + recursivePacketDispach(event.getPacket()); + oscLock.unlock(); + } + + + + @Override + public void handleBadData(OSCBadDataEvent event) { + log.warn("OSC Message not understood", event.getException()); + } + private void dispachMessageToSBoard(OSCMessage message) { + SOscMessage smessage = new SOscMessage(this, message); + log.debug("Received OSC message: "+message.getAddress()+" "+message.getArguments()); + if(OscUtils.addrMatch(smessage.getContainer(0),"sboard") && OscUtils.addrMatch(smessage.getContainer(1),"osc")) { + // Alors, le message nous est nous est destiné + if(OscUtils.addrMatch(smessage.getContainer(1), "register")) { + // REGISTER [ int int int int UUID, string Name, string IPAddr, int port ] + UUID regUUID = new UUID( + ((int)smessage.getArguments().get(0))*0xFFFFL + ((int)smessage.getArguments().get(1)), + ((int)smessage.getArguments().get(2))*0xFFFFL + ((int)smessage.getArguments().get(3))); + String name = (String)smessage.getArguments().get(4); + SocketAddress address = new InetSocketAddress((String)smessage.getArguments().get(5), (int)smessage.getArguments().get(6)); + int newuid = 0; + do { + newuid = sboard.random.nextInt(); + } while (!controllers.containsKey(newuid)); + OSCPortOut opo; + try { + opo = new OSCPortOutBuilder() + .setRemotePort((int)smessage.getArguments().get(6)) + .setRemoteSocketAddress(address) + .setNetworkProtocol(config.networkProtocol) + .build(); + OscRemoteController orc = new OscRemoteController(this, newuid, name, opo); + OSCMessage answer = new OSCMessage("/sboard/osc/registered", List.of( + (int)(regUUID.getLeastSignificantBits()>>32), + (int)(regUUID.getLeastSignificantBits()&0xFFFF), + (int)(regUUID.getMostSignificantBits()>>32), + (int)(regUUID.getMostSignificantBits()&0xFFFF), + newuid)); + controllers.put(newuid, orc); + orc.send(answer); + } catch (IOException e) { + log.error("Could not register OSC reciever", e); + } + } + } else { + sboard.dispatchOscMessage(smessage); + } + } + // Le synchronized permet de forcer les messages dans un même bundle à être executés sequentiellement. + private void recursivePacketDispach(OSCPacket packet) { + if(packet instanceof OSCMessage) { + dispachMessageToSBoard((OSCMessage)packet); + } else if (packet instanceof OSCBundle) { + OSCBundle bundle = (OSCBundle) packet; + if(!bundle.getTimestamp().isImmediate()) { + Date dispachDate = bundle.getTimestamp().toDate(Date.from(Instant.now())); + if(!dispachDate.before(Date.from(Instant.now()))) { + oscDispacher.schedule(new TimerTask() { + @Override + public void run() { + oscLock.lock(); + recursivePacketDispach(packet); + oscLock.unlock(); + } + }, dispachDate); + return; + } + } + // At this point, we should dispach the message immediatly + for(OSCPacket oscp : bundle.getPackets()) + recursivePacketDispach(oscp); + } + } + + public OscRemoteController getSender(int uid) { + return controllers.get(uid); + } + + public void close() throws IOException{ + inport.close(); + for(OscRemoteController ctrl : controllers.values()) + ctrl.close(); + } + + /* Values Listeners */ + + public void declareFrequentUpdate(String address, Supplier getter, OscRemoteController controller) { + synchronized(frequentListeners) { + frequentListeners.putIfAbsent(controller, new HashSet<>()); + frequentListeners.get(controller).add(new FrequentListener<>(address, getter, controller)); + } + } + public void removeRegularListen(String address, OscRemoteController controller) { + synchronized(frequentListeners) { + if(frequentListeners.containsKey(controller)) + frequentListeners.get(controller).removeIf(fl -> fl.address.equals(address)); + } + } + + + public void updateFrequentListeners() { + synchronized(frequentListeners) { + for(OscRemoteController ctrl : frequentListeners.keySet()) { + OSCBundle bundle = new OSCBundle(); + for(FrequentListener fl : frequentListeners.get(ctrl)) { + OSCMessage toSend = new OSCMessage(fl.address,List.of(fl.getter.get())); + bundle.addPacket(toSend); + } + ctrl.send(bundle); + } + } + } + + protected class FrequentListener { + String address; + Supplier getter; + OscRemoteController controller; + public FrequentListener(String address, Supplier getter, OscRemoteController controller) { + this.address = address; + this.getter = getter; + this.controller = controller; + } + + } + +} diff --git a/src/main/java/com/bernard/sboard/osc/OscUtils.java b/src/main/java/com/bernard/sboard/osc/OscUtils.java new file mode 100644 index 0000000..3f83034 --- /dev/null +++ b/src/main/java/com/bernard/sboard/osc/OscUtils.java @@ -0,0 +1,30 @@ +package com.bernard.sboard.osc; + +import java.util.Set; + +public class OscUtils { + + /** + * Returns true if the address part given as a parameter matches as + * an OSC address. + * + * If str is invalid (i.e. contains invalid characters) + * the output of this function should not be used. + * @param addr The address with matching characters + * @param str the string against which should the addr be matched + * @return true iff the address should match str + */ + public static boolean addrMatch(String addr, String str) { + if(str.equals(addr))return true; + //TODO: Rajouter le parse, avec les ?,*,{},[], ... + return false; + } + + public static Set allAddrMatch(String addr, Set keys) { + System.out.println(addr+"<-->"+keys); + if(keys.contains(addr))return Set.of(addr); + //TODO: Rajouter le parse, avec les ?,*,{},[], ... + return Set.of(); + } + +} diff --git a/src/main/java/com/bernard/sboard/osc/SOscMessage.java b/src/main/java/com/bernard/sboard/osc/SOscMessage.java new file mode 100644 index 0000000..1759420 --- /dev/null +++ b/src/main/java/com/bernard/sboard/osc/SOscMessage.java @@ -0,0 +1,46 @@ +package com.bernard.sboard.osc; + +import java.util.List; + +import com.illposed.osc.OSCMessage; +import com.illposed.osc.OSCMessageInfo; + +public class SOscMessage { + + OscServer server; + + OSCMessage message; + + String[] address = null; + + public SOscMessage(OscServer server, OSCMessage message) { + this.server = server; + this.message = message; + } + + public OscServer getServer() { + return server; + } + + public OSCMessage getMessage() { + return message; + } + + public String getContainer(int i) { + if(address==null) address = message.getAddress().substring(1).split("/"); + return address[i]; + } + + public String getAddress() { + return message.getAddress(); + } + + public List getArguments(){ + return message.getArguments(); + } + + public OSCMessageInfo getInfo() { + return message.getInfo(); + } + +} diff --git a/src/main/java/com/bernard/sboard/saddr/CheckableSaddr.java b/src/main/java/com/bernard/sboard/saddr/CheckableSaddr.java new file mode 100644 index 0000000..2009b92 --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/CheckableSaddr.java @@ -0,0 +1,7 @@ +package com.bernard.sboard.saddr; + +public interface CheckableSaddr extends SAddr { + + boolean check(); + +} diff --git a/src/main/java/com/bernard/sboard/saddr/ContinuousFloatSType.java b/src/main/java/com/bernard/sboard/saddr/ContinuousFloatSType.java new file mode 100644 index 0000000..4bef882 --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/ContinuousFloatSType.java @@ -0,0 +1,13 @@ +package com.bernard.sboard.saddr; + +public class ContinuousFloatSType implements SType{ + + float minValue, maxValue; + boolean enforceValues; + + @Override + public boolean validate(Float o) { + return !enforceValues || (minValue < o && o < maxValue); + } + +} diff --git a/src/main/java/com/bernard/sboard/saddr/PointerSAddr.java b/src/main/java/com/bernard/sboard/saddr/PointerSAddr.java new file mode 100644 index 0000000..33d787c --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/PointerSAddr.java @@ -0,0 +1,38 @@ +package com.bernard.sboard.saddr; + +import java.util.EnumSet; + +import org.bridj.Pointer; + +public abstract class PointerSAddr implements SAddr, ReadableSAddr, WritableSAddr{ + + String address; + Pointer pointer; + + @Override + public boolean check() { + return pointer!=Pointer.NULL;// Il n'y a aucun moyen de savoir si un pointeur a été free + } + + @Override + public boolean setValue(T value) { + pointer.set(value); + return true; // If something has gone wrong, the program will segfault + } + + @Override + public T getValue() { + return pointer.get(); + } + + @Override + public String getAddress() { + return address; + } + + @Override + public EnumSet getCapabilities() { + return EnumSet.of(Capability.CHECK, Capability.READ, Capability.WRITE); + } + +} diff --git a/src/main/java/com/bernard/sboard/saddr/ReadableSAddr.java b/src/main/java/com/bernard/sboard/saddr/ReadableSAddr.java new file mode 100644 index 0000000..7ac23fe --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/ReadableSAddr.java @@ -0,0 +1,7 @@ +package com.bernard.sboard.saddr; + +public interface ReadableSAddr extends CheckableSaddr { + + T getValue(); + +} diff --git a/src/main/java/com/bernard/sboard/saddr/SAddr.java b/src/main/java/com/bernard/sboard/saddr/SAddr.java new file mode 100644 index 0000000..a23bc5c --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/SAddr.java @@ -0,0 +1,18 @@ +package com.bernard.sboard.saddr; + +import java.util.EnumSet; + +public interface SAddr { + + String getAddress(); + + SType getType(); + + EnumSet getCapabilities(); + + public static enum Capability{ + READ, // We can request to read the value + WRITE, // We can request to set the value + CHECK; // We can request to check if this address contains any data + } +} diff --git a/src/main/java/com/bernard/sboard/saddr/SType.java b/src/main/java/com/bernard/sboard/saddr/SType.java new file mode 100644 index 0000000..16b0a8c --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/SType.java @@ -0,0 +1,13 @@ +package com.bernard.sboard.saddr; + +public interface SType { + + /** + * Checks wether the object is valid for this type, i.e. it checks all the constrains + * + * @param o The object to check + * @return true iff the object is valid + */ + boolean validate(T o); + +} diff --git a/src/main/java/com/bernard/sboard/saddr/SwitchFloatSType.java b/src/main/java/com/bernard/sboard/saddr/SwitchFloatSType.java new file mode 100644 index 0000000..ad96db7 --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/SwitchFloatSType.java @@ -0,0 +1,13 @@ +package com.bernard.sboard.saddr; + +public class SwitchFloatSType implements SType{ + + float valueOn = 1.0f; + float valueOff = 0.0f; + + @Override + public boolean validate(Float o) { + return o == valueOn || o == valueOff; + } + +} diff --git a/src/main/java/com/bernard/sboard/saddr/WritableSAddr.java b/src/main/java/com/bernard/sboard/saddr/WritableSAddr.java new file mode 100644 index 0000000..d7a54be --- /dev/null +++ b/src/main/java/com/bernard/sboard/saddr/WritableSAddr.java @@ -0,0 +1,7 @@ +package com.bernard.sboard.saddr; + +public interface WritableSAddr extends SAddr { + + boolean setValue(T value); + +} diff --git a/src/test/java/com/bernard/sboard/AppTest.java b/src/test/java/com/bernard/sboard/AppTest.java new file mode 100644 index 0000000..fda028f --- /dev/null +++ b/src/test/java/com/bernard/sboard/AppTest.java @@ -0,0 +1,13 @@ +/* + * This Java source file was generated by the Gradle 'init' task. + */ +package com.bernard.sboard; + +import org.junit.Test; +import static org.junit.Assert.*; + +public class AppTest { + @Test public void appHasAGreeting() { + assertNotNull("app should have a greeting", true); + } +}