From 4c326f5f392c4ab9c63c76e21110dfc201e17363 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 6 Jul 2022 23:39:50 +0100 Subject: [PATCH] Update for async API breaking change, adding default filename Signed-off-by: falkTX --- Makefile | 2 +- carla | 2 +- dpf | 2 +- include/common.hpp | 2 +- plugins/AmalgamatedHarmonics | 2 +- plugins/Bidoo | 2 +- plugins/Cardinal/src/AudioFile.cpp | 2 +- plugins/Cardinal/src/TextEditor.cpp | 2 +- plugins/ChowDSP | 2 +- plugins/Fundamental | 2 +- plugins/LilacLoop | 2 +- plugins/LomasModules | 2 +- plugins/Makefile | 59 +++++++++++++++++++++++++---- plugins/MindMeldModular | 2 +- plugins/Prism | 2 +- plugins/ValleyAudio | 2 +- plugins/cf | 2 +- plugins/repelzen | 2 +- plugins/voxglitch | 2 +- src/CardinalCommon.cpp | 9 +++-- src/CardinalModuleWidget.cpp | 12 ++++-- src/CardinalUI.cpp | 11 ++++++ src/Makefile.cardinal.mk | 3 +- 23 files changed, 96 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index b7916e9..8107d22 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ DGL_EXTRA_ARGS = \ NVG_DISABLE_SKIPPING_WHITESPACE=true \ NVG_FONT_TEXTURE_FLAGS=NVG_IMAGE_NEAREST \ USE_NANOVG_FBO=true \ - ASM_EXCEPTIONS=true \ + WASM_EXCEPTIONS=true \ WINDOWS_ICON_ID=401 # -------------------------------------------------------------- diff --git a/carla b/carla index 1ee091f..93d3fff 160000 --- a/carla +++ b/carla @@ -1 +1 @@ -Subproject commit 1ee091f4cc42fcf25d5064e6b9ebd569038684fe +Subproject commit 93d3fff123f7630be1a28912c029b9775ffd0feb diff --git a/dpf b/dpf index 5e77ebb..ee94ba0 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 5e77ebb317d5fd7209386ce8eb367682896d02b2 +Subproject commit ee94ba0caeabe25e2ecff1039d321e8edb5acedd diff --git a/include/common.hpp b/include/common.hpp index 6dd7470..327acb4 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -68,7 +68,7 @@ // opens a file browser, startDir and title can be null // action is always triggered on close (path can be null), must be freed if not null -void async_dialog_filebrowser(bool saving, const char* startDir, const char* title, +void async_dialog_filebrowser(bool saving, const char* defaultName, const char* startDir, const char* title, std::function action); // opens a message dialog with only an "ok" button diff --git a/plugins/AmalgamatedHarmonics b/plugins/AmalgamatedHarmonics index ab36248..97700c0 160000 --- a/plugins/AmalgamatedHarmonics +++ b/plugins/AmalgamatedHarmonics @@ -1 +1 @@ -Subproject commit ab362486d556255f64a35ee3f71a3da87fe94ce8 +Subproject commit 97700c06af7df4d8fcf173ae3670b7907a682627 diff --git a/plugins/Bidoo b/plugins/Bidoo index 9440a7f..7579f13 160000 --- a/plugins/Bidoo +++ b/plugins/Bidoo @@ -1 +1 @@ -Subproject commit 9440a7f2bcd6a3f8678b013d2274d2061088833b +Subproject commit 7579f13bffc11548c857393408f3c2e030ee2483 diff --git a/plugins/Cardinal/src/AudioFile.cpp b/plugins/Cardinal/src/AudioFile.cpp index 18d51c1..cd03947 100644 --- a/plugins/Cardinal/src/AudioFile.cpp +++ b/plugins/Cardinal/src/AudioFile.cpp @@ -662,7 +662,7 @@ struct AudioFileWidget : ModuleWidgetWithSideScrews<23> { void onAction(const event::Action&) override { CarlaInternalPluginModule* const module = this->module; - async_dialog_filebrowser(false, nullptr, text.c_str(), [module](char* path) + async_dialog_filebrowser(false, nullptr, nullptr, text.c_str(), [module](char* path) { if (path == nullptr) return; diff --git a/plugins/Cardinal/src/TextEditor.cpp b/plugins/Cardinal/src/TextEditor.cpp index 7905e8c..621ce86 100644 --- a/plugins/Cardinal/src/TextEditor.cpp +++ b/plugins/Cardinal/src/TextEditor.cpp @@ -236,7 +236,7 @@ struct TextEditorLoadFileItem : MenuItem { TextEditorModule* const module = this->module;; WeakPtr widget = this->widget; - async_dialog_filebrowser(false, nullptr, text.c_str(), [module, widget](char* path) + async_dialog_filebrowser(false, nullptr, nullptr, text.c_str(), [module, widget](char* path) { if (path) { diff --git a/plugins/ChowDSP b/plugins/ChowDSP index 58d4679..871f712 160000 --- a/plugins/ChowDSP +++ b/plugins/ChowDSP @@ -1 +1 @@ -Subproject commit 58d4679ef9678a2d5e58a7f05b9a20da3efa0329 +Subproject commit 871f712f3eb95ada1c34bf3d8170690eb4aec8d0 diff --git a/plugins/Fundamental b/plugins/Fundamental index 19c706b..9ac0cdb 160000 --- a/plugins/Fundamental +++ b/plugins/Fundamental @@ -1 +1 @@ -Subproject commit 19c706bded88a79ad348bf5abe837ec56d4c0e5a +Subproject commit 9ac0cdb93938c3f01aba58ec01fdd01257abf353 diff --git a/plugins/LilacLoop b/plugins/LilacLoop index bc9d468..cf9bb5c 160000 --- a/plugins/LilacLoop +++ b/plugins/LilacLoop @@ -1 +1 @@ -Subproject commit bc9d468cccb0031e74166a5fc53479fcdc1c9f95 +Subproject commit cf9bb5cfa5fd41ecfc9976bb106c2f4a7667c9d7 diff --git a/plugins/LomasModules b/plugins/LomasModules index a4b802a..b714cdb 160000 --- a/plugins/LomasModules +++ b/plugins/LomasModules @@ -1 +1 @@ -Subproject commit a4b802ae1ac12415cbeaeaef5f949dd8d38dfc5c +Subproject commit b714cdb0c662503bc6cf60c06765b426a4caa17f diff --git a/plugins/Makefile b/plugins/Makefile index c8e3db7..fb8e35d 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -10,6 +10,7 @@ DISTRHO_NAMESPACE = CardinalDISTRHO DGL_NAMESPACE = CardinalDGL USE_NANOVG_FBO = true +WASM_EXCEPTIONS = true include ../dpf/Makefile.base.mk # -------------------------------------------------------------- @@ -25,8 +26,8 @@ endif # List of drwav functions, used in several modules DRWAV = drwav -DRWAV += drwav__on_seek DRWAV += drwav__on_read +DRWAV += drwav__on_seek DRWAV += drwav__read_and_close_f32 DRWAV += drwav__read_and_close_s16 DRWAV += drwav__read_and_close_s32 @@ -34,6 +35,13 @@ DRWAV += drwav_alaw_to_f32 DRWAV += drwav_alaw_to_s16 DRWAV += drwav_alaw_to_s16 DRWAV += drwav_alaw_to_s32 +DRWAV += drwav_bytes_to_f32 +DRWAV += drwav_bytes_to_s16 +DRWAV += drwav_bytes_to_s32 +DRWAV += drwav_bytes_to_s64 +DRWAV += drwav_bytes_to_u16 +DRWAV += drwav_bytes_to_u32 +DRWAV += drwav_bytes_to_u64 DRWAV += drwav_close DRWAV += drwav_close DRWAV += drwav_container @@ -46,29 +54,47 @@ DRWAV += drwav_f64_to_f32 DRWAV += drwav_f64_to_s16 DRWAV += drwav_f64_to_s16 DRWAV += drwav_f64_to_s32 +DRWAV += drwav_fmt_get_format DRWAV += drwav_fopen +DRWAV += drwav_fourcc_equal DRWAV += drwav_free +DRWAV += drwav_get_cursor_in_pcm_frames +DRWAV += drwav_get_length_in_pcm_frames +DRWAV += drwav_guid_equal DRWAV += drwav_init DRWAV += drwav_init_ex DRWAV += drwav_init_file DRWAV += drwav_init_file_ex +DRWAV += drwav_init_file_ex_w +DRWAV += drwav_init_file_w +DRWAV += drwav_init_file_with_metadata +DRWAV += drwav_init_file_with_metadata_w DRWAV += drwav_init_file_write DRWAV += drwav_init_file_write DRWAV += drwav_init_file_write__internal DRWAV += drwav_init_file_write__internal DRWAV += drwav_init_file_write_sequential DRWAV += drwav_init_file_write_sequential +DRWAV += drwav_init_file_write_sequential_pcm_frames +DRWAV += drwav_init_file_write_sequential_pcm_frames_w +DRWAV += drwav_init_file_write_sequential_w +DRWAV += drwav_init_file_write_w DRWAV += drwav_init_memory DRWAV += drwav_init_memory_ex +DRWAV += drwav_init_memory_with_metadata DRWAV += drwav_init_memory_write DRWAV += drwav_init_memory_write DRWAV += drwav_init_memory_write__internal DRWAV += drwav_init_memory_write__internal DRWAV += drwav_init_memory_write_sequential +DRWAV += drwav_init_memory_write_sequential_pcm_frames +DRWAV += drwav_init_with_metadata DRWAV += drwav_init_write DRWAV += drwav_init_write DRWAV += drwav_init_write__internal DRWAV += drwav_init_write_sequential +DRWAV += drwav_init_write_sequential_pcm_frames +DRWAV += drwav_init_write_with_metadata DRWAV += drwav_mulaw_to_f32 DRWAV += drwav_mulaw_to_s16 DRWAV += drwav_mulaw_to_s16 @@ -90,8 +116,11 @@ DRWAV += drwav_open_ex DRWAV += drwav_open_file DRWAV += drwav_open_file_and_read_f32 DRWAV += drwav_open_file_and_read_pcm_frames_f32 +DRWAV += drwav_open_file_and_read_pcm_frames_f32_w DRWAV += drwav_open_file_and_read_pcm_frames_s16 +DRWAV += drwav_open_file_and_read_pcm_frames_s16_w DRWAV += drwav_open_file_and_read_pcm_frames_s32 +DRWAV += drwav_open_file_and_read_pcm_frames_s32_w DRWAV += drwav_open_file_and_read_s16 DRWAV += drwav_open_file_and_read_s32 DRWAV += drwav_open_file_ex @@ -133,9 +162,17 @@ DRWAV += drwav_read_f32__mulaw DRWAV += drwav_read_f32__pcm DRWAV += drwav_read_f32__pcm DRWAV += drwav_read_pcm_frames +DRWAV += drwav_read_pcm_frames_be DRWAV += drwav_read_pcm_frames_f32 +DRWAV += drwav_read_pcm_frames_f32be +DRWAV += drwav_read_pcm_frames_f32le +DRWAV += drwav_read_pcm_frames_le DRWAV += drwav_read_pcm_frames_s16 +DRWAV += drwav_read_pcm_frames_s16be +DRWAV += drwav_read_pcm_frames_s16le DRWAV += drwav_read_pcm_frames_s32 +DRWAV += drwav_read_pcm_frames_s32be +DRWAV += drwav_read_pcm_frames_s32le DRWAV += drwav_read_raw DRWAV += drwav_read_s16 DRWAV += drwav_read_s16__alaw @@ -173,14 +210,20 @@ DRWAV += drwav_seek_to_sample DRWAV += drwav_seek_to_sample DRWAV += drwav_smpl DRWAV += drwav_smpl_loop +DRWAV += drwav_take_ownership_of_metadata +DRWAV += drwav_target_write_size_bytes DRWAV += drwav_u8_to_f32 DRWAV += drwav_u8_to_s16 DRWAV += drwav_u8_to_s16 DRWAV += drwav_u8_to_s32 DRWAV += drwav_uninit +DRWAV += drwav_version +DRWAV += drwav_version_string DRWAV += drwav_write DRWAV += drwav_write DRWAV += drwav_write_pcm_frames +DRWAV += drwav_write_pcm_frames_be +DRWAV += drwav_write_pcm_frames_le DRWAV += drwav_write_raw # -------------------------------------------------------------- @@ -1496,13 +1539,6 @@ $(BUILD_DIR)/FehlerFabrik/%.cpp.o: FehlerFabrik/%.cpp $(foreach m,$(FEHLERFABRIK_CUSTOM),$(call custom_module_names,$(m),FehlerFabrik)) \ -DpluginInstance=pluginInstance__FehlerFabrik -$(BUILD_DIR)/Fundamental/%.c.o: Fundamental/%.c - -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" - @echo "Compiling $<" - $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@ \ - $(foreach m,$(FUNDAMENTAL_CUSTOM),$(call custom_module_names,$(m),Fundamental)) \ - -DpluginInstance=pluginInstance__Fundamental - $(BUILD_DIR)/forsitan-modulare/%.cpp.o: forsitan-modulare/%.cpp -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" @echo "Compiling $<" @@ -1510,6 +1546,13 @@ $(BUILD_DIR)/forsitan-modulare/%.cpp.o: forsitan-modulare/%.cpp $(foreach m,$(GLUETHEGIANT_CUSTOM),$(call custom_module_names,$(m),forsitan)) \ -DpluginInstance=pluginInstance__forsitan +$(BUILD_DIR)/Fundamental/%.c.o: Fundamental/%.c + -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" + @echo "Compiling $<" + $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@ \ + $(foreach m,$(FUNDAMENTAL_CUSTOM),$(call custom_module_names,$(m),Fundamental)) \ + -DpluginInstance=pluginInstance__Fundamental + $(BUILD_DIR)/Fundamental/%.cpp.o: Fundamental/%.cpp -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" @echo "Compiling $<" diff --git a/plugins/MindMeldModular b/plugins/MindMeldModular index 12e235b..cd71f9a 160000 --- a/plugins/MindMeldModular +++ b/plugins/MindMeldModular @@ -1 +1 @@ -Subproject commit 12e235b969530e9ba29b767265483fe6a770e9d4 +Subproject commit cd71f9a4c4a23bdec5666cc78c5bc8b3f936d175 diff --git a/plugins/Prism b/plugins/Prism index 12db31e..4d95ace 160000 --- a/plugins/Prism +++ b/plugins/Prism @@ -1 +1 @@ -Subproject commit 12db31e801907bf60f70d27fa133e72903415304 +Subproject commit 4d95ace8b073e9e8e30b8671ecdb04101d943905 diff --git a/plugins/ValleyAudio b/plugins/ValleyAudio index 5abc2bd..4507aa7 160000 --- a/plugins/ValleyAudio +++ b/plugins/ValleyAudio @@ -1 +1 @@ -Subproject commit 5abc2bd7d249aa386aeddd951db39d02c8b0ddc0 +Subproject commit 4507aa7e1b0efc68e33e0ce1530ebd8ac7b7763c diff --git a/plugins/cf b/plugins/cf index 16470fb..b6c4a66 160000 --- a/plugins/cf +++ b/plugins/cf @@ -1 +1 @@ -Subproject commit 16470fb91bc14a7bb1aa8e646b6461af82f81275 +Subproject commit b6c4a66ffc153d78c7efa00fa886657eb182b15d diff --git a/plugins/repelzen b/plugins/repelzen index 78b1765..428f76c 160000 --- a/plugins/repelzen +++ b/plugins/repelzen @@ -1 +1 @@ -Subproject commit 78b1765eb9ccb9e4e2a1967ee02f4126b1846806 +Subproject commit 428f76c3509e4d71489daf075c48ae4b995a0786 diff --git a/plugins/voxglitch b/plugins/voxglitch index 49b6b3c..e856cfb 160000 --- a/plugins/voxglitch +++ b/plugins/voxglitch @@ -1 +1 @@ -Subproject commit 49b6b3cc688fd6a5a6be2f73c4841a543234e21c +Subproject commit e856cfb4dbc255165d22294e80e13957241d2c80 diff --git a/src/CardinalCommon.cpp b/src/CardinalCommon.cpp index 8a84e33..208f55e 100644 --- a/src/CardinalCommon.cpp +++ b/src/CardinalCommon.cpp @@ -147,8 +147,8 @@ void loadDialog() DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr,); DISTRHO_NAMESPACE::FileBrowserOptions opts; - opts.startDir = dir.c_str(); opts.saving = ui->saving = false; + opts.startDir = dir.c_str(); opts.title = "Open patch"; ui->openFileBrowser(opts); }); @@ -177,7 +177,7 @@ void loadSelectionDialog() std::string selectionDir = asset::user("selections"); system::createDirectories(selectionDir); - async_dialog_filebrowser(false, selectionDir.c_str(), "Import selection", [w](char* pathC) { + async_dialog_filebrowser(false, nullptr, selectionDir.c_str(), "Import selection", [w](char* pathC) { if (!pathC) { // No path selected return; @@ -250,8 +250,9 @@ static void saveAsDialog(const bool uncompressed) DISTRHO_SAFE_ASSERT_RETURN(ui != nullptr,); DISTRHO_NAMESPACE::FileBrowserOptions opts; - opts.startDir = dir.c_str(); opts.saving = ui->saving = true; + opts.defaultName = "patch.vcv"; + opts.startDir = dir.c_str(); opts.title = "Save patch"; ui->savingUncompressed = uncompressed; ui->openFileBrowser(opts); @@ -286,6 +287,7 @@ void openBrowser(const std::string& url) } void async_dialog_filebrowser(const bool saving, + const char* const defaultName, const char* const startDir, const char* const title, const std::function action) @@ -302,6 +304,7 @@ void async_dialog_filebrowser(const bool saving, DISTRHO_NAMESPACE::FileBrowserOptions opts; opts.saving = saving; + opts.defaultName = defaultName; opts.startDir = startDir; opts.title = title; diff --git a/src/CardinalModuleWidget.cpp b/src/CardinalModuleWidget.cpp index 57f3ec3..bf589ef 100644 --- a/src/CardinalModuleWidget.cpp +++ b/src/CardinalModuleWidget.cpp @@ -65,7 +65,7 @@ static void CardinalModuleWidget__loadDialog(ModuleWidget* const w) WeakPtr weakThis = w; - async_dialog_filebrowser(false, presetDir.c_str(), "Load preset", [=](char* pathC) { + async_dialog_filebrowser(false, nullptr, presetDir.c_str(), "Load preset", [=](char* pathC) { // Delete directories if empty DEFER({ try { @@ -100,7 +100,7 @@ void CardinalModuleWidget__saveDialog(ModuleWidget* const w) WeakPtr weakThis = w; - async_dialog_filebrowser(true, presetDir.c_str(), "Save preset", [=](char* pathC) { + async_dialog_filebrowser(true, "preset.vcvm", presetDir.c_str(), "Save preset", [=](char* pathC) { // Delete directories if empty DEFER({ try { @@ -281,7 +281,13 @@ static void CardinalModuleWidget__saveSelectionDialog(RackWidget* const w) std::string selectionDir = asset::user("selections"); system::createDirectories(selectionDir); - async_dialog_filebrowser(true, selectionDir.c_str(), "Save selection as", [w](char* pathC) { + async_dialog_filebrowser(true, "selection.vcvs", selectionDir.c_str(), + #ifdef DISTRHO_OS_WASM + "Save selection", + #else + "Save selection as...", + #endif + [w](char* pathC) { if (!pathC) { // No path selected return; diff --git a/src/CardinalUI.cpp b/src/CardinalUI.cpp index f278746..f5ba0ee 100644 --- a/src/CardinalUI.cpp +++ b/src/CardinalUI.cpp @@ -182,6 +182,17 @@ public: } } + #ifdef DISTRHO_OS_WASM + asyncDialog::create("Welcome!\n" + "This is a special web-assembly version of Cardinal, " + "allowing you to enjoy eurorack-style modules directly in your browser.\n" + "\n" + "This is still very much a work in progress, " + "minor issues and occasional crashes are expected.\n" + "\n" + "Proceed with caution and have fun!"); + #endif + context->window->step(); rack::contextSet(nullptr); diff --git a/src/Makefile.cardinal.mk b/src/Makefile.cardinal.mk index c6459a0..949692c 100644 --- a/src/Makefile.cardinal.mk +++ b/src/Makefile.cardinal.mk @@ -208,9 +208,8 @@ ifeq ($(WASM),true) LINK_FLAGS += --preload-file=./jsfx LINK_FLAGS += --preload-file=./resources LINK_FLAGS += -sALLOW_MEMORY_GROWTH -LINK_FLAGS += -sEXPORTED_RUNTIME_METHODS=FS,cwrap LINK_FLAGS += -sINITIAL_MEMORY=64Mb -# LINK_FLAGS += -sLZ4=1 +LINK_FLAGS += -sLZ4=1 LINK_FLAGS += --shell-file=../emscripten/shell.html else ifeq ($(HAIKU),true) LINK_FLAGS += -lpthread