Mercurial > hg > may
changeset 77:6e11a36c335a
Toward using Vamp RDF data in Vamp module. Some type problems at the moment
author | Chris Cannam |
---|---|
date | Mon, 04 Mar 2013 12:28:19 +0000 |
parents | ca74e2917a3a |
children | 49563d091790 |
files | vamp.yeti vamprdf.yeti |
diffstat | 2 files changed, 48 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/vamp.yeti Thu Feb 28 22:25:32 2013 +0000 +++ b/vamp.yeti Mon Mar 04 12:28:19 2013 +0000 @@ -13,6 +13,9 @@ block = load block; fr = load framer; af = load audiofile; +vamprdf = load vamprdf; + +store = load yertle.store; realTime r is ~RealTime -> number = r#sec() + (r#nsec() / 1000000000); @@ -42,6 +45,18 @@ for kk do k: s[numberOf k] := featureList fs#get(k) done; s); +standardStore = store.newRdfStore (); +var standardStoreLoaded = false; + +getStandardStore () = + (synchronized standardStore do: + if not standardStoreLoaded then + vamprdf.loadSystemVampRdf standardStore; + standardStoreLoaded := true + fi; + standardStore + done); + getPluginPath () = (try map string PluginLoader#getInstance()#getPluginPath(); @@ -113,7 +128,7 @@ Unknown (); fi; -outputDescriptor od is ~OutputDescriptor -> 'a = { +outputDescriptor rdfData od is 'a -> ~OutputDescriptor -> 'b = { identifier = od#identifier, name = od#name, description = od#description, @@ -125,10 +140,13 @@ sampleType = sampleType od#sampleType, sampleRate = od#sampleRate, hasDuration = od#hasDuration, + computes = case rdfData of Some data: data.computes; None (): Unknown () esac, get inferredStructure () = structureOf od, }; -plugin key p is string -> ~Plugin -> 'a = { +plugin key p is string -> ~Plugin -> 'a = + (rdfData = vamprdf.pluginDataByKey (getStandardStore ()) key; + { plugin = p, key, get apiVersion () = p#getVampApiVersion(), @@ -139,6 +157,7 @@ get copyright () = p#getCopyright(), get version () = p#getPluginVersion(), get category () = PluginLoader#getInstance()#getPluginCategory(key), + get infoURL () = case rdfData of Some data: data.infoURL; None (): "" esac, get parameters () = array (map parameterDescriptor p#getParameterDescriptors()), parameter identifier = p#getParameter(identifier), setParameter identifier value = p#setParameter(identifier, value), @@ -152,12 +171,12 @@ get maxChannelCount () = p#getMaxChannelCount(), initialise { channels, blocksize, hop } = p#initialise(channels, hop, blocksize), reset () = p#reset(), - get outputs () = array (map outputDescriptor p#getOutputDescriptors()), + get outputs () = array (map (outputDescriptor rdfData) p#getOutputDescriptors()), process blocks time is 'a -> ~RealTime -> 'b = featureSet p#process((map block.floats blocks) as ~float[][], 0, time), getRemainingFeatures () = featureSet p#getRemainingFeatures(), dispose () = p#dispose(), - }; + }); featuresFromSet outputNo f = if outputNo in f then f[outputNo] else [] fi;
--- a/vamprdf.yeti Thu Feb 28 22:25:32 2013 +0000 +++ b/vamprdf.yeti Mon Mar 04 12:28:19 2013 +0000 @@ -1,13 +1,20 @@ module vamprdf; -vamp = load vamp; - read = load yertle.read; { newRdfStore } = load yertle.store; import java.io: File; +import org.vamp_plugins: PluginLoader; + +import java.lang: UnsatisfiedLinkError; + +getPluginPath () = + (try map string PluginLoader#getInstance()#getPluginPath(); + catch UnsatisfiedLinkError e: []; + yrt); + systemVampRdfFiles () = concat (map do p: @@ -19,7 +26,7 @@ (strEnds? lc ".n3") or (strEnds? lc ".nt")) done (listDirectory false p)) - done (vamp.pluginPath)); + done (getPluginPath ())); addVampPrefixes store = (store.addPrefix "vamp" "http://purl.org/ontology/vamp/"; @@ -67,7 +74,12 @@ subjects = map (.s); -iriTypes = map do t: case t of IRI iri: IRI iri; Blank n: Blank n esac done; +iriTypes = + map do t: + case t of + IRI iri: IRI iri; + Blank n: Blank n; + esac done; iriSubjects = iriTypes . subjects; @@ -208,7 +220,7 @@ //!!! and some other properties }); -pluginData store pluginNode = +pluginDataByNode store pluginNode = (tprop abbr = textProperty store pluginNode abbr; nprop abbr = try number (textProperty store pluginNode abbr); catch Exception _: 0 yrt; @@ -263,12 +275,19 @@ done matches)), }); +pluginDataByKey store key = + case pluginNodesByKey store key of + node::others: Some (pluginDataByNode store node); + _: None () + esac; + { loadSystemVampRdf, loadGlobalVampRdf, allPluginNodes, allLibraryNodes, pluginNodesByKey, -pluginData, +pluginDataByNode, +pluginDataByKey, }