Mercurial > hg > vamp-plugin-sdk
comparison host/vamp-simple-host.cpp @ 49:aa64a46320d4
* Rename "name" and "description" to "identifier" and "name"; add new
"description" that actually contains a description
author | cannam |
---|---|
date | Mon, 26 Feb 2007 18:08:48 +0000 |
parents | be8fdfe25693 |
children | b907557b2fb9 |
comparison
equal
deleted
inserted
replaced
48:f46bf5e0fa42 | 49:aa64a46320d4 |
---|---|
124 } | 124 } |
125 | 125 |
126 cerr << endl << argv[0] << ": Running..." << endl; | 126 cerr << endl << argv[0] << ": Running..." << endl; |
127 | 127 |
128 string soname = argv[1]; | 128 string soname = argv[1]; |
129 string plugname = ""; | 129 string plugid = ""; |
130 string wavname; | 130 string wavname; |
131 if (argc >= 3) wavname = argv[2]; | 131 if (argc >= 3) wavname = argv[2]; |
132 | 132 |
133 int sep = soname.find(":"); | 133 int sep = soname.find(":"); |
134 if (sep >= 0 && sep < int(soname.length())) { | 134 if (sep >= 0 && sep < int(soname.length())) { |
135 plugname = soname.substr(sep + 1); | 135 plugid = soname.substr(sep + 1); |
136 soname = soname.substr(0, sep); | 136 soname = soname.substr(0, sep); |
137 } | 137 } |
138 | 138 |
139 void *libraryHandle = DLOPEN(soname, RTLD_LAZY); | 139 void *libraryHandle = DLOPEN(soname, RTLD_LAZY); |
140 | 140 |
164 | 164 |
165 while ((descriptor = fn(index))) { | 165 while ((descriptor = fn(index))) { |
166 | 166 |
167 Vamp::PluginHostAdapter plugin(descriptor, 48000); | 167 Vamp::PluginHostAdapter plugin(descriptor, 48000); |
168 cerr << argv[0] << ": Plugin " << (index+1) | 168 cerr << argv[0] << ": Plugin " << (index+1) |
169 << " is \"" << plugin.getName() << "\"" << endl; | 169 << " is \"" << plugin.getIdentifier() << "\"" << endl; |
170 | 170 |
171 if (plugin.getName() == plugname) plugnumber = index; | 171 if (plugin.getIdentifier() == plugid) plugnumber = index; |
172 | 172 |
173 ++index; | 173 ++index; |
174 } | 174 } |
175 | 175 |
176 cerr << argv[0] << ": Done\n" << endl; | 176 cerr << argv[0] << ": Done\n" << endl; |
179 DLCLOSE(libraryHandle); | 179 DLCLOSE(libraryHandle); |
180 return 0; | 180 return 0; |
181 } | 181 } |
182 | 182 |
183 if (plugnumber < 0) { | 183 if (plugnumber < 0) { |
184 if (plugname != "") { | 184 if (plugid != "") { |
185 cerr << "ERROR: No such plugin as " << plugname << " in library" | 185 cerr << "ERROR: No such plugin as " << plugid << " in library" |
186 << endl; | 186 << endl; |
187 DLCLOSE(libraryHandle); | 187 DLCLOSE(libraryHandle); |
188 return 0; | 188 return 0; |
189 } else { | 189 } else { |
190 plugnumber = 0; | 190 plugnumber = 0; |
210 } | 210 } |
211 | 211 |
212 Vamp::PluginHostAdapter *plugin = | 212 Vamp::PluginHostAdapter *plugin = |
213 new Vamp::PluginHostAdapter(descriptor, sfinfo.samplerate); | 213 new Vamp::PluginHostAdapter(descriptor, sfinfo.samplerate); |
214 | 214 |
215 cerr << "Running " << plugin->getName() << "..." << endl; | 215 cerr << "Running " << plugin->getIdentifier() << "..." << endl; |
216 | 216 |
217 int blockSize = plugin->getPreferredBlockSize(); | 217 int blockSize = plugin->getPreferredBlockSize(); |
218 int stepSize = plugin->getPreferredStepSize(); | 218 int stepSize = plugin->getPreferredStepSize(); |
219 | 219 |
220 cerr << "Preferred block size = " << blockSize << ", step size = " | 220 cerr << "Preferred block size = " << blockSize << ", step size = " |
288 cerr << "Output " << output << " requested, but plugin has only " << outputs.size() << " output(s)" << endl; | 288 cerr << "Output " << output << " requested, but plugin has only " << outputs.size() << " output(s)" << endl; |
289 goto done; | 289 goto done; |
290 } | 290 } |
291 | 291 |
292 od = outputs[output]; | 292 od = outputs[output]; |
293 cerr << "Output is " << od.name << endl; | 293 cerr << "Output is " << od.identifier << endl; |
294 | 294 |
295 if (!plugin->initialise(channels, stepSize, blockSize)) { | 295 if (!plugin->initialise(channels, stepSize, blockSize)) { |
296 cerr << "ERROR: Plugin initialise (channels = " << channels | 296 cerr << "ERROR: Plugin initialise (channels = " << channels |
297 << ", stepSize = " << stepSize << ", blockSize = " | 297 << ", stepSize = " << stepSize << ", blockSize = " |
298 << blockSize << ") failed." << endl; | 298 << blockSize << ") failed." << endl; |
403 while ((descriptor = fn(index))) { | 403 while ((descriptor = fn(index))) { |
404 Vamp::PluginHostAdapter plugin(descriptor, 48000); | 404 Vamp::PluginHostAdapter plugin(descriptor, 48000); |
405 char c = char('A' + index); | 405 char c = char('A' + index); |
406 if (c > 'Z') c = char('a' + (index - 26)); | 406 if (c > 'Z') c = char('a' + (index - 26)); |
407 cerr << " [" << c << "] " | 407 cerr << " [" << c << "] " |
408 << plugin.getDescription() | 408 << plugin.getName() |
409 << ", \"" << plugin.getName() << "\"" | 409 << ", \"" << plugin.getIdentifier() << "\"" |
410 << " [" << plugin.getMaker() | 410 << " [" << plugin.getMaker() |
411 << "]" << std::endl; | 411 << "]" << endl; |
412 if (plugin.getDescription() != "") { | |
413 cerr << " - " << plugin.getDescription() << endl; | |
414 } | |
412 Vamp::Plugin::OutputList outputs = | 415 Vamp::Plugin::OutputList outputs = |
413 plugin.getOutputDescriptors(); | 416 plugin.getOutputDescriptors(); |
414 if (outputs.size() > 1) { | 417 if (outputs.size() > 1) { |
415 for (size_t j = 0; j < outputs.size(); ++j) { | 418 for (size_t j = 0; j < outputs.size(); ++j) { |
416 cerr << " (" << j << ") " | 419 cerr << " (" << j << ") " |
417 << outputs[j].description | 420 << outputs[j].name |
418 << ", \"" << outputs[j].name << "\"" | 421 << ", \"" << outputs[j].identifier << "\"" |
419 << endl; | 422 << endl; |
423 if (outputs[j].description != "") { | |
424 cerr << " - " | |
425 << outputs[j].description << endl; | |
426 } | |
420 } | 427 } |
421 } | 428 } |
422 ++index; | 429 ++index; |
423 } | 430 } |
424 } else { | 431 } else { |