31 #include <vamp-hostsdk/PluginHostAdapter.h> 55 const std::vector<Model *> &candidateInputModels,
56 Model *defaultInputModel,
64 if (candidateInputModels.empty())
return input;
69 Model *inputModel = candidateInputModels[0];
70 QStringList candidateModelNames;
71 QString defaultModelName;
72 QMap<QString, Model *> modelMap;
73 for (
int i = 0; i < (int)candidateInputModels.size(); ++i) {
74 QString modelName = candidateInputModels[i]->objectName();
75 QString origModelName = modelName;
77 while (modelMap.contains(modelName)) {
78 modelName = tr(
"%1 <%2>").arg(origModelName).arg(++dupcount);
80 modelMap[modelName] = candidateInputModels[i];
81 candidateModelNames.push_back(modelName);
82 if (candidateInputModels[i] == defaultInputModel) {
83 defaultModelName = modelName;
87 QString
id =
transform.getPluginIdentifier();
92 cerr <<
"last configuration: " << configurationXml << endl;
94 Vamp::PluginBase *plugin = 0;
98 cerr <<
"getConfigurationForTransform: instantiating Vamp plugin" << endl;
111 int blockSize = 1024;
120 (
id, 0, 0, sampleRate, blockSize, channels);
129 makeContextConsistentWithPlugin(
transform, plugin);
143 startFrame, duration,
151 makeContextConsistentWithPlugin(
transform, plugin);
172 QString
id = transforms[0].getPluginIdentifier();
185 SVDEBUG <<
"ModelTransformerFactory::createTransformer: Unknown transform \"" 186 << transforms[0].getIdentifier() <<
"\"" << endl;
190 if (transformer) transformer->setObjectName(transforms[0].getIdentifier());
200 SVDEBUG <<
"ModelTransformerFactory::transform: Constructing transformer with input model " << input.
getModel() << endl;
205 if (mm.empty())
return 0;
215 SVDEBUG <<
"ModelTransformerFactory::transformMultiple: Constructing transformer with input model " << input.
getModel() << endl;
218 if (!t)
return vector<Model *>();
231 if (!models.empty()) {
232 QString imn = input.
getModel()->objectName();
235 (transforms[0].getIdentifier());
236 for (
int i = 0; i < (int)models.size(); ++i) {
239 models[i]->setObjectName(tr(
"%1: %2").arg(imn).arg(trn));
241 models[i]->setObjectName(imn);
243 }
else if (trn !=
"") {
244 models[i]->setObjectName(trn);
259 QObject *s = sender();
265 cerr <<
"WARNING: ModelTransformerFactory::transformerFinished: sender is not a transformer" << endl;
270 cerr <<
"WARNING: ModelTransformerFactory::transformerFinished(" 272 <<
"): I have no record of this transformer running!" 281 m_handlers[transformer]->moreModelsAvailable(mm);
283 m_handlers[transformer]->noMoreModelsAvailable();
306 for (
int i = 0; i < (int)mm.size(); ++i) {
307 if (mm[i] == m) affected.insert(t);
312 for (TransformerSet::iterator i = affected.begin();
313 i != affected.end(); ++i) {
Simple interface for audio playback.
virtual void setParametersFromXml(QString xml)
Set the parameters and program of a plugin from an XML plugin element as returned by toXml.
virtual int getTargetChannelCount() const =0
Get the number of channels of audio that will be provided to the play target.
static RealTimePluginFactory * instanceFor(QString identifier)
virtual QString toXmlString(QString indent="", QString extraAttributes="") const
Convert this exportable object to XML in a string.
virtual int getSampleRate() const =0
Return the frame rate in frames per second.
Model is the base class for all data models that represent any sort of data on a time scale based on ...
virtual RealTimePluginInstance * instantiatePlugin(QString identifier, int clientId, int position, unsigned int sampleRate, unsigned int blockSize, unsigned int channels)=0
Instantiate a plugin.
virtual int getTargetSampleRate() const =0
Return the sample rate set by the target audio device (or the source sample rate if the target hasn't...
virtual int getTargetBlockSize() const =0
Get the block size of the target audio device.