annotate vamp-hostsdk/LoadRequest.h @ 428:4912b698f3f7 vampipe

Configuration request/response structs
author Chris Cannam
date Tue, 17 May 2016 13:52:51 +0100
parents 5502a06537f6
children
rev   line source
Chris@423 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@423 2
Chris@423 3 /*
Chris@423 4 Vamp
Chris@423 5
Chris@423 6 An API for audio analysis and feature extraction plugins.
Chris@423 7
Chris@423 8 Centre for Digital Music, Queen Mary, University of London.
Chris@423 9 Copyright 2006-2016 Chris Cannam and QMUL.
Chris@423 10
Chris@423 11 Permission is hereby granted, free of charge, to any person
Chris@423 12 obtaining a copy of this software and associated documentation
Chris@423 13 files (the "Software"), to deal in the Software without
Chris@423 14 restriction, including without limitation the rights to use, copy,
Chris@423 15 modify, merge, publish, distribute, sublicense, and/or sell copies
Chris@423 16 of the Software, and to permit persons to whom the Software is
Chris@423 17 furnished to do so, subject to the following conditions:
Chris@423 18
Chris@423 19 The above copyright notice and this permission notice shall be
Chris@423 20 included in all copies or substantial portions of the Software.
Chris@423 21
Chris@423 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@423 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@423 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Chris@423 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
Chris@423 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@423 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@423 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@423 29
Chris@423 30 Except as contained in this notice, the names of the Centre for
Chris@423 31 Digital Music; Queen Mary, University of London; and Chris Cannam
Chris@423 32 shall not be used in advertising or otherwise to promote the sale,
Chris@423 33 use or other dealings in this Software without prior written
Chris@423 34 authorization.
Chris@423 35 */
Chris@423 36
Chris@423 37 #ifndef VAMP_LOAD_REQUEST_H
Chris@423 38 #define VAMP_LOAD_REQUEST_H
Chris@423 39
Chris@423 40 #include "PluginStaticData.h"
Chris@423 41 #include "PluginConfiguration.h"
Chris@423 42
Chris@423 43 #include "hostguard.h"
Chris@423 44
Chris@423 45 #include <map>
Chris@423 46 #include <string>
Chris@423 47
Chris@423 48 _VAMP_SDK_HOSTSPACE_BEGIN(LoadRequest.h)
Chris@423 49
Chris@423 50 namespace Vamp {
Chris@423 51
Chris@423 52 class Plugin;
Chris@423 53
Chris@423 54 namespace HostExt {
Chris@423 55
Chris@423 56 /**
Chris@423 57 * \class LoadRequest LoadRequest.h <vamp-hostsdk/LoadRequest.h>
Chris@423 58 *
Chris@423 59 * Vamp::HostExt::LoadRequest is a structure containing the
Chris@423 60 * information necessary to load a plugin. When a request is made to
Chris@423 61 * load a plugin using a LoadRequest, the response is typically
Chris@423 62 * returned in a LoadResponse structure.
Chris@423 63 *
Chris@423 64 * \see LoadResponse
Chris@423 65 *
Chris@423 66 * \note This class was introduced in version 2.7 of the Vamp plugin
Chris@423 67 * SDK, along with the PluginLoader method that accepts this structure
Chris@423 68 * rather than accepting its elements individually.
Chris@423 69 */
Chris@423 70 struct LoadRequest
Chris@423 71 {
Chris@423 72 LoadRequest() : // invalid request by default
Chris@423 73 inputSampleRate(0.f),
Chris@423 74 adapterFlags(0) { }
Chris@425 75
Chris@425 76 /**
Chris@425 77 * PluginKey is a string type that is used to identify a plugin
Chris@425 78 * uniquely within the scope of "the current system". For further
Chris@425 79 * details \see PluginLoader::PluginKey.
Chris@425 80 */
Chris@425 81 typedef std::string PluginKey;
Chris@425 82
Chris@425 83 /**
Chris@425 84 * The identifying key for the plugin to be loaded.
Chris@425 85 */
Chris@425 86 PluginKey pluginKey;
Chris@425 87
Chris@425 88 /**
Chris@425 89 * Sample rate to be passed to the plugin's constructor.
Chris@425 90 */
Chris@423 91 float inputSampleRate;
Chris@425 92
Chris@425 93 /**
Chris@425 94 * A bitwise OR of the values in the PluginLoader::AdapterFlags
Chris@425 95 * enumeration, indicating under which circumstances an adapter
Chris@425 96 * should be used to wrap the original plugin. If adapterFlags is
Chris@425 97 * 0, no optional adapters will be used.
Chris@425 98 *
Chris@425 99 * \see PluginLoader::AdapterFlags, PluginLoader::loadPlugin
Chris@425 100 */
Chris@425 101 int adapterFlags;
Chris@423 102 };
Chris@423 103
Chris@423 104 /**
Chris@428 105 * \class LoadResponse LoadRequest.h <vamp-hostsdk/LoadRequest.h>
Chris@423 106 *
Chris@423 107 * Vamp::HostExt::LoadResponse is a structure containing the
Chris@423 108 * information returned by PluginLoader when asked to load a plugin
Chris@423 109 * using a LoadRequest.
Chris@423 110 *
Chris@423 111 * If the plugin could not be loaded, the plugin field will be 0.
Chris@423 112 *
Chris@423 113 * The caller takes ownership of the plugin contained here, which
Chris@423 114 * should be deleted (using the standard C++ delete keyword) after
Chris@423 115 * use.
Chris@423 116 *
Chris@423 117 * \see LoadRequest
Chris@423 118 *
Chris@423 119 * \note This class was introduced in version 2.7 of the Vamp plugin
Chris@423 120 * SDK, along with the PluginLoader method that returns this structure.
Chris@423 121 */
Chris@423 122 struct LoadResponse
Chris@423 123 {
Chris@423 124 LoadResponse() : // invalid (failed) response by default
Chris@423 125 plugin(0) { }
Chris@425 126
Chris@425 127 /**
Chris@425 128 * A pointer to the loaded plugin, or 0 if loading failed. Caller
Chris@425 129 * takes ownership of the plugin and must delete it after use.
Chris@425 130 */
Chris@423 131 Plugin *plugin;
Chris@425 132
Chris@425 133 /**
Chris@425 134 * The static data associated with the loaded plugin, that is, all
Chris@425 135 * information about it that does not depend on its configuration
Chris@425 136 * (parameters, programs, initialisation parameters). The contents
Chris@425 137 * of this structure are only valid if plugin is non-0.
Chris@426 138 *
Chris@426 139 * Much of the data in here is duplicated with the plugin itself.
Chris@425 140 */
Chris@423 141 PluginStaticData staticData;
Chris@425 142
Chris@425 143 /**
Chris@425 144 * The default configuration for this plugin, that is, default
Chris@425 145 * values for parameters etc. The contents of this structure are
Chris@425 146 * only valid if plugin is non-0.
Chris@425 147 */
Chris@423 148 PluginConfiguration defaultConfiguration;
Chris@423 149 };
Chris@423 150
Chris@423 151 }
Chris@423 152
Chris@423 153 }
Chris@423 154
Chris@423 155 _VAMP_SDK_HOSTSPACE_END(LoadRequest.h)
Chris@423 156
Chris@423 157 #endif