diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2018-01-07 11:15:29 +0100 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2018-01-13 12:22:10 +0100 |
commit | 41662fd6994a0144fa9672a1dfadb639fd47983d (patch) | |
tree | 51a60b33ee0135a29b18dbb2b8656b608be2f0b0 /lib | |
parent | 9b5c14195a92fd1085ee7c0175466f085e806efc (diff) |
Upgrade Vamp plugin SDK from version 2.6 to 2.7.1
Diffstat (limited to 'lib')
29 files changed, 2416 insertions, 486 deletions
diff --git a/lib/vamp/CHANGELOG b/lib/vamp/CHANGELOG new file mode 100644 index 0000000000..ba3617e077 --- /dev/null +++ b/lib/vamp/CHANGELOG @@ -0,0 +1,132 @@ + +Version 2.7.1, 2017-03-06 (maintenance release) + + * Fix inclusion mechanism for FFTs which could cause a host + application to crash in certain circumstances due to + conflicting versions of C-linkage symbols + +Version 2.7, 2017-02-24 (maintenance and minor feature release) + + * Add ability to PluginLoader to list plugins only in (or not in) + certain library files + * Fix fixed-sample-rate output timestamps in printout from the + simple host, and add regression test script using test plugin + * Switch the convenience FFT interface for plugin usage from the + very slow reference implementation previously provided, to the + somewhat faster KissFFT + * Add a top-secret compiler flag to switch internal FFTs to single- + precision only + * Fix some small but long-standing memory leaks and minor bugs + +Version 2.6, 2015-06-16 (maintenance and minor feature release) + + * Add a simple C-linkage API for plugin library discovery and + loading -- the missing part when trying to use Vamp plugins from C + or a language with only C-linkage foreign-function interface + * Fix bug in PluginBufferingAdapter reset() function, which failed + to reset timestamp rewrites (symptom: timestamps appeared to + continue to ascend from end point on next run after a reset) + * Fix sometime 1-sample rounding error in PluginInputDomainAdapter + * Update build files for more recent OS versions + * Add -L option to simple host, as synonym for --list-full + * Add a combined Visual C++ solution that includes the plugin SDK, + host SDK, example plugins, and simple host projects + +Version 2.5, 2013-05-08 (maintenance release): + + * Fix incorrect handling of FixedSampleRate outputs in the + PluginBufferingAdapter. Un-timestamped features on these outputs + were incorrectly being timestamped from the process timestamp, + where they should have been timed relative to the previous + feature on the output according to the output's sample rate. + * Fix return of uninitialised memory through getCurrentProgram + when plugin specifies no programs + * Ensure output sample rate is initialised (to 0) for variable-rate + outputs where the plugin forgets to set a rate + +Version 2.4, 2012-07-12 (maintenance and minor feature release): + + * Provide a simple FFT implementation as a convenience for plugins + * Add symbols to make the library versions discoverable by autoconf + using C linkage + * Fix failure to open plugins from Unicode builds on Windows (thanks + RJ Ryan) + * Fix thread-safety issue in PluginInputDomainAdapter + * Add build for OS/X 10.7+/Xcode 4; remove build for OpenSolaris + +Version 2.3, 2011-09-28 (minor feature release): + + * Add window type property to PluginInputDomainAdapter + * Permit vamp-simple-host to use streaming input with indeterminate + length (thanks Dan Stowell) + * Print label as well as values from vamp-simple-host (thanks Dan) + +Version 2.2.1, 2011-04-05 (maintenance release): + + * Minor build fixes for OS/X + +Version 2.2, 2010-08-26 (maintenance release): + + * Fixes to OS/X build procedures so as to build three-way + universal binaries (PPC, i386, x86_64) by default. Forced upon + us by OS/X 10.6 defaulting to 64-bit rather than 32-bit + +Version 2.1, 2009-09-22 (maintenance and minor feature release): + + * Add ProcessTimestampMethod to PluginInputDomainAdapter, offering + the ability to decide how data buffering and timestamping works for + frequency-domain plugins (whose process timestamps have to be at + the centre of each processing block rather than the start) + * Make PluginBufferingAdapter take into account any timestamp shift + introduced by a PluginInputDomainAdapter that it wraps + * Fix crash in PluginAdapter when plugin library getDescriptor fails + on plugin construction + * Add plugin skeleton files as starting point for new developers + +Version 2.0, 2008-12-08 (major release): + + * Feature structure now has an optional duration (plugin API change) + * Libraries reorganised into separate include and src directories for + plugin and host SDKs; hosts should no longer include from vamp-sdk/ + but always from vamp-hostsdk/ instead (host source compatibility change) + * OutputDescriptor now declares whether its features will have duration + * Vamp RDF ontology now included for providing online (out-of-plugin) + descriptions of plugins; program to generate skeleton RDF for a plugin + set is included, and RDF for example plugins provided + * New PluginSummarisingAdapter providing averages, min/max, count etc + of returned features on request + * New example plugins: Fixed Tempo Estimator and Power Spectrum + * Command-line host now has a complete listing option, to print out + all data reported by plugins + * More complete Visual Studio project support + +Version 1.3, 2008-07-09 (maintenance release): + + * PluginBufferingAdapter has several important fixes to bugs that + could cause incorrect timings or output descriptors to be returned + * Conversion between real-time and frames has been improved to avoid + rounding error in round-trip calculations + * Plugin lookup no longer relies on non-portable DT_REG + * The SDK now compiles with gcc 4.3 + +Version 1.2, 2008-02-28 (feature release): + + * New PluginBufferingAdapter, which hosts may use to avoid having to + negotiate the plugin's preferred input step and block sizes + +Version 1.1, 2007-08-24 (feature release): + + * New Vamp::HostExt namespace + * PluginLoader class, which handles enumeration, loading and category + management for plugins on the local system + * PluginInputDomainAdapter, which provides the capability for a host + to support frequency-domain plugins without needing to worry about + domain conversion + * PluginChannelAdapter, which transparently deals with plugins that + expect different numbers of audio channels from the number available + * Minor beauty-and-truth updates and documentation fixes + +Version 1.0, 2007-03-21: + + * First official release + diff --git a/lib/vamp/COPYING b/lib/vamp/COPYING new file mode 100644 index 0000000000..13262ac6d1 --- /dev/null +++ b/lib/vamp/COPYING @@ -0,0 +1,65 @@ + + Vamp Plugin SDK + Copyright (c) 2005-2006 Chris Cannam + Copyright (c) 2006-2017 Queen Mary, University of London + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the names of the Centre for + Digital Music; Queen Mary, University of London; and Chris Cannam + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in this Software without prior written + authorization. + +The KissFFT code in src/vamp-sdk/ext is distributed under the following licence: + + Copyright (c) 2003-2010 Mark Borgerding + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the author nor the names of any contributors may be used + to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. diff --git a/lib/vamp/README b/lib/vamp/README new file mode 100644 index 0000000000..c4fe9b36a9 --- /dev/null +++ b/lib/vamp/README @@ -0,0 +1,265 @@ + +Vamp +==== + +An API for audio analysis and feature extraction plugins. + + http://www.vamp-plugins.org/ + +Vamp is an API for C and C++ plugins that process sampled audio data +to produce descriptive output (measurements or semantic observations). + +This is version 2.7.1 of the Vamp plugin Software Development Kit. + +Plugins and hosts built with this SDK are binary compatible with those +built using any version 2.0 or newer of the SDK. + +Plugins and hosts built with this SDK are binary compatible with those +built using version 1.0 of the SDK, with certain restrictions. See +the file README.compat for more details. + +See the file CHANGELOG for a list of the changes in this release. + +A documentation guide to writing plugins using the Vamp SDK can be +found at http://www.vamp-plugins.org/guide.pdf . + + +Compiling and Installing the SDK and Examples +============================================= + +This SDK is intended for use on Windows, OS/X, Linux, and other POSIX +and GNU platforms. + +Please see the platform-specific README file (README.msvc, README.osx, +README.linux) in the build/ directory for details about how to compile +and install the SDK, how to build plugin libraries using it, and how +to install the example plugins so you can use them in a host. + + +What's In This SDK +================== + +This SDK contains the following: + + +vamp/vamp.h +----------- + +The formal C language plugin API for Vamp plugins. + +A Vamp plugin is a dynamic library (.so, .dll or .dylib depending on +platform) exposing one C-linkage entry point (vampGetPluginDescriptor) +which returns data defined in the rest of this C header. + +Although the C API is the official API for Vamp, we don't recommend +that you program directly to it. The C++ abstractions found in the +vamp-sdk and vamp-hostsdk directories (below) are preferable for most +purposes and are more thoroughly documented. + + +vamp-sdk +-------- + +C++ classes for implementing Vamp plugins. + +Plugins should subclass Vamp::Plugin and then use Vamp::PluginAdapter +to expose the correct C API for the plugin. Plugin authors should +read vamp-sdk/PluginBase.h and Plugin.h for code documentation. + +See "examples" below for details of the example plugins in the SDK, +from which you are welcome to take code and inspiration. + +Plugins should link with -lvamp-sdk. + + +vamp-hostsdk +------------ + +C++ classes for implementing Vamp hosts. + +Hosts will normally use a Vamp::PluginHostAdapter to convert each +plugin's exposed C API back into a useful Vamp::Plugin C++ object. + +The Vamp::HostExt namespace contains several additional C++ classes to +do this work for them, and make the host's life easier: + + - Vamp::HostExt::PluginLoader provides a very easy interface for a + host to discover, load, and find out category information about the + available plugins. Most Vamp hosts will probably want to use this + class. + + - Vamp::HostExt::PluginInputDomainAdapter provides a simple means for + hosts to handle plugins that want frequency-domain input, without + having to convert the input themselves. + + - Vamp::HostExt::PluginChannelAdapter provides a simple means for + hosts to use plugins that do not necessarily support the same number + of audio channels as they have available, without having to apply a + channel management / mixdown policy themselves. + + - Vamp::HostExt::PluginBufferingAdapter provides a means for hosts to + avoid having to negotiate the input step and block size, instead + permitting the host to use any block size they desire (and a step + size equal to it). This is particularly useful for "streaming" hosts + that cannot seek backwards in the input audio stream and so would + otherwise need to implement an additional buffer to support step + sizes smaller than the block size. + + - Vamp::HostExt::PluginSummarisingAdapter provides summarisation + methods such as mean and median averages of output features, for use + in any context where an available plugin produces individual values + but the result that is actually needed is some sort of aggregate. + +The PluginLoader class can also use the input domain, channel, and +buffering adapters automatically to make these conversions transparent +to the host if required. + +Host authors should also refer to the example host code in the host +directory of the SDK. + +Hosts should link with -lvamp-hostsdk. + + +vamp-hostsdk/host-c.h +--------------------- + +A C-linkage header wrapping the part of the C++ SDK code that handles +plugin discovery and library loading. Host programs written in C or in +a language with a C-linkage foreign function interface may choose to +use this header to discover and load plugin libraries, together with +the vamp/vamp.h formal API to interact with plugins themselves. See +the header for more documentation. + + +examples +-------- + +Example plugins implemented using the C++ classes. + +These plugins are intended to be useful examples you can draw code +from in order to provide the basic shape and structure of a Vamp +plugin. They are also intended to be correct and useful, if simple. + + - ZeroCrossing calculates the positions and density of zero-crossing + points in an audio waveform. + + - SpectralCentroid calculates the centre of gravity of the frequency + domain representation of each block of audio. + + - PowerSpectrum calculates a power spectrum from the input audio. + Actually, it doesn't do any work except calculating power from a + cartesian complex FFT output. The work of calculating this frequency + domain output is done for it by the host or host SDK; the plugin just + needs to declare that it wants frequency domain input. This is the + simplest of the example plugins. + + - AmplitudeFollower is a simple implementation of SuperCollider's + amplitude-follower algorithm. + + - PercussionOnsetDetector estimates the locations of percussive + onsets using a simple method described in "Drum Source Separation + using Percussive Feature Detection and Spectral Modulation" by Dan + Barry, Derry Fitzgerald, Eugene Coyle and Bob Lawlor, ISSC 2005. + + - FixedTempoEstimator calculates a single beats-per-minute value + which is an estimate of the tempo of a piece of music that is assumed + to be of fixed tempo, using autocorrelation of a frequency domain + energy rise metric. It has several outputs that return intermediate + results used in the calculation, and may be a useful example of a + plugin having several outputs with varying feature structures. + + +skeleton +-------- + +Skeleton code that could be used as a template for your new plugin +implementation. + + +host +---- + +A simple command-line Vamp host, capable of loading a plugin and using +it to process a complete audio file, with its default parameters. + +This host also contains a number of options for listing the installed +plugins and their properties in various formats. For that reason, it +isn't really as simple as one might hope. The core of the code is +still reasonably straightforward, however. + + +Plugin Lookup and Categorisation +================================ + +The Vamp API does not officially specify how to load plugin libraries +or where to find them. However, the SDK does include a function +(Vamp::PluginHostAdapter::getPluginPath()) that returns a recommended +directory search path that hosts may use for plugin libraries, and a +class (Vamp::HostExt::PluginLoader) that implements a sensible +cross-platform lookup policy using this path. We recommend using this +class in your host unless you have a good reason not to want to. This +implementation also permits the user to set the environment variable +VAMP_PATH to override the default path if desired. + +The policy used by Vamp::HostExt::PluginLoader -- and our +recommendation for any host -- is to search each directory in the path +returned by getPluginPath for .DLL (on Windows), .so (on Linux, +Solaris, BSD etc) or .dylib (on OS/X) files, then to load each one and +perform a dynamic name lookup on the vampGetPluginDescriptor function +to enumerate the plugins in the library. This operation will +necessarily be system-dependent. + +Vamp also has an informal convention for sorting plugins into +functional categories. In addition to the library file itself, a +plugin library may install a category file with the same name as the +library but .cat extension. The existence and format of this file are +not specified by the Vamp API, but by convention the file may contain +lines of the format + +vamp:pluginlibrary:pluginname::General Category > Specific Category + +which a host may read and use to assign plugins a location within a +category tree for display to the user. The expectation is that +advanced users may also choose to set up their own preferred category +trees, which is why this information is not queried as part of the +Vamp plugin's API itself. The Vamp::HostExt::PluginLoader class also +provides support for plugin category lookup using this scheme. + + +Licensing +========= + +This plugin SDK is freely redistributable under a "new-style BSD" +licence. See the file COPYING for more details. In short, you may +modify and redistribute the SDK and example plugins within any +commercial or non-commercial, proprietary or open-source plugin or +application under almost any conditions, with no obligation to provide +source code, provided you retain the original copyright note. + + +See Also +======== + +Sonic Visualiser, an interactive open-source graphical audio +inspection, analysis and visualisation tool supporting Vamp plugins. +http://www.sonicvisualiser.org/ + + +Authors +======= + +Vamp and the Vamp SDK were designed and made at the Centre for Digital +Music at Queen Mary, University of London. + +The SDK was written by Chris Cannam, copyright (c) 2005-2017 +Chris Cannam and QMUL. + +The SDK incorporates KissFFT code, copyright (c) 2003-2010 Mark +Borgerding. + +Mark Sandler and Christian Landone provided ideas and direction, and +Mark Levy, Dan Stowell, Martin Gasser and Craig Sapp provided testing +and other input for the 1.0 API and SDK. The API also uses some ideas +from prior plugin systems, notably DSSI (http://dssi.sourceforge.net) +and FEAPI (http://feapi.sourceforge.net). + diff --git a/lib/vamp/src/vamp-hostsdk/Files.cpp b/lib/vamp/src/vamp-hostsdk/Files.cpp index 8a04dab893..fd80ba930f 100644 --- a/lib/vamp/src/vamp-hostsdk/Files.cpp +++ b/lib/vamp/src/vamp-hostsdk/Files.cpp @@ -66,18 +66,26 @@ using namespace std; vector<string> Files::listLibraryFiles() { - return listLibraryFilesMatching(""); + return listLibraryFilesMatching(Filter()); } vector<string> -Files::listLibraryFilesMatching(string libraryName) +Files::listLibraryFilesMatching(Filter filter) { vector<string> path = Vamp::PluginHostAdapter::getPluginPath(); vector<string> libraryFiles; - // we match case-insensitively - for (size_t i = 0; i < libraryName.length(); ++i) { - libraryName[i] = tolower(libraryName[i]); + // we match case-insensitively, but only with ascii range + // characters (input strings are expected to be utf-8) + vector<string> libraryNames; + for (int j = 0; j < int(filter.libraryNames.size()); ++j) { + string n = filter.libraryNames[j]; + for (size_t i = 0; i < n.length(); ++i) { + if (!(n[i] & 0x80)) { + n[i] = char(tolower(n[i])); + } + } + libraryNames.push_back(n); } for (size_t i = 0; i < path.size(); ++i) { @@ -86,23 +94,53 @@ Files::listLibraryFilesMatching(string libraryName) for (vector<string>::iterator fi = files.begin(); fi != files.end(); ++fi) { + + // we match case-insensitively, but only with ascii range + // characters (this string is expected to be utf-8) + string cleaned = *fi; + for (size_t j = 0; j < cleaned.length(); ++j) { + if (!(cleaned[j] & 0x80)) { + cleaned[j] = char(tolower(cleaned[j])); + } + } + + // libraryName should be lacking an extension, as it is + // supposed to have come from the plugin key + string::size_type pi = cleaned.find('.'); + if (pi != string::npos) { + cleaned = cleaned.substr(0, pi); + } - if (libraryName != "") { - // we match case-insensitively - string temp = *fi; - for (size_t i = 0; i < temp.length(); ++i) { - temp[i] = tolower(temp[i]); + bool matched = false; + + switch (filter.type) { + + case Filter::All: + matched = true; + break; + + case Filter::Matching: + for (int j = 0; j < int(libraryNames.size()); ++j) { + if (cleaned == libraryNames[j]) { + matched = true; + break; + } } - // libraryName should be lacking an extension, as it - // is supposed to have come from the plugin key - string::size_type pi = temp.find('.'); - if (pi == string::npos) { - if (libraryName != temp) continue; - } else { - if (libraryName != temp.substr(0, pi)) continue; + break; + + case Filter::NotMatching: + matched = true; + for (int j = 0; j < int(libraryNames.size()); ++j) { + if (cleaned == libraryNames[j]) { + matched = false; + break; + } } + break; } + if (!matched) continue; + string fullPath = path[i]; fullPath = splicePath(fullPath, *fi); libraryFiles.push_back(fullPath); @@ -118,15 +156,15 @@ Files::loadLibrary(string path) void *handle = 0; #ifdef _WIN32 #ifdef UNICODE - int len = path.length() + 1; // cannot be more wchars than length in bytes of utf8 string - wchar_t *buffer = new wchar_t[len]; - int rv = MultiByteToWideChar(CP_UTF8, 0, path.c_str(), len, buffer, len); - if (rv <= 0) { + int wlen = MultiByteToWideChar(CP_UTF8, 0, path.c_str(), path.length(), 0, 0); + if (wlen < 0) { cerr << "Vamp::HostExt: Unable to convert library path \"" << path << "\" to wide characters " << endl; - delete[] buffer; return handle; } + wchar_t *buffer = new wchar_t[wlen+1]; + (void)MultiByteToWideChar(CP_UTF8, 0, path.c_str(), path.length(), buffer, wlen); + buffer[wlen] = L'\0'; handle = LoadLibrary(buffer); delete[] buffer; #else @@ -182,8 +220,12 @@ Files::lcBasename(string path) li = basename.find('.'); if (li != string::npos) basename = basename.substr(0, li); + // case-insensitive, but only with ascii range characters (this + // string is expected to be utf-8) for (size_t i = 0; i < basename.length(); ++i) { - basename[i] = tolower(basename[i]); + if (!(basename[i] & 0x80)) { + basename[i] = char(tolower(basename[i])); + } } return basename; @@ -207,15 +249,15 @@ Files::listFiles(string dir, string extension) #ifdef _WIN32 string expression = dir + "\\*." + extension; #ifdef UNICODE - int len = expression.length() + 1; // cannot be more wchars than length in bytes of utf8 string - wchar_t *buffer = new wchar_t[len]; - int rv = MultiByteToWideChar(CP_UTF8, 0, expression.c_str(), len, buffer, len); - if (rv <= 0) { + int wlen = MultiByteToWideChar(CP_UTF8, 0, expression.c_str(), expression.length(), 0, 0); + if (wlen < 0) { cerr << "Vamp::HostExt: Unable to convert wildcard path \"" << expression << "\" to wide characters" << endl; - delete[] buffer; return files; } + wchar_t *buffer = new wchar_t[wlen+1]; + (void)MultiByteToWideChar(CP_UTF8, 0, expression.c_str(), expression.length(), buffer, wlen); + buffer[wlen] = L'\0'; WIN32_FIND_DATA data; HANDLE fh = FindFirstFile(buffer, &data); if (fh == INVALID_HANDLE_VALUE) { @@ -226,11 +268,16 @@ Files::listFiles(string dir, string extension) bool ok = true; while (ok) { wchar_t *fn = data.cFileName; - int wlen = wcslen(fn) + 1; - int maxlen = wlen * 6; - char *conv = new char[maxlen]; - int rv = WideCharToMultiByte(CP_UTF8, 0, fn, wlen, conv, maxlen, 0, 0); - if (rv > 0) { + int wlen = wcslen(fn); + int len = WideCharToMultiByte(CP_UTF8, 0, fn, wlen, 0, 0, 0, 0); + if (len < 0) { + cerr << "Vamp::HostExt: Unable to convert wide char filename to utf-8" << endl; + break; + } + char *conv = new char[len+1]; + (void)WideCharToMultiByte(CP_UTF8, 0, fn, wlen, conv, len, 0, 0); + conv[len] = '\0'; + if (len > 0) { files.push_back(conv); } delete[] conv; diff --git a/lib/vamp/src/vamp-hostsdk/Files.h b/lib/vamp/src/vamp-hostsdk/Files.h index 6e3fd37fe3..9a4ba07da8 100644 --- a/lib/vamp/src/vamp-hostsdk/Files.h +++ b/lib/vamp/src/vamp-hostsdk/Files.h @@ -47,7 +47,13 @@ class Files { public: static std::vector<std::string> listLibraryFiles(); - static std::vector<std::string> listLibraryFilesMatching(std::string libname); + + struct Filter { + enum { All, Matching, NotMatching } type; + std::vector<std::string> libraryNames; + Filter() : type(All) { } + }; + static std::vector<std::string> listLibraryFilesMatching(Filter); static void *loadLibrary(std::string filename); static void unloadLibrary(void *); diff --git a/lib/vamp/src/vamp-hostsdk/PluginBufferingAdapter.cpp b/lib/vamp/src/vamp-hostsdk/PluginBufferingAdapter.cpp index a8747435cb..7bc93796fb 100644 --- a/lib/vamp/src/vamp-hostsdk/PluginBufferingAdapter.cpp +++ b/lib/vamp/src/vamp-hostsdk/PluginBufferingAdapter.cpp @@ -41,6 +41,10 @@ #include <vamp-hostsdk/PluginBufferingAdapter.h> #include <vamp-hostsdk/PluginInputDomainAdapter.h> +#include <iostream> +using std::cerr; +using std::endl; + using std::vector; using std::map; @@ -477,7 +481,7 @@ PluginBufferingAdapter::Impl::initialise(size_t channels, size_t stepSize, size_ m_buffers = new float *[m_channels]; for (size_t i = 0; i < m_channels; ++i) { - m_queue.push_back(new RingBuffer(m_blockSize + m_inputBlockSize)); + m_queue.push_back(new RingBuffer(int(m_blockSize + m_inputBlockSize))); m_buffers[i] = new float[m_blockSize]; } @@ -506,19 +510,19 @@ PluginBufferingAdapter::Impl::getOutputDescriptors() const PluginBufferingAdapter::OutputList outs = m_outputs; - for (size_t i = 0; i < outs.size(); ++i) { + for (int i = 0; i < int(outs.size()); ++i) { switch (outs[i].sampleType) { case OutputDescriptor::OneSamplePerStep: outs[i].sampleType = OutputDescriptor::FixedSampleRate; - outs[i].sampleRate = (1.f / m_inputSampleRate) * m_stepSize; + outs[i].sampleRate = m_inputSampleRate / float(m_stepSize); m_rewriteOutputTimes[i] = true; break; case OutputDescriptor::FixedSampleRate: if (outs[i].sampleRate == 0.f) { - outs[i].sampleRate = (1.f / m_inputSampleRate) * m_stepSize; + outs[i].sampleRate = m_inputSampleRate / float(m_stepSize); } // We actually only need to rewrite output times for // features that don't have timestamps already, but we @@ -591,7 +595,7 @@ PluginBufferingAdapter::Impl::process(const float *const *inputBuffers, // queue the new input for (size_t i = 0; i < m_channels; ++i) { - int written = m_queue[i]->write(inputBuffers[i], m_inputB |