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