13
0

VST3: Implement verbose scan option

This commit is contained in:
Robin Gareus 2020-10-24 03:21:25 +02:00
parent 9ab84a95f1
commit c6222caea6
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 21 additions and 15 deletions

View File

@ -65,10 +65,6 @@ struct VST3Info {
int n_midi_outputs;
};
LIBARDOUR_API extern bool
discover_vst3 (boost::shared_ptr<VST3PluginModule>,
std::vector<VST3Info>&);
LIBARDOUR_API extern std::string
module_path_vst3 (std::string const& path);
@ -79,7 +75,7 @@ LIBARDOUR_API extern std::string
vst3_valid_cache_file (std::string const& module_path, bool verbose = false);
LIBARDOUR_API extern bool
vst3_scan_and_cache (std::string const& module_path, std::string const& bundle_path, boost::function<void (std::string const&, VST3Info const&)> cb);
vst3_scan_and_cache (std::string const& module_path, std::string const& bundle_path, boost::function<void (std::string const&, VST3Info const&)> cb, bool verbose = false);
} // namespace ARDOUR

View File

@ -63,7 +63,7 @@ count_channels (Vst::IComponent* c, Vst::MediaType media, Vst::BusDirection dir,
/* For now allow we only support one main bus, and one aux-bus.
* Also an aux-bus by itself is currently N/A.
*/
std::cerr << "VST3: Ignored extra bus\n";
std::cerr << "VST3: Ignored extra bus. type: " << type << " index: " << i << "\n";
continue;
}
#endif
@ -85,10 +85,11 @@ count_channels (Vst::IComponent* c, Vst::MediaType media, Vst::BusDirection dir,
return n_channels;
}
bool
ARDOUR::discover_vst3 (boost::shared_ptr<VST3PluginModule> m, std::vector<VST3Info>& rv)
static bool
discover_vst3 (boost::shared_ptr<ARDOUR::VST3PluginModule> m, std::vector<ARDOUR::VST3Info>& rv, bool verbose)
{
using namespace std;
using namespace ARDOUR;
IPluginFactory* factory = m->factory ();
@ -350,7 +351,7 @@ vst3_save_cache_file (std::string const& module_path, XMLNode* root)
}
bool
ARDOUR::vst3_scan_and_cache (std::string const& module_path, std::string const& bundle_path, boost::function<void (std::string const&, VST3Info const&)> cb)
ARDOUR::vst3_scan_and_cache (std::string const& module_path, std::string const& bundle_path, boost::function<void (std::string const&, VST3Info const&)> cb, bool verbose)
{
XMLNode* root = new XMLNode ("VST3Cache");
root->set_property ("version", 1);
@ -360,7 +361,7 @@ ARDOUR::vst3_scan_and_cache (std::string const& module_path, std::string const&
try {
boost::shared_ptr<VST3PluginModule> m = VST3PluginModule::load (module_path);
std::vector<VST3Info> nfo;
discover_vst3 (m, nfo);
discover_vst3 (m, nfo, verbose);
for (std::vector<VST3Info>::const_iterator i = nfo.begin(); i != nfo.end(); ++i) {
cb (module_path, *i);
root->add_child_nocopy (i->state ());

View File

@ -88,7 +88,7 @@ static void vst3_plugin (string const& module_path, VST3Info const& i)
}
static bool
scan_vst3 (std::string const& bundle_path, bool force)
scan_vst3 (std::string const& bundle_path, bool force, bool verbose)
{
info << "Scanning: " << bundle_path << endmsg;
string module_path = module_path_vst3 (bundle_path);
@ -96,14 +96,14 @@ scan_vst3 (std::string const& bundle_path, bool force)
return false;
}
if (!vst3_valid_cache_file (module_path, true).empty()) {
if (!vst3_valid_cache_file (module_path, verbose).empty()) {
if (!force) {
info << "Skipping scan." << endmsg;
return true;
}
}
if (vst3_scan_and_cache (module_path, bundle_path, sigc::ptr_fun (&vst3_plugin))) {
if (vst3_scan_and_cache (module_path, bundle_path, sigc::ptr_fun (&vst3_plugin)), verbose) {
info << string_compose (_("Saved VST3 plugin cache to %1"), vst3_cache_file (module_path)) << endmsg;
}
@ -120,6 +120,7 @@ usage ()
-f, --force Force update ot cache file\n\
-h, --help Display this help and exit\n\
-q, --quiet Hide usual output, only print errors\n\
-v, --verbose Give verbose output (unless quiet)\n\
-V, --version Print version information and exit\n\
\n");
@ -140,14 +141,16 @@ main (int argc, char **argv)
bool print_log = true;
bool stop_on_error = false;
bool force = false;
bool verbose = false;
const char* optstring = "fhqV";
const char* optstring = "fhqvV";
/* clang-format off */
const struct option longopts[] = {
{ "force", no_argument, 0, 'f' },
{ "help", no_argument, 0, 'h' },
{ "quiet", no_argument, 0, 'q' },
{ "verbose", no_argument, 0, 'v' },
{ "version", no_argument, 0, 'V' },
};
/* clang-format on */
@ -176,6 +179,10 @@ main (int argc, char **argv)
print_log = false;
break;
case 'v':
verbose = true;
break;
default:
std::cerr << "Error: unrecognized option. See --help for usage information.\n";
console_madness_end ();
@ -198,12 +205,14 @@ main (int argc, char **argv)
log_receiver.listen_to (warning);
log_receiver.listen_to (error);
log_receiver.listen_to (fatal);
} else {
verbose = false;
}
bool err = false;
while (optind < argc) {
if (!scan_vst3 (argv[optind++], force)) {
if (!scan_vst3 (argv[optind++], force, verbose)) {
err = true;
}
if (stop_on_error) {