cannam@1: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@1: cannam@1: /* cannam@1: Vamp cannam@1: cannam@1: An API for audio analysis and feature extraction plugins. cannam@1: cannam@1: Centre for Digital Music, Queen Mary, University of London. cannam@1: Copyright 2006 Chris Cannam. cannam@1: cannam@1: Permission is hereby granted, free of charge, to any person cannam@1: obtaining a copy of this software and associated documentation cannam@1: files (the "Software"), to deal in the Software without cannam@1: restriction, including without limitation the rights to use, copy, cannam@1: modify, merge, publish, distribute, sublicense, and/or sell copies cannam@1: of the Software, and to permit persons to whom the Software is cannam@1: furnished to do so, subject to the following conditions: cannam@1: cannam@1: The above copyright notice and this permission notice shall be cannam@1: included in all copies or substantial portions of the Software. cannam@1: cannam@1: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, cannam@1: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF cannam@1: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND cannam@6: NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR cannam@1: ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF cannam@1: CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION cannam@1: WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cannam@1: cannam@1: Except as contained in this notice, the names of the Centre for cannam@1: Digital Music; Queen Mary, University of London; and Chris Cannam cannam@1: shall not be used in advertising or otherwise to promote the sale, cannam@1: use or other dealings in this Software without prior written cannam@1: authorization. cannam@1: */ cannam@1: cannam@5: #ifndef _VAMP_PLUGIN_HOST_ADAPTER_H_ cannam@5: #define _VAMP_PLUGIN_HOST_ADAPTER_H_ cannam@1: cannam@10: #include cannam@64: #include cannam@1: cannam@32: #include cannam@32: cannam@1: namespace Vamp { cannam@1: cannam@53: /** cannam@53: * PluginHostAdapter is a wrapper class that a Vamp host can use to cannam@53: * make the C-language VampPluginDescriptor object appear as a C++ cannam@53: * Vamp::Plugin object. cannam@53: * cannam@53: * The Vamp API is defined in vamp/vamp.h as a C API. The C++ objects cannam@53: * used for convenience by plugins and hosts actually communicate cannam@53: * using the C low-level API, but the details of this communication cannam@53: * are handled seamlessly by the Vamp SDK implementation provided the cannam@53: * plugin and host use the proper C++ wrapper objects. cannam@53: * cannam@53: * See also PluginAdapter, the plugin-side wrapper that makes a C++ cannam@53: * plugin object available using the C query API. cannam@53: */ cannam@53: cannam@1: class PluginHostAdapter : public Plugin cannam@1: { cannam@1: public: cannam@1: PluginHostAdapter(const VampPluginDescriptor *descriptor, cannam@1: float inputSampleRate); cannam@1: virtual ~PluginHostAdapter(); cannam@32: cannam@32: static std::vector getPluginPath(); cannam@1: cannam@1: bool initialise(size_t channels, size_t stepSize, size_t blockSize); cannam@1: void reset(); cannam@1: cannam@1: InputDomain getInputDomain() const; cannam@1: cannam@50: unsigned int getVampApiVersion() const; cannam@49: std::string getIdentifier() const; cannam@1: std::string getName() const; cannam@1: std::string getDescription() const; cannam@1: std::string getMaker() const; cannam@1: int getPluginVersion() const; cannam@1: std::string getCopyright() const; cannam@1: cannam@1: ParameterList getParameterDescriptors() const; cannam@1: float getParameter(std::string) const; cannam@1: void setParameter(std::string, float); cannam@1: cannam@1: ProgramList getPrograms() const; cannam@1: std::string getCurrentProgram() const; cannam@1: void selectProgram(std::string); cannam@1: cannam@1: size_t getPreferredStepSize() const; cannam@1: size_t getPreferredBlockSize() const; cannam@1: cannam@26: size_t getMinChannelCount() const; cannam@26: size_t getMaxChannelCount() const; cannam@26: cannam@1: OutputList getOutputDescriptors() const; cannam@1: cannam@47: FeatureSet process(const float *const *inputBuffers, RealTime timestamp); cannam@1: cannam@1: FeatureSet getRemainingFeatures(); cannam@1: cannam@1: protected: cannam@12: void convertFeatures(VampFeatureList *, FeatureSet &); cannam@1: cannam@1: const VampPluginDescriptor *m_descriptor; cannam@1: VampPluginHandle m_handle; cannam@1: }; cannam@1: cannam@1: } cannam@1: cannam@1: #endif cannam@1: cannam@1: