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