cannam@283: cannam@283: // This is a skeleton file for use in creating your own plugin cannam@283: // libraries. Replace MyPlugin and myPlugin throughout with the name cannam@283: // of your first plugin class, and fill in the gaps as appropriate. cannam@283: cannam@283: cannam@283: #include "MyPlugin.h" cannam@283: cannam@283: cannam@283: MyPlugin::MyPlugin(float inputSampleRate) : cannam@283: Plugin(inputSampleRate) cannam@303: // Also be sure to set your plugin parameters (presumably stored cannam@303: // in member variables) to their default values here -- the host cannam@303: // will not do that for you cannam@283: { cannam@283: } cannam@283: cannam@283: MyPlugin::~MyPlugin() cannam@283: { cannam@283: } cannam@283: cannam@283: string cannam@283: MyPlugin::getIdentifier() const cannam@283: { cannam@283: return "myplugin"; cannam@283: } cannam@283: cannam@283: string cannam@283: MyPlugin::getName() const cannam@283: { cannam@283: return "My Plugin"; cannam@283: } cannam@283: cannam@283: string cannam@283: MyPlugin::getDescription() const cannam@283: { cannam@283: // Return something helpful here! cannam@283: return ""; cannam@283: } cannam@283: cannam@283: string cannam@283: MyPlugin::getMaker() const cannam@283: { cannam@283: // Your name here cannam@283: return ""; cannam@283: } cannam@283: cannam@283: int cannam@283: MyPlugin::getPluginVersion() const cannam@283: { cannam@283: // Increment this each time you release a version that behaves cannam@283: // differently from the previous one cannam@283: return 1; cannam@283: } cannam@283: cannam@283: string cannam@283: MyPlugin::getCopyright() const cannam@283: { cannam@283: // This function is not ideally named. It does not necessarily cannam@283: // need to say who made the plugin -- getMaker does that -- but it cannam@283: // should indicate the terms under which it is distributed. For cannam@283: // example, "Copyright (year). All Rights Reserved", or "GPL" cannam@283: return ""; cannam@283: } cannam@283: cannam@283: MyPlugin::InputDomain cannam@283: MyPlugin::getInputDomain() const cannam@283: { cannam@283: return TimeDomain; cannam@283: } cannam@283: cannam@283: size_t cannam@283: MyPlugin::getPreferredBlockSize() const cannam@283: { cannam@283: return 0; // 0 means "I can handle any block size" cannam@283: } cannam@283: cannam@283: size_t cannam@283: MyPlugin::getPreferredStepSize() const cannam@283: { cannam@283: return 0; // 0 means "anything sensible"; in practice this cannam@283: // means the same as the block size for TimeDomain cannam@283: // plugins, or half of it for FrequencyDomain plugins cannam@283: } cannam@283: cannam@283: size_t cannam@283: MyPlugin::getMinChannelCount() const cannam@283: { cannam@283: return 1; cannam@283: } cannam@283: cannam@283: size_t cannam@283: MyPlugin::getMaxChannelCount() const cannam@283: { cannam@283: return 1; cannam@283: } cannam@283: cannam@283: MyPlugin::ParameterList cannam@283: MyPlugin::getParameterDescriptors() const cannam@283: { cannam@283: ParameterList list; cannam@283: cannam@283: // If the plugin has no adjustable parameters, return an empty cannam@283: // list here (and there's no need to provide implementations of cannam@283: // getParameter and setParameter in that case either). cannam@283: cannam@303: // Note that it is your responsibility to make sure the parameters cannam@303: // start off having their default values (e.g. in the constructor cannam@303: // above). The host needs to know the default value so it can do cannam@303: // things like provide a "reset to default" function, but it will cannam@303: // not explicitly set your parameters to their defaults for you if cannam@303: // they have not changed in the mean time. cannam@303: cannam@283: ParameterDescriptor d; cannam@283: d.identifier = "parameter"; cannam@283: d.name = "Some Parameter"; cannam@283: d.description = ""; cannam@283: d.unit = ""; cannam@283: d.minValue = 0; cannam@283: d.maxValue = 10; cannam@283: d.defaultValue = 5; cannam@283: d.isQuantized = false; cannam@283: list.push_back(d); cannam@283: cannam@283: return list; cannam@283: } cannam@283: cannam@283: float cannam@283: MyPlugin::getParameter(string identifier) const cannam@283: { cannam@283: if (identifier == "parameter") { cannam@283: return 5; // return the ACTUAL current value of your parameter here! cannam@283: } cannam@283: return 0; cannam@283: } cannam@283: cannam@283: void cannam@283: MyPlugin::setParameter(string identifier, float value) cannam@283: { cannam@283: if (identifier == "parameter") { cannam@283: // set the actual value of your parameter cannam@283: } cannam@283: } cannam@283: cannam@283: MyPlugin::ProgramList cannam@283: MyPlugin::getPrograms() const cannam@283: { cannam@283: ProgramList list; cannam@283: cannam@283: // If you have no programs, return an empty list (or simply don't cannam@283: // implement this function or getCurrentProgram/selectProgram) cannam@283: cannam@283: return list; cannam@283: } cannam@283: cannam@283: string cannam@283: MyPlugin::getCurrentProgram() const cannam@283: { cannam@283: return ""; // no programs cannam@283: } cannam@283: cannam@283: void cannam@283: MyPlugin::selectProgram(string name) cannam@283: { cannam@283: } cannam@283: cannam@283: MyPlugin::OutputList cannam@283: MyPlugin::getOutputDescriptors() const cannam@283: { cannam@283: OutputList list; cannam@283: cannam@283: // See OutputDescriptor documentation for the possibilities here. cannam@283: // Every plugin must have at least one output. cannam@283: cannam@283: OutputDescriptor d; cannam@283: d.identifier = "output"; cannam@283: d.name = "My Output"; cannam@283: d.description = ""; cannam@283: d.unit = ""; cannam@283: d.hasFixedBinCount = true; cannam@283: d.binCount = 1; cannam@283: d.hasKnownExtents = false; cannam@283: d.isQuantized = false; cannam@283: d.sampleType = OutputDescriptor::OneSamplePerStep; cannam@283: d.hasDuration = false; cannam@283: list.push_back(d); cannam@283: cannam@283: return list; cannam@283: } cannam@283: cannam@283: bool cannam@283: MyPlugin::initialise(size_t channels, size_t stepSize, size_t blockSize) cannam@283: { cannam@283: if (channels < getMinChannelCount() || cannam@283: channels > getMaxChannelCount()) return false; cannam@283: cannam@283: // Real initialisation work goes here! cannam@283: cannam@283: return true; cannam@283: } cannam@283: cannam@283: void cannam@283: MyPlugin::reset() cannam@283: { cannam@283: // Clear buffers, reset stored values, etc cannam@283: } cannam@283: cannam@283: MyPlugin::FeatureSet cannam@283: MyPlugin::process(const float *const *inputBuffers, Vamp::RealTime timestamp) cannam@283: { cannam@283: // Do actual work! cannam@283: return FeatureSet(); cannam@283: } cannam@283: cannam@283: MyPlugin::FeatureSet cannam@283: MyPlugin::getRemainingFeatures() cannam@283: { cannam@283: return FeatureSet(); cannam@283: } cannam@283: