From f9cc84b5f03eeeef1b7cbedfc0c6bbdc4d27a161 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Tue, 22 Jun 2021 21:25:39 +0200 Subject: [PATCH] Use the importer in the JACK client --- clients/CMakeLists.txt | 2 +- clients/jack_client.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt index 37e6ed77..a22bbe29 100644 --- a/clients/CMakeLists.txt +++ b/clients/CMakeLists.txt @@ -1,6 +1,6 @@ if(SFIZZ_JACK) add_executable(sfizz_jack MidiHelpers.h jack_client.cpp) - target_link_libraries(sfizz_jack PRIVATE sfizz::sfizz sfizz::jack sfizz::spin_mutex absl::flags_parse) + target_link_libraries(sfizz_jack PRIVATE sfizz::import sfizz::sfizz sfizz::jack sfizz::spin_mutex absl::flags_parse) sfizz_enable_lto_if_needed(sfizz_jack) install(TARGETS sfizz_jack DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT "jack" OPTIONAL) diff --git a/clients/jack_client.cpp b/clients/jack_client.cpp index cd5f8fd7..806ddadb 100644 --- a/clients/jack_client.cpp +++ b/clients/jack_client.cpp @@ -22,6 +22,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sfizz.hpp" +#include "sfizz/import/sfizz_import.h" #include "MidiHelpers.h" #include #include @@ -188,7 +189,13 @@ int main(int argc, char** argv) sfz::Sfizz synth; synth.setOversamplingFactor(factor); synth.setPreloadSize(preload_size); - synth.loadSfzFile(filesToParse[0]); + + const char *importFormat = nullptr; + if (!sfizz_load_or_import_file(synth.handle(), filesToParse[0], &importFormat)) { + std::cout << "Could not load the instrument file: " << filesToParse[0] << '\n'; + return 1; + } + std::cout << "==========" << '\n'; std::cout << "Total:" << '\n'; std::cout << "\tMasters: " << synth.getNumMasters() << '\n'; @@ -211,6 +218,10 @@ int main(int argc, char** argv) for (auto& opcode : synth.getUnknownOpcodes()) std::cout << opcode << ','; std::cout << '\n'; + if (importFormat) { + std::cout << "==========" << '\n'; + std::cout << "Import format: " << importFormat << '\n'; + } // std::cout << std::flush; jack_status_t status;