From 61e73fd1a19ac65c914a7014f01915379874266a Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 18 Mar 2021 16:53:15 +0100 Subject: [PATCH] Display the list of available import formats --- devtools/Importer.cpp | 6 +++++- src/sfizz/import/ForeignInstrument.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/devtools/Importer.cpp b/devtools/Importer.cpp index 2b2f8b75..44d5bb35 100644 --- a/devtools/Importer.cpp +++ b/devtools/Importer.cpp @@ -3,14 +3,18 @@ int main(int argc, char* argv[]) { + const sfz::InstrumentFormatRegistry& formatRegistry = sfz::InstrumentFormatRegistry::getInstance(); + if (argc != 2) { std::cerr << "Usage: sfizz_importer \n"; + std::cerr << "--\n" "Supported formats:\n"; + for (const sfz::InstrumentFormat* format : formatRegistry.getAllFormats()) + std::cerr << " * " << format->name() << '\n'; return 1; } const fs::path foreignPath = fs::u8path(argv[1]); - const sfz::InstrumentFormatRegistry& formatRegistry = sfz::InstrumentFormatRegistry::getInstance(); const sfz::InstrumentFormat* format = formatRegistry.getMatchingFormat(foreignPath); if (!format) { diff --git a/src/sfizz/import/ForeignInstrument.h b/src/sfizz/import/ForeignInstrument.h index 94baacf8..cba75b66 100644 --- a/src/sfizz/import/ForeignInstrument.h +++ b/src/sfizz/import/ForeignInstrument.h @@ -34,6 +34,11 @@ public: */ const InstrumentFormat* getMatchingFormat(const fs::path& path) const; + /** + * @brief Get the list of registered formats. + */ + const std::vector& getAllFormats() const noexcept { return formats_; } + private: std::vector formats_; };