diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1feadfd7..31414eb9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -251,13 +251,19 @@ jobs: run: | cp -vf "$GITHUB_WORKSPACE"/scripts/mingw_dwrite_3.h \ /usr/i686-w64-mingw32/include/dwrite_3.h - - name: Fix VST sources + - name: Fix VST sources (case) shell: bash # need to convert some includes to lower case (as of VST 3.7.1) run: | find "$GITHUB_WORKSPACE"/plugins/vst/external/VST_SDK -type d -name source -exec \ find {} -type f -name '*.[hc]' -o -name '*.[hc]pp' -print0 \; | \ xargs -0 sed -i 's///' + - name: Fix VST sources (includes) + shell: bash + # need to add include (as of VST 3.7.2) + run: | + sed -i '0,/#include \n#include //' + - name: Fix VST sources (includes) + shell: bash + # need to add include (as of VST 3.7.2) + run: | + sed -i '0,/#include \n#include > "$GITHUB_ENV" - - uses: actions/download-artifact@v2 - with: - name: Linux tarball + # - uses: actions/download-artifact@v2 + # with: + # name: Linux tarball - uses: actions/download-artifact@v2 with: name: MOD devices tarball diff --git a/.gitignore b/.gitignore index f1c7bda9..6b888b16 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ compile_commands.json *.autosave /Doxyfile .DS_Store +.cache/ +.cmake/ clients/sfizz_jack clients/sfzprint diff --git a/.gitmodules b/.gitmodules index 7850d1b8..441fc807 100644 --- a/.gitmodules +++ b/.gitmodules @@ -17,7 +17,7 @@ shallow = true [submodule "vst/external/VST_SDK/VST3_SDK/vstgui4"] path = plugins/editor/external/vstgui4 - url = https://github.com/sfztools/vstgui.git + url = https://github.com/steinbergmedia/vstgui.git shallow = true [submodule "external/st_audiofile/thirdparty/dr_libs"] path = external/st_audiofile/thirdparty/dr_libs 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; diff --git a/demos/DemoParser.cpp b/demos/DemoParser.cpp index 424dccee..6875af7c 100644 --- a/demos/DemoParser.cpp +++ b/demos/DemoParser.cpp @@ -1,5 +1,6 @@ #include "ui_DemoParser.h" #include "parser/Parser.h" +#include "parser/ParserListener.h" #include #include #include diff --git a/demos/PlotCurve.cpp b/demos/PlotCurve.cpp index 954a7946..f2e53d4b 100644 --- a/demos/PlotCurve.cpp +++ b/demos/PlotCurve.cpp @@ -17,6 +17,7 @@ #include "sfizz/Curve.h" #include "sfizz/parser/Parser.h" +#include "sfizz/parser/ParserListener.h" #include "absl/strings/numbers.h" #include "absl/types/span.h" #include diff --git a/plugins/editor/external/vstgui4 b/plugins/editor/external/vstgui4 index 9a116d18..c009dd29 160000 --- a/plugins/editor/external/vstgui4 +++ b/plugins/editor/external/vstgui4 @@ -1 +1 @@ -Subproject commit 9a116d1812aa274ccf61d68f4c2bae612b3871ad +Subproject commit c009dd294171cbb1bb5021830ff125a15966dea8 diff --git a/plugins/editor/layout/main.fl b/plugins/editor/layout/main.fl index 08f9c9ae..e862d432 100644 --- a/plugins/editor/layout/main.fl +++ b/plugins/editor/layout/main.fl @@ -1,21 +1,21 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0305 +version 1.0306 header_name {.h} code_name {.cxx} widget_class mainView {open - xywh {439 94 800 475} type Double + xywh {108 91 800 475} type Double class LogicalGroup visible } { Fl_Box imageContainer_ { - image {../resources/background.png} xywh {190 110 600 280} + image {../resources/background.png} xywh {5 110 790 285} class Background } Fl_Group {} { - comment {palette=invertedPalette} open selected + comment {palette=invertedPalette} open xywh {0 0 800 110} class LogicalGroup } { - Fl_Group {} {open + Fl_Group {} { xywh {5 4 175 101} box ROUNDED_BOX align 0 class RoundedGroup } { @@ -24,23 +24,28 @@ widget_class mainView {open image {../resources/logo_text_shaded.png} xywh {32 9 120 60} class AboutButton } - Fl_Button {panelButtons_[kPanelGeneral]} { - comment {tag=kTagFirstChangePanel+kPanelGeneral} - xywh {36 73 32 32} labelsize 30 - class HomeButton + Fl_Button {panelButtons_[kPanelInfo]} { + comment {tag=kTagFirstChangePanel+kPanelInfo} + xywh {56 73 32 32} labelsize 30 + class InfoButton } Fl_Button {panelButtons_[kPanelControls]} { comment {tag=kTagFirstChangePanel+kPanelControls} - xywh {76 73 32 32} labelsize 30 + xywh {97 73 32 32} labelsize 30 class CCButton } Fl_Button {panelButtons_[kPanelSettings]} { comment {tag=kTagFirstChangePanel+kPanelSettings} - xywh {116 73 32 32} labelsize 30 + xywh {137 73 32 32} labelsize 30 class SettingsButton } + Fl_Button {panelButtons_[kPanelGeneral]} { + comment {tag=kTagFirstChangePanel+kPanelGeneral} + xywh {16 73 32 32} labelsize 30 + class HomeButton + } } - Fl_Group {} {open + Fl_Group {} { xywh {185 5 418 100} box ROUNDED_BOX class RoundedGroup } { @@ -121,7 +126,7 @@ widget_class mainView {open class ChevronValueDropDown } } - Fl_Group {} {open + Fl_Group {} { xywh {608 5 187 100} box ROUNDED_BOX class RoundedGroup } { @@ -156,12 +161,12 @@ widget_class mainView {open } } } - Fl_Group {subPanels_[kPanelGeneral]} { - xywh {5 110 791 285} hide + Fl_Group {subPanels_[kPanelInfo]} {open + xywh {5 110 790 285} hide class LogicalGroup } { Fl_Group {} {open - xywh {5 110 175 280} box ROUNDED_BOX + xywh {5 110 790 285} box ROUNDED_BOX class RoundedGroup } { Fl_Box {} { @@ -230,8 +235,8 @@ widget_class mainView {open } {} } } - Fl_Group {subPanels_[kPanelSettings]} {open - xywh {5 109 790 316} + Fl_Group {subPanels_[kPanelSettings]} { + xywh {5 110 790 285} class LogicalGroup } { Fl_Group {} { @@ -381,4 +386,8 @@ widget_class mainView {open xywh {5 400 790 70} labelsize 12 class Piano } + Fl_Group {subPanels_[kPanelGeneral]} {open selected + xywh {5 110 790 285} hide + class LogicalGroup + } {} } diff --git a/plugins/editor/src/editor/Editor.cpp b/plugins/editor/src/editor/Editor.cpp index 276afbac..67694856 100644 --- a/plugins/editor/src/editor/Editor.cpp +++ b/plugins/editor/src/editor/Editor.cpp @@ -66,6 +66,7 @@ struct Editor::Impl : EditorController::Receiver, enum { kPanelGeneral, + kPanelInfo, kPanelControls, kPanelSettings, kNumPanels, @@ -817,6 +818,9 @@ void Editor::Impl::createFrameContents() auto createHomeButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { return createGlyphButton(u8"\ue1d6", bounds, tag, fontsize); }; + auto createInfoButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { + return createGlyphButton(u8"\ue1e7", bounds, tag, fontsize); + }; auto createCCButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { // return createGlyphButton(u8"\ue240", bounds, tag, fontsize); return createGlyphButton(u8"\ue253", bounds, tag, fontsize); diff --git a/plugins/editor/src/editor/NativeHelpers.mm b/plugins/editor/src/editor/NativeHelpers.mm index da2eb1e4..e2d53990 100644 --- a/plugins/editor/src/editor/NativeHelpers.mm +++ b/plugins/editor/src/editor/NativeHelpers.mm @@ -24,11 +24,30 @@ static bool openFileWithApplication(const char *fileName, NSString *application) bool openFileInExternalEditor(const char *fileName) { - NSURL* applicationURL = (__bridge_transfer NSURL*)LSCopyDefaultApplicationURLForContentType( - kUTTypePlainText, kLSRolesEditor, nil); - if (!applicationURL || ![applicationURL isFileURL]) + NSURL* appURL = nil; + NSURL* fileURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:fileName]]; + const LSRolesMask roles = kLSRolesEditor; + + NSArray* editorApps = (__bridge_transfer NSArray*)LSCopyApplicationURLsForURL( + (__bridge CFURLRef)fileURL, roles); + + for (NSUInteger i = 0, n = [editorApps count]; i < n && !appURL; ++i) { + NSURL* url = [editorApps objectAtIndex:i]; + if (url && [url isFileURL]) + appURL = url; + } + + if (!appURL) { + NSURL* url = (__bridge_transfer NSURL*)LSCopyDefaultApplicationURLForContentType( + kUTTypePlainText, roles, nil); + if (url && [url isFileURL]) + appURL = url; + } + + if (!appURL) return false; - return openFileWithApplication(fileName, [applicationURL path]); + + return openFileWithApplication(fileName, [appURL path]); } bool openDirectoryInExplorer(const char *fileName) diff --git a/plugins/editor/src/editor/layout/main.hpp b/plugins/editor/src/editor/layout/main.hpp index 5e6b208e..a14cb951 100644 --- a/plugins/editor/src/editor/layout/main.hpp +++ b/plugins/editor/src/editor/layout/main.hpp @@ -1,7 +1,7 @@ /* This file is generated by the layout maker tool. */ auto* const view__0 = createLogicalGroup(CRect(0, 0, 800, 475), -1, "", kCenterText, 14); mainView = view__0; -auto* const view__1 = createBackground(CRect(190, 110, 790, 390), -1, "", kCenterText, 14); +auto* const view__1 = createBackground(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); imageContainer_ = view__1; view__0->addView(view__1); enterPalette(invertedPalette); @@ -11,190 +11,197 @@ auto* const view__3 = createRoundedGroup(CRect(5, 4, 180, 105), -1, "", kCenterT view__2->addView(view__3); auto* const view__4 = createAboutButton(CRect(27, 5, 147, 65), kTagAbout, "", kCenterText, 14); view__3->addView(view__4); -auto* const view__5 = createHomeButton(CRect(31, 69, 63, 101), kTagFirstChangePanel+kPanelGeneral, "", kCenterText, 30); -panelButtons_[kPanelGeneral] = view__5; +auto* const view__5 = createInfoButton(CRect(51, 69, 83, 101), kTagFirstChangePanel+kPanelInfo, "", kCenterText, 30); +panelButtons_[kPanelInfo] = view__5; view__3->addView(view__5); -auto* const view__6 = createCCButton(CRect(71, 69, 103, 101), kTagFirstChangePanel+kPanelControls, "", kCenterText, 30); +auto* const view__6 = createCCButton(CRect(92, 69, 124, 101), kTagFirstChangePanel+kPanelControls, "", kCenterText, 30); panelButtons_[kPanelControls] = view__6; view__3->addView(view__6); -auto* const view__7 = createSettingsButton(CRect(111, 69, 143, 101), kTagFirstChangePanel+kPanelSettings, "", kCenterText, 30); +auto* const view__7 = createSettingsButton(CRect(132, 69, 164, 101), kTagFirstChangePanel+kPanelSettings, "", kCenterText, 30); panelButtons_[kPanelSettings] = view__7; view__3->addView(view__7); -auto* const view__8 = createRoundedGroup(CRect(185, 5, 603, 105), -1, "", kCenterText, 14); -view__2->addView(view__8); -auto* const view__9 = createHLine(CRect(10, 36, 405, 41), -1, "", kCenterText, 14); -view__8->addView(view__9); -auto* const view__10 = createHLine(CRect(10, 68, 405, 73), -1, "", kCenterText, 14); -view__8->addView(view__10); -auto* const view__11 = createClickableLabel(CRect(10, 8, 330, 38), kTagLoadSfzFile, "DefaultInstrument.sfz", kLeftText, 20); -sfzFileLabel_ = view__11; -view__8->addView(view__11); -auto* const view__12 = createLabel(CRect(80, 40, 405, 75), -1, "", kLeftText, 20); -keyswitchLabel_ = view__12; -view__8->addView(view__12); -auto* const view__13 = createBadge(CRect(10, 42, 70, 68), -1, "", kCenterText, 20); -keyswitchBadge_ = view__13; -view__8->addView(view__13); -auto* const view__14 = createInactiveLabel(CRect(10, 40, 370, 70), -1, "No key switch", kLeftText, 20); -keyswitchInactiveLabel_ = view__14; -view__8->addView(view__14); -view__14->setVisible(false); -auto* const view__15 = createLabel(CRect(10, 73, 70, 98), -1, "Voices:", kRightText, 12); -view__8->addView(view__15); -auto* const view__16 = createPreviousFileButton(CRect(330, 13, 355, 38), kTagPreviousSfzFile, "", kCenterText, 24); -view__8->addView(view__16); -auto* const view__17 = createNextFileButton(CRect(355, 13, 380, 38), kTagNextSfzFile, "", kCenterText, 24); -view__8->addView(view__17); -auto* const view__18 = createChevronDropDown(CRect(380, 13, 405, 38), kTagFileOperations, "", kCenterText, 24); -fileOperationsMenu_ = view__18; -view__8->addView(view__18); -auto* const view__19 = createLabel(CRect(75, 73, 115, 98), -1, "", kCenterText, 12); -infoVoicesLabel_ = view__19; -view__8->addView(view__19); -auto* const view__20 = createLabel(CRect(147, 73, 187, 98), -1, "Max:", kRightText, 12); -view__8->addView(view__20); -auto* const view__21 = createLabel(CRect(193, 73, 228, 98), -1, "", kCenterText, 12); -numVoicesLabel_ = view__21; -view__8->addView(view__21); -auto* const view__22 = createLabel(CRect(274, 73, 334, 98), -1, "Memory:", kRightText, 12); -view__8->addView(view__22); -auto* const view__23 = createLabel(CRect(340, 73, 400, 98), -1, "", kCenterText, 12); -memoryLabel_ = view__23; -view__8->addView(view__23); -auto* const view__24 = createChevronValueDropDown(CRect(235, 77, 255, 97), kTagSetNumVoices, "", kCenterText, 16); -numVoicesSlider_ = view__24; -view__8->addView(view__24); -auto* const view__25 = createRoundedGroup(CRect(608, 5, 795, 105), -1, "", kCenterText, 14); -view__2->addView(view__25); -auto* const view__26 = createKnob48(CRect(7, 15, 55, 63), -1, "", kCenterText, 14); -view__25->addView(view__26); -view__26->setVisible(false); -auto* const view__27 = createValueLabel(CRect(2, 65, 62, 70), -1, "Center", kCenterText, 12); -view__25->addView(view__27); +auto* const view__8 = createHomeButton(CRect(11, 69, 43, 101), kTagFirstChangePanel+kPanelGeneral, "", kCenterText, 30); +panelButtons_[kPanelGeneral] = view__8; +view__3->addView(view__8); +auto* const view__9 = createRoundedGroup(CRect(185, 5, 603, 105), -1, "", kCenterText, 14); +view__2->addView(view__9); +auto* const view__10 = createHLine(CRect(10, 36, 405, 41), -1, "", kCenterText, 14); +view__9->addView(view__10); +auto* const view__11 = createHLine(CRect(10, 68, 405, 73), -1, "", kCenterText, 14); +view__9->addView(view__11); +auto* const view__12 = createClickableLabel(CRect(10, 8, 330, 38), kTagLoadSfzFile, "DefaultInstrument.sfz", kLeftText, 20); +sfzFileLabel_ = view__12; +view__9->addView(view__12); +auto* const view__13 = createLabel(CRect(80, 40, 405, 75), -1, "", kLeftText, 20); +keyswitchLabel_ = view__13; +view__9->addView(view__13); +auto* const view__14 = createBadge(CRect(10, 42, 70, 68), -1, "", kCenterText, 20); +keyswitchBadge_ = view__14; +view__9->addView(view__14); +auto* const view__15 = createInactiveLabel(CRect(10, 40, 370, 70), -1, "No key switch", kLeftText, 20); +keyswitchInactiveLabel_ = view__15; +view__9->addView(view__15); +view__15->setVisible(false); +auto* const view__16 = createLabel(CRect(10, 73, 70, 98), -1, "Voices:", kRightText, 12); +view__9->addView(view__16); +auto* const view__17 = createPreviousFileButton(CRect(330, 13, 355, 38), kTagPreviousSfzFile, "", kCenterText, 24); +view__9->addView(view__17); +auto* const view__18 = createNextFileButton(CRect(355, 13, 380, 38), kTagNextSfzFile, "", kCenterText, 24); +view__9->addView(view__18); +auto* const view__19 = createChevronDropDown(CRect(380, 13, 405, 38), kTagFileOperations, "", kCenterText, 24); +fileOperationsMenu_ = view__19; +view__9->addView(view__19); +auto* const view__20 = createLabel(CRect(75, 73, 115, 98), -1, "", kCenterText, 12); +infoVoicesLabel_ = view__20; +view__9->addView(view__20); +auto* const view__21 = createLabel(CRect(147, 73, 187, 98), -1, "Max:", kRightText, 12); +view__9->addView(view__21); +auto* const view__22 = createLabel(CRect(193, 73, 228, 98), -1, "", kCenterText, 12); +numVoicesLabel_ = view__22; +view__9->addView(view__22); +auto* const view__23 = createLabel(CRect(274, 73, 334, 98), -1, "Memory:", kRightText, 12); +view__9->addView(view__23); +auto* const view__24 = createLabel(CRect(340, 73, 400, 98), -1, "", kCenterText, 12); +memoryLabel_ = view__24; +view__9->addView(view__24); +auto* const view__25 = createChevronValueDropDown(CRect(235, 77, 255, 97), kTagSetNumVoices, "", kCenterText, 16); +numVoicesSlider_ = view__25; +view__9->addView(view__25); +auto* const view__26 = createRoundedGroup(CRect(608, 5, 795, 105), -1, "", kCenterText, 14); +view__2->addView(view__26); +auto* const view__27 = createKnob48(CRect(7, 15, 55, 63), -1, "", kCenterText, 14); +view__26->addView(view__27); view__27->setVisible(false); -auto* const view__28 = createKnobCCBox(CRect(6, 5, 76, 95), kTagSetCCVolume, "Volume", kCenterText, 12); -volumeCCKnob_ = view__28; -view__25->addView(view__28); -auto* const view__29 = createKnobCCBox(CRect(83, 5, 153, 95), kTagSetCCPan, "Pan", kCenterText, 12); -panCCKnob_ = view__29; -view__25->addView(view__29); -auto* const view__30 = createVMeter(CRect(159, 5, 168, 95), -1, "", kCenterText, 14); -leftMeter_ = view__30; -view__25->addView(view__30); -auto* const view__31 = createVMeter(CRect(171, 5, 180, 95), -1, "", kCenterText, 14); -rightMeter_ = view__31; -view__25->addView(view__31); +auto* const view__28 = createValueLabel(CRect(2, 65, 62, 70), -1, "Center", kCenterText, 12); +view__26->addView(view__28); +view__28->setVisible(false); +auto* const view__29 = createKnobCCBox(CRect(6, 5, 76, 95), kTagSetCCVolume, "Volume", kCenterText, 12); +volumeCCKnob_ = view__29; +view__26->addView(view__29); +auto* const view__30 = createKnobCCBox(CRect(83, 5, 153, 95), kTagSetCCPan, "Pan", kCenterText, 12); +panCCKnob_ = view__30; +view__26->addView(view__30); +auto* const view__31 = createVMeter(CRect(159, 5, 168, 95), -1, "", kCenterText, 14); +leftMeter_ = view__31; +view__26->addView(view__31); +auto* const view__32 = createVMeter(CRect(171, 5, 180, 95), -1, "", kCenterText, 14); +rightMeter_ = view__32; +view__26->addView(view__32); enterPalette(defaultPalette); -auto* const view__32 = createLogicalGroup(CRect(5, 110, 796, 395), -1, "", kCenterText, 14); -subPanels_[kPanelGeneral] = view__32; -view__0->addView(view__32); -view__32->setVisible(false); -auto* const view__33 = createRoundedGroup(CRect(0, 0, 175, 280), -1, "", kCenterText, 14); -view__32->addView(view__33); -auto* const view__34 = createLabel(CRect(15, 10, 75, 35), -1, "Curves:", kLeftText, 14); +auto* const view__33 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); +subPanels_[kPanelInfo] = view__33; +view__0->addView(view__33); +view__33->setVisible(false); +auto* const view__34 = createRoundedGroup(CRect(0, 0, 790, 285), -1, "", kCenterText, 14); view__33->addView(view__34); -auto* const view__35 = createLabel(CRect(15, 35, 75, 60), -1, "Masters:", kLeftText, 14); -view__33->addView(view__35); -auto* const view__36 = createLabel(CRect(15, 60, 75, 85), -1, "Groups:", kLeftText, 14); -view__33->addView(view__36); -auto* const view__37 = createLabel(CRect(15, 85, 75, 110), -1, "Regions:", kLeftText, 14); -view__33->addView(view__37); -auto* const view__38 = createLabel(CRect(15, 110, 75, 135), -1, "Samples:", kLeftText, 14); -view__33->addView(view__38); -auto* const view__39 = createLabel(CRect(115, 10, 155, 35), -1, "0", kCenterText, 14); -infoCurvesLabel_ = view__39; -view__33->addView(view__39); -auto* const view__40 = createLabel(CRect(115, 35, 155, 60), -1, "0", kCenterText, 14); -infoMastersLabel_ = view__40; -view__33->addView(view__40); -auto* const view__41 = createLabel(CRect(115, 60, 155, 85), -1, "0", kCenterText, 14); -infoGroupsLabel_ = view__41; -view__33->addView(view__41); -auto* const view__42 = createLabel(CRect(115, 85, 155, 110), -1, "0", kCenterText, 14); -infoRegionsLabel_ = view__42; -view__33->addView(view__42); -auto* const view__43 = createLabel(CRect(115, 110, 155, 135), -1, "0", kCenterText, 14); -infoSamplesLabel_ = view__43; -view__33->addView(view__43); -auto* const view__44 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); -subPanels_[kPanelControls] = view__44; -view__0->addView(view__44); -view__44->setVisible(false); -auto* const view__45 = createRoundedGroup(CRect(0, 0, 790, 285), -1, "", kCenterText, 14); -view__44->addView(view__45); -auto* const view__46 = createControlsPanel(CRect(0, 0, 790, 285), -1, "", kCenterText, 12); -controlsPanel_ = view__46; +auto* const view__35 = createLabel(CRect(15, 10, 75, 35), -1, "Curves:", kLeftText, 14); +view__34->addView(view__35); +auto* const view__36 = createLabel(CRect(15, 35, 75, 60), -1, "Masters:", kLeftText, 14); +view__34->addView(view__36); +auto* const view__37 = createLabel(CRect(15, 60, 75, 85), -1, "Groups:", kLeftText, 14); +view__34->addView(view__37); +auto* const view__38 = createLabel(CRect(15, 85, 75, 110), -1, "Regions:", kLeftText, 14); +view__34->addView(view__38); +auto* const view__39 = createLabel(CRect(15, 110, 75, 135), -1, "Samples:", kLeftText, 14); +view__34->addView(view__39); +auto* const view__40 = createLabel(CRect(115, 10, 155, 35), -1, "0", kCenterText, 14); +infoCurvesLabel_ = view__40; +view__34->addView(view__40); +auto* const view__41 = createLabel(CRect(115, 35, 155, 60), -1, "0", kCenterText, 14); +infoMastersLabel_ = view__41; +view__34->addView(view__41); +auto* const view__42 = createLabel(CRect(115, 60, 155, 85), -1, "0", kCenterText, 14); +infoGroupsLabel_ = view__42; +view__34->addView(view__42); +auto* const view__43 = createLabel(CRect(115, 85, 155, 110), -1, "0", kCenterText, 14); +infoRegionsLabel_ = view__43; +view__34->addView(view__43); +auto* const view__44 = createLabel(CRect(115, 110, 155, 135), -1, "0", kCenterText, 14); +infoSamplesLabel_ = view__44; +view__34->addView(view__44); +auto* const view__45 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); +subPanels_[kPanelControls] = view__45; +view__0->addView(view__45); +view__45->setVisible(false); +auto* const view__46 = createRoundedGroup(CRect(0, 0, 790, 285), -1, "", kCenterText, 14); view__45->addView(view__46); -auto* const view__47 = createLogicalGroup(CRect(5, 109, 795, 425), -1, "", kCenterText, 14); -subPanels_[kPanelSettings] = view__47; -view__0->addView(view__47); -auto* const view__48 = createTitleGroup(CRect(300, 26, 495, 126), -1, "Engine", kCenterText, 12); -view__47->addView(view__48); -auto* const view__49 = createValueMenu(CRect(25, 60, 85, 85), kTagSetOversampling, "", kCenterText, 12); -oversamplingSlider_ = view__49; +auto* const view__47 = createControlsPanel(CRect(0, 0, 790, 285), -1, "", kCenterText, 12); +controlsPanel_ = view__47; +view__46->addView(view__47); +auto* const view__48 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); +subPanels_[kPanelSettings] = view__48; +view__0->addView(view__48); +auto* const view__49 = createTitleGroup(CRect(300, 25, 495, 125), -1, "Engine", kCenterText, 12); view__48->addView(view__49); -auto* const view__50 = createValueLabel(CRect(15, 20, 95, 45), -1, "Oversampling", kCenterText, 12); -view__48->addView(view__50); -auto* const view__51 = createValueLabel(CRect(100, 20, 180, 45), -1, "Preload size", kCenterText, 12); -view__48->addView(view__51); -auto* const view__52 = createValueMenu(CRect(110, 60, 170, 85), kTagSetPreloadSize, "", kCenterText, 12); -preloadSizeSlider_ = view__52; -view__48->addView(view__52); -auto* const view__53 = createTitleGroup(CRect(170, 161, 585, 261), -1, "Tuning", kCenterText, 12); -view__47->addView(view__53); -auto* const view__54 = createValueLabel(CRect(155, 20, 235, 45), -1, "Root key", kCenterText, 12); -view__53->addView(view__54); -auto* const view__55 = createValueMenu(CRect(250, 60, 310, 85), kTagSetTuningFrequency, "", kCenterText, 12); -tuningFrequencySlider_ = view__55; -view__53->addView(view__55); -auto* const view__56 = createValueLabel(CRect(240, 20, 320, 45), -1, "Frequency", kCenterText, 12); -view__53->addView(view__56); -auto* const view__57 = createStyledKnob(CRect(340, 45, 388, 93), kTagSetStretchedTuning, "", kCenterText, 14); -stretchedTuningSlider_ = view__57; -view__53->addView(view__57); -auto* const view__58 = createValueLabel(CRect(325, 20, 405, 45), -1, "Stretch", kCenterText, 12); -view__53->addView(view__58); -auto* const view__59 = createValueLabel(CRect(20, 20, 120, 45), -1, "Scala file", kCenterText, 12); -view__53->addView(view__59); -auto* const view__60 = createValueButton(CRect(20, 60, 120, 85), kTagLoadScalaFile, "DefaultScale", kCenterText, 12); -scalaFileButton_ = view__60; -view__53->addView(view__60); -auto* const view__61 = createValueMenu(CRect(165, 60, 200, 85), kTagSetScalaRootKey, "", kCenterText, 12); -scalaRootKeySlider_ = view__61; -view__53->addView(view__61); -auto* const view__62 = createValueMenu(CRect(200, 60, 230, 85), kTagSetScalaRootKey, "", kCenterText, 12); -scalaRootOctaveSlider_ = view__62; -view__53->addView(view__62); -auto* const view__63 = createResetSomethingButton(CRect(120, 60, 145, 85), kTagResetScalaFile, "", kCenterText, 12); -scalaResetButton_ = view__63; -view__53->addView(view__63); -auto* const view__64 = createTitleGroup(CRect(615, 161, 754, 261), -1, "Files", kCenterText, 12); -userFilesGroup_ = view__64; -view__47->addView(view__64); -auto* const view__65 = createValueLabel(CRect(20, 20, 120, 45), -1, "User SFZ folder", kCenterText, 12); -view__64->addView(view__65); -auto* const view__66 = createValueButton(CRect(20, 60, 120, 85), kTagChooseUserFilesDir, "DefaultPath", kCenterText, 12); -userFilesDirButton_ = view__66; -view__64->addView(view__66); -auto* const view__67 = createTitleGroup(CRect(525, 26, 720, 126), -1, "Quality", kCenterText, 12); -view__47->addView(view__67); -auto* const view__68 = createValueMenu(CRect(15, 60, 95, 85), kTagSetSampleQuality, "", kCenterText, 12); -sampleQualitySlider_ = view__68; -view__67->addView(view__68); -auto* const view__69 = createValueLabel(CRect(15, 20, 95, 45), -1, "Sample", kCenterText, 12); -view__67->addView(view__69); -auto* const view__70 = createValueLabel(CRect(100, 20, 180, 45), -1, "Oscillator", kCenterText, 12); -view__67->addView(view__70); -auto* const view__71 = createValueMenu(CRect(100, 60, 180, 85), kTagSetOscillatorQuality, "", kCenterText, 12); -oscillatorQualitySlider_ = view__71; -view__67->addView(view__71); -auto* const view__72 = createTitleGroup(CRect(35, 161, 140, 261), -1, "Appearance", kCenterText, 12); -view__47->addView(view__72); -auto* const view__73 = createOptionMenu(CRect(20, 60, 85, 85), kTagThemeMenu, "", kCenterText, 12); -themeMenu_ = view__73; -view__72->addView(view__73); -auto* const view__74 = createValueLabel(CRect(10, 25, 90, 50), -1, "Theme", kCenterText, 12); -view__72->addView(view__74); -auto* const view__75 = createPiano(CRect(5, 400, 795, 470), -1, "", kCenterText, 12); -piano_ = view__75; -view__0->addView(view__75); +auto* const view__50 = createValueMenu(CRect(25, 60, 85, 85), kTagSetOversampling, "", kCenterText, 12); +oversamplingSlider_ = view__50; +view__49->addView(view__50); +auto* const view__51 = createValueLabel(CRect(15, 20, 95, 45), -1, "Oversampling", kCenterText, 12); +view__49->addView(view__51); +auto* const view__52 = createValueLabel(CRect(100, 20, 180, 45), -1, "Preload size", kCenterText, 12); +view__49->addView(view__52); +auto* const view__53 = createValueMenu(CRect(110, 60, 170, 85), kTagSetPreloadSize, "", kCenterText, 12); +preloadSizeSlider_ = view__53; +view__49->addView(view__53); +auto* const view__54 = createTitleGroup(CRect(170, 160, 585, 260), -1, "Tuning", kCenterText, 12); +view__48->addView(view__54); +auto* const view__55 = createValueLabel(CRect(155, 20, 235, 45), -1, "Root key", kCenterText, 12); +view__54->addView(view__55); +auto* const view__56 = createValueMenu(CRect(250, 60, 310, 85), kTagSetTuningFrequency, "", kCenterText, 12); +tuningFrequencySlider_ = view__56; +view__54->addView(view__56); +auto* const view__57 = createValueLabel(CRect(240, 20, 320, 45), -1, "Frequency", kCenterText, 12); +view__54->addView(view__57); +auto* const view__58 = createStyledKnob(CRect(340, 45, 388, 93), kTagSetStretchedTuning, "", kCenterText, 14); +stretchedTuningSlider_ = view__58; +view__54->addView(view__58); +auto* const view__59 = createValueLabel(CRect(325, 20, 405, 45), -1, "Stretch", kCenterText, 12); +view__54->addView(view__59); +auto* const view__60 = createValueLabel(CRect(20, 20, 120, 45), -1, "Scala file", kCenterText, 12); +view__54->addView(view__60); +auto* const view__61 = createValueButton(CRect(20, 60, 120, 85), kTagLoadScalaFile, "DefaultScale", kCenterText, 12); +scalaFileButton_ = view__61; +view__54->addView(view__61); +auto* const view__62 = createValueMenu(CRect(165, 60, 200, 85), kTagSetScalaRootKey, "", kCenterText, 12); +scalaRootKeySlider_ = view__62; +view__54->addView(view__62); +auto* const view__63 = createValueMenu(CRect(200, 60, 230, 85), kTagSetScalaRootKey, "", kCenterText, 12); +scalaRootOctaveSlider_ = view__63; +view__54->addView(view__63); +auto* const view__64 = createResetSomethingButton(CRect(120, 60, 145, 85), kTagResetScalaFile, "", kCenterText, 12); +scalaResetButton_ = view__64; +view__54->addView(view__64); +auto* const view__65 = createTitleGroup(CRect(615, 160, 754, 260), -1, "Files", kCenterText, 12); +userFilesGroup_ = view__65; +view__48->addView(view__65); +auto* const view__66 = createValueLabel(CRect(20, 20, 120, 45), -1, "User SFZ folder", kCenterText, 12); +view__65->addView(view__66); +auto* const view__67 = createValueButton(CRect(20, 60, 120, 85), kTagChooseUserFilesDir, "DefaultPath", kCenterText, 12); +userFilesDirButton_ = view__67; +view__65->addView(view__67); +auto* const view__68 = createTitleGroup(CRect(525, 25, 720, 125), -1, "Quality", kCenterText, 12); +view__48->addView(view__68); +auto* const view__69 = createValueMenu(CRect(15, 60, 95, 85), kTagSetSampleQuality, "", kCenterText, 12); +sampleQualitySlider_ = view__69; +view__68->addView(view__69); +auto* const view__70 = createValueLabel(CRect(15, 20, 95, 45), -1, "Sample", kCenterText, 12); +view__68->addView(view__70); +auto* const view__71 = createValueLabel(CRect(100, 20, 180, 45), -1, "Oscillator", kCenterText, 12); +view__68->addView(view__71); +auto* const view__72 = createValueMenu(CRect(100, 60, 180, 85), kTagSetOscillatorQuality, "", kCenterText, 12); +oscillatorQualitySlider_ = view__72; +view__68->addView(view__72); +auto* const view__73 = createTitleGroup(CRect(35, 160, 140, 260), -1, "Appearance", kCenterText, 12); +view__48->addView(view__73); +auto* const view__74 = createOptionMenu(CRect(20, 60, 85, 85), kTagThemeMenu, "", kCenterText, 12); +themeMenu_ = view__74; +view__73->addView(view__74); +auto* const view__75 = createValueLabel(CRect(10, 25, 90, 50), -1, "Theme", kCenterText, 12); +view__73->addView(view__75); +auto* const view__76 = createPiano(CRect(5, 400, 795, 470), -1, "", kCenterText, 12); +piano_ = view__76; +view__0->addView(view__76); +auto* const view__77 = createLogicalGroup(CRect(5, 110, 795, 395), -1, "", kCenterText, 14); +subPanels_[kPanelGeneral] = view__77; +view__0->addView(view__77); +view__77->setVisible(false); diff --git a/plugins/lv2/sfizz.cpp b/plugins/lv2/sfizz.cpp index 6c1d56a2..6f22f8fc 100644 --- a/plugins/lv2/sfizz.cpp +++ b/plugins/lv2/sfizz.cpp @@ -35,7 +35,7 @@ #include "sfizz_lv2.h" #include "sfizz_lv2_plugin.h" -#include "sfizz/import/ForeignInstrument.h" +#include "sfizz/import/sfizz_import.h" #include "plugin/InstrumentDescription.h" #include @@ -123,6 +123,7 @@ sfizz_lv2_map_required_uris(sfizz_plugin_t *self) self->sfizz_log_status_uri = map->map(map->handle, SFIZZ__logStatus); self->sfizz_check_modification_uri = map->map(map->handle, SFIZZ__checkModification); self->sfizz_osc_blob_uri = map->map(map->handle, SFIZZ__OSCBlob); + self->sfizz_notify_uri = map->map(map->handle, SFIZZ__Notify); self->sfizz_audio_level_uri = map->map(map->handle, SFIZZ__AudioLevel); self->time_position_uri = map->map(map->handle, LV2_TIME__Position); self->time_bar_uri = map->map(map->handle, LV2_TIME__bar); @@ -200,9 +201,6 @@ connect_port(LV2_Handle instance, case SFIZZ_CONTROL: self->control_port = (const LV2_Atom_Sequence *)data; break; - case SFIZZ_NOTIFY: - self->notify_port = (LV2_Atom_Sequence *)data; - break; case SFIZZ_AUTOMATE: self->automate_port = (LV2_Atom_Sequence *)data; break; @@ -331,7 +329,7 @@ sfizz_lv2_receive_message(void* data, int delay, const char* path, const char* s if (osc_size > OSC_TEMP_SIZE) return; - LV2_Atom_Forge* forge = &self->forge_notify; + LV2_Atom_Forge* forge = &self->forge_automate; bool write_ok = lv2_atom_forge_frame_time(forge, 0) && lv2_atom_forge_atom(forge, osc_size, self->sfizz_osc_blob_uri) && @@ -439,7 +437,6 @@ instantiate(const LV2_Descriptor *descriptor, sfizz_lv2_map_required_uris(self); // Initialize the forge - lv2_atom_forge_init(&self->forge_notify, self->map); lv2_atom_forge_init(&self->forge_automate, self->map); lv2_atom_forge_init(&self->forge_secondary, self->map); @@ -545,13 +542,14 @@ deactivate(LV2_Handle instance) } static void -sfizz_lv2_send_file_path(sfizz_plugin_t *self, LV2_Atom_Forge* forge, LV2_URID urid, const char *path) +sfizz_lv2_send_file_path(sfizz_plugin_t *self, LV2_URID verb_uri, LV2_URID urid, const char *path) { LV2_Atom_Forge_Frame frame; + LV2_Atom_Forge* forge = &self->forge_automate; bool write_ok = lv2_atom_forge_frame_time(forge, 0) && - lv2_atom_forge_object(forge, &frame, 0, self->patch_set_uri) && + lv2_atom_forge_object(forge, &frame, 0, verb_uri) && lv2_atom_forge_key(forge, self->patch_property_uri) && lv2_atom_forge_urid(forge, urid) && lv2_atom_forge_key(forge, self->patch_value_uri) && @@ -562,14 +560,15 @@ sfizz_lv2_send_file_path(sfizz_plugin_t *self, LV2_Atom_Forge* forge, LV2_URID u } static void -sfizz_lv2_send_controller(sfizz_plugin_t *self, LV2_Atom_Forge* forge, unsigned cc, float value) +sfizz_lv2_send_controller(sfizz_plugin_t *self, LV2_URID verb_uri, unsigned cc, float value) { LV2_URID urid = sfizz_lv2_ccmap_map(self->ccmap, int(cc)); LV2_Atom_Forge_Frame frame; + LV2_Atom_Forge* forge = &self->forge_automate; bool write_ok = lv2_atom_forge_frame_time(forge, 0) && - lv2_atom_forge_object(forge, &frame, 0, self->patch_set_uri) && + lv2_atom_forge_object(forge, &frame, 0, verb_uri) && lv2_atom_forge_key(forge, self->patch_property_uri) && lv2_atom_forge_urid(forge, urid) && lv2_atom_forge_key(forge, self->patch_value_uri) && @@ -581,11 +580,12 @@ sfizz_lv2_send_controller(sfizz_plugin_t *self, LV2_Atom_Forge* forge, unsigned #if defined(SFIZZ_LV2_UI) static void -sfizz_lv2_send_levels(sfizz_plugin_t *self, LV2_Atom_Forge* forge, float left, float right) +sfizz_lv2_send_levels(sfizz_plugin_t *self, float left, float right) { const float levels[] = {left, right}; uint32_t num_levels = sizeof(levels) / sizeof(levels[0]); + LV2_Atom_Forge* forge = &self->forge_automate; bool write_ok = lv2_atom_forge_frame_time(forge, 0); LV2_Atom_Vector *vector = nullptr; @@ -871,7 +871,7 @@ static void run(LV2_Handle instance, uint32_t sample_count) { sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - assert(self->control_port && self->notify_port && self->automate_port); + assert(self->control_port && self->automate_port); if (!spin_mutex_trylock(self->synth_mutex)) { @@ -881,15 +881,10 @@ run(LV2_Handle instance, uint32_t sample_count) } // Set up dedicated forges to write on their respective ports. - const size_t notify_capacity = self->notify_port->atom.size; - lv2_atom_forge_set_buffer(&self->forge_notify, (uint8_t *)self->notify_port, notify_capacity); const size_t automate_capacity = self->automate_port->atom.size; lv2_atom_forge_set_buffer(&self->forge_automate, (uint8_t *)self->automate_port, automate_capacity); // Start sequences in the respective output ports. - LV2_Atom_Forge_Frame notify_frame; - if (!lv2_atom_forge_sequence_head(&self->forge_notify, ¬ify_frame, 0)) - assert(false); LV2_Atom_Forge_Frame automate_frame; if (!lv2_atom_forge_sequence_head(&self->forge_automate, &automate_frame, 0)) assert(false); @@ -913,25 +908,25 @@ run(LV2_Handle instance, uint32_t sample_count) lv2_atom_object_get(obj, self->patch_property_uri, &property, 0); if (!property) // Send the full state { - sfizz_lv2_send_file_path(self, &self->forge_notify, self->sfizz_sfz_file_uri, self->sfz_file_path); - sfizz_lv2_send_file_path(self, &self->forge_notify, self->sfizz_scala_file_uri, self->scala_file_path); + sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_sfz_file_uri, self->sfz_file_path); + sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_scala_file_uri, self->scala_file_path); for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) - sfizz_lv2_send_controller(self, &self->forge_notify, cc, self->cc_current[cc]); + sfizz_lv2_send_controller(self, self->sfizz_notify_uri, cc, self->cc_current[cc]); } else if (property->body == self->sfizz_sfz_file_uri) { - sfizz_lv2_send_file_path(self, &self->forge_notify, self->sfizz_sfz_file_uri, self->sfz_file_path); + sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_sfz_file_uri, self->sfz_file_path); } else if (property->body == self->sfizz_scala_file_uri) { - sfizz_lv2_send_file_path(self, &self->forge_notify, self->sfizz_scala_file_uri, self->scala_file_path); + sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_scala_file_uri, self->scala_file_path); } else { int cc = sfizz_lv2_ccmap_unmap(self->ccmap, property->body); if (cc != -1) - sfizz_lv2_send_controller(self, &self->forge_notify, unsigned(cc), self->cc_current[cc]); + sfizz_lv2_send_controller(self, self->sfizz_notify_uri, unsigned(cc), self->cc_current[cc]); } } else if (obj->body.otype == self->time_position_uri) @@ -1079,7 +1074,7 @@ run(LV2_Handle instance, uint32_t sample_count) for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { absl::optional value = self->ccauto[cc]; if (value) { - sfizz_lv2_send_controller(self, &self->forge_automate, cc, *value); + sfizz_lv2_send_controller(self, self->patch_set_uri, cc, *value); self->ccauto[cc] = absl::nullopt; } } @@ -1094,7 +1089,7 @@ run(LV2_Handle instance, uint32_t sample_count) self->rms_follower.process(self->output_buffers[0], self->output_buffers[1], sample_count); const simde__m128 rms = self->rms_follower.getRMS(); const float *levels = (const float *)&rms; - sfizz_lv2_send_levels(self, &self->forge_notify, levels[0], levels[1]); + sfizz_lv2_send_levels(self, levels[0], levels[1]); } else { @@ -1102,7 +1097,6 @@ run(LV2_Handle instance, uint32_t sample_count) } #endif - lv2_atom_forge_pop(&self->forge_notify, ¬ify_frame); lv2_atom_forge_pop(&self->forge_automate, &automate_frame); } @@ -1237,8 +1231,6 @@ sfizz_lv2_update_sfz_info(sfizz_plugin_t *self) static bool sfizz_lv2_load_file(sfizz_plugin_t *self, const char *file_path) { - bool status; - char buf[MAX_PATH_SIZE]; if (file_path[0] == '\0') { @@ -1247,18 +1239,7 @@ sfizz_lv2_load_file(sfizz_plugin_t *self, const char *file_path) } /// - const sfz::InstrumentFormatRegistry& formatRegistry = sfz::InstrumentFormatRegistry::getInstance(); - const sfz::InstrumentFormat* format = formatRegistry.getMatchingFormat(file_path); - - if (!format) - status = sfizz_load_file(self->synth, file_path); - else { - auto importer = format->createImporter(); - std::string virtual_path = std::string(file_path) + ".sfz"; - std::string sfz_text = importer->convertToSfz(file_path); - status = sfizz_load_string(self->synth, virtual_path.c_str(), sfz_text.c_str()); - } - + bool status = sfizz_load_or_import_file(self->synth, file_path, nullptr); sfizz_lv2_update_sfz_info(self); sfizz_lv2_update_file_info(self, file_path); return status; diff --git a/plugins/lv2/sfizz.ttl.in b/plugins/lv2/sfizz.ttl.in index 83bddf76..fd860990 100644 --- a/plugins/lv2/sfizz.ttl.in +++ b/plugins/lv2/sfizz.ttl.in @@ -102,7 +102,7 @@ midnam:update a lv2:Feature . lv2:port [ a lv2:InputPort, atom:AtomPort ; atom:bufferType atom:Sequence ; - atom:supports patch:Message, midi:MidiEvent, time:Position, <@LV2PLUGIN_URI@:OSCBlob> ; + atom:supports patch:Message, midi:MidiEvent, time:Position, <@LV2PLUGIN_URI@:OSCBlob>, <@LV2PLUGIN_URI@:Notify> ; lv2:designation lv2:control ; lv2:index 0 ; lv2:symbol "control" ; @@ -113,24 +113,15 @@ midnam:update a lv2:Feature . a lv2:OutputPort, atom:AtomPort ; atom:bufferType atom:Sequence ; atom:supports patch:Message, <@LV2PLUGIN_URI@:OSCBlob> ; - lv2:index 1 ; - lv2:symbol "notify" ; - lv2:name "Notify", - "Notification"@fr ; - rsz:minimumSize 524288 ; - ] , [ - a lv2:OutputPort, atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message ; lv2:designation lv2:control ; - lv2:index 2 ; + lv2:index 1 ; lv2:symbol "automate" ; lv2:name "Automate", "Automatisation"@fr ; rsz:minimumSize 524288 ; ] , [ a lv2:AudioPort, lv2:OutputPort ; - lv2:index 3 ; + lv2:index 2 ; lv2:symbol "out_left" ; lv2:name "Left Output", "Sortie gauche"@fr , @@ -139,7 +130,7 @@ midnam:update a lv2:Feature . lv2:designation pg:left ] , [ a lv2:AudioPort, lv2:OutputPort ; - lv2:index 4 ; + lv2:index 3 ; lv2:symbol "out_right" ; lv2:name "Right Output", "Sortie droite"@fr , @@ -148,7 +139,7 @@ midnam:update a lv2:Feature . lv2:designation pg:right ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 5 ; + lv2:index 4 ; lv2:symbol "volume" ; lv2:name "Volume" ; lv2:default 0.0 ; @@ -157,7 +148,7 @@ midnam:update a lv2:Feature . units:unit units:db ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 6 ; + lv2:index 5 ; lv2:symbol "num_voices" ; lv2:name "Polyphony", "Polyphonie"@fr , @@ -202,7 +193,7 @@ midnam:update a lv2:Feature . ] ; ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 7 ; + lv2:index 6 ; lv2:symbol "oversampling" ; lv2:name "Oversampling factor", "Facteur de suréchantillonnage"@fr , @@ -237,7 +228,7 @@ midnam:update a lv2:Feature . ] ; ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 8 ; + lv2:index 7 ; lv2:symbol "preload_size" ; lv2:name "Preload size", "Taille préchargée"@fr , @@ -280,7 +271,7 @@ midnam:update a lv2:Feature . ] ; ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 9 ; + lv2:index 8 ; lv2:symbol "freewheeling" ; lv2:name "Freewheeling", "En roue libre (freewheeling)"@fr , @@ -292,7 +283,7 @@ midnam:update a lv2:Feature . lv2:maximum 1 ; ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 10 ; + lv2:index 9 ; lv2:symbol "scala_root_key" ; lv2:name "Scala root key", "Tonalité de base Scala"@fr , @@ -305,7 +296,7 @@ midnam:update a lv2:Feature . units:unit units:midiNote ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 11 ; + lv2:index 10 ; lv2:symbol "tuning_frequency" ; lv2:name "Tuning frequency", "Fréquence d'accordage"@fr , @@ -317,7 +308,7 @@ midnam:update a lv2:Feature . units:unit units:hz ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 12 ; + lv2:index 11 ; lv2:symbol "stretched_tuning" ; lv2:name "Stretched tuning", "Accordage étiré"@fr , @@ -329,7 +320,7 @@ midnam:update a lv2:Feature . units:unit units:coef ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 13 ; + lv2:index 12 ; lv2:symbol "sample_quality" ; lv2:name "Sample quality", "Qualité des échantillons"@fr , @@ -340,7 +331,7 @@ midnam:update a lv2:Feature . lv2:maximum 10.0 ] , [ a lv2:InputPort, lv2:ControlPort ; - lv2:index 14 ; + lv2:index 13 ; lv2:symbol "oscillator_quality" ; lv2:name "Oscillator quality", "Qualité des oscillateurs"@fr , @@ -351,7 +342,7 @@ midnam:update a lv2:Feature . lv2:maximum 3.0 ] , [ a lv2:OutputPort, lv2:ControlPort ; - lv2:index 15 ; + lv2:index 14 ; lv2:symbol "active_voices" ; lv2:name "Active voices", "Voix utilisées"@fr ; @@ -362,7 +353,7 @@ midnam:update a lv2:Feature . lv2:maximum 256 ; ] , [ a lv2:OutputPort, lv2:ControlPort ; - lv2:index 16 ; + lv2:index 15 ; lv2:symbol "num_curves" ; lv2:name "Number of curves", "Nombre de courbes"@fr ; @@ -373,7 +364,7 @@ midnam:update a lv2:Feature . lv2:maximum 65535 ; ] , [ a lv2:OutputPort, lv2:ControlPort ; - lv2:index 17 ; + lv2:index 16 ; lv2:symbol "num_masters" ; lv2:name "Number of masters", "Nombre de maîtres"@fr ; @@ -384,7 +375,7 @@ midnam:update a lv2:Feature . lv2:maximum 65535 ; ] , [ a lv2:OutputPort, lv2:ControlPort ; - lv2:index 18 ; + lv2:index 17 ; lv2:symbol "num_groups" ; lv2:name "Number of groups", "Nombre de groupes"@fr ; @@ -395,7 +386,7 @@ midnam:update a lv2:Feature . lv2:maximum 65535 ; ] , [ a lv2:OutputPort, lv2:ControlPort ; - lv2:index 19 ; + lv2:index 18 ; lv2:symbol "num_regions" ; lv2:name "Number of regions", "Nombre de régions"@fr ; @@ -406,7 +397,7 @@ midnam:update a lv2:Feature . lv2:maximum 65535 ; ] , [ a lv2:OutputPort, lv2:ControlPort ; - lv2:index 20 ; + lv2:index 19 ; lv2:symbol "num_samples" ; lv2:name "Number of samples", "Nombre d'échantillons"@fr ; diff --git a/plugins/lv2/sfizz_lv2.h b/plugins/lv2/sfizz_lv2.h index dfc3a116..f48f2606 100644 --- a/plugins/lv2/sfizz_lv2.h +++ b/plugins/lv2/sfizz_lv2.h @@ -44,32 +44,32 @@ #define SFIZZ__checkModification SFIZZ_URI ":" "check_modification" // OSC atoms #define SFIZZ__OSCBlob SFIZZ_URI ":" "OSCBlob" +#define SFIZZ__Notify SFIZZ_URI ":" "Notify" // Level atoms #define SFIZZ__AudioLevel SFIZZ_URI ":" "AudioLevel" enum { SFIZZ_CONTROL = 0, - SFIZZ_NOTIFY = 1, - SFIZZ_AUTOMATE = 2, - SFIZZ_LEFT = 3, - SFIZZ_RIGHT = 4, - SFIZZ_VOLUME = 5, - SFIZZ_POLYPHONY = 6, - SFIZZ_OVERSAMPLING = 7, - SFIZZ_PRELOAD = 8, - SFIZZ_FREEWHEELING = 9, - SFIZZ_SCALA_ROOT_KEY = 10, - SFIZZ_TUNING_FREQUENCY = 11, - SFIZZ_STRETCH_TUNING = 12, - SFIZZ_SAMPLE_QUALITY = 13, - SFIZZ_OSCILLATOR_QUALITY = 14, - SFIZZ_ACTIVE_VOICES = 15, - SFIZZ_NUM_CURVES = 16, - SFIZZ_NUM_MASTERS = 17, - SFIZZ_NUM_GROUPS = 18, - SFIZZ_NUM_REGIONS = 19, - SFIZZ_NUM_SAMPLES = 20, + SFIZZ_AUTOMATE = 1, + SFIZZ_LEFT = 2, + SFIZZ_RIGHT = 3, + SFIZZ_VOLUME = 4, + SFIZZ_POLYPHONY = 5, + SFIZZ_OVERSAMPLING = 6, + SFIZZ_PRELOAD = 7, + SFIZZ_FREEWHEELING = 8, + SFIZZ_SCALA_ROOT_KEY = 9, + SFIZZ_TUNING_FREQUENCY = 10, + SFIZZ_STRETCH_TUNING = 11, + SFIZZ_SAMPLE_QUALITY = 12, + SFIZZ_OSCILLATOR_QUALITY = 13, + SFIZZ_ACTIVE_VOICES = 14, + SFIZZ_NUM_CURVES = 15, + SFIZZ_NUM_MASTERS = 16, + SFIZZ_NUM_GROUPS = 17, + SFIZZ_NUM_REGIONS = 18, + SFIZZ_NUM_SAMPLES = 19, }; // For use with instance-access diff --git a/plugins/lv2/sfizz_lv2_plugin.h b/plugins/lv2/sfizz_lv2_plugin.h index d9c4fe43..90387684 100644 --- a/plugins/lv2/sfizz_lv2_plugin.h +++ b/plugins/lv2/sfizz_lv2_plugin.h @@ -34,7 +34,6 @@ struct sfizz_plugin_t // Ports const LV2_Atom_Sequence *control_port {}; - LV2_Atom_Sequence *notify_port {}; LV2_Atom_Sequence *automate_port {}; float *output_buffers[2] {}; const float *volume_port {}; @@ -55,7 +54,6 @@ struct sfizz_plugin_t float *num_samples_port {}; // Atom forge - LV2_Atom_Forge forge_notify {}; ///< Forge for writing notification atoms in run thread LV2_Atom_Forge forge_automate {}; ///< Forge for writing automation atoms in run thread LV2_Atom_Forge forge_secondary {}; ///< Forge for writing into other buffers @@ -92,6 +90,7 @@ struct sfizz_plugin_t LV2_URID sfizz_check_modification_uri {}; LV2_URID sfizz_active_voices_uri {}; LV2_URID sfizz_osc_blob_uri {}; + LV2_URID sfizz_notify_uri {}; LV2_URID sfizz_audio_level_uri {}; LV2_URID time_position_uri {}; LV2_URID time_bar_uri {}; diff --git a/plugins/lv2/sfizz_ui.cpp b/plugins/lv2/sfizz_ui.cpp index bd943833..3756c7f8 100644 --- a/plugins/lv2/sfizz_ui.cpp +++ b/plugins/lv2/sfizz_ui.cpp @@ -116,6 +116,7 @@ struct sfizz_ui_t : EditorController, VSTGUIEditorInterface { LV2_URID sfizz_sfz_file_uri; LV2_URID sfizz_scala_file_uri; LV2_URID sfizz_osc_blob_uri; + LV2_URID sfizz_notify_uri; LV2_URID sfizz_audio_level_uri; std::unique_ptr ccmap; @@ -218,6 +219,7 @@ instantiate(const LV2UI_Descriptor *descriptor, self->sfizz_sfz_file_uri = map->map(map->handle, SFIZZ__sfzFile); self->sfizz_scala_file_uri = map->map(map->handle, SFIZZ__tuningfile); self->sfizz_osc_blob_uri = map->map(map->handle, SFIZZ__OSCBlob); + self->sfizz_notify_uri = map->map(map->handle, SFIZZ__Notify); self->sfizz_audio_level_uri = map->map(map->handle, SFIZZ__AudioLevel); self->ccmap.reset(sfizz_lv2_ccmap_create(map)); diff --git a/plugins/puredata/CMakeLists.txt b/plugins/puredata/CMakeLists.txt index e861cf92..c8a33a65 100644 --- a/plugins/puredata/CMakeLists.txt +++ b/plugins/puredata/CMakeLists.txt @@ -27,7 +27,7 @@ add_pd_external(sfizz_puredata "sfizz_puredata.c") target_compile_definitions(sfizz_puredata PRIVATE "SFIZZ_NUM_CCS=${SFIZZ_NUM_CCS}" "SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"") -target_link_libraries(sfizz_puredata PRIVATE sfizz::sfizz) +target_link_libraries(sfizz_puredata PRIVATE sfizz::import sfizz::sfizz) set_target_properties(sfizz_puredata PROPERTIES OUTPUT_NAME "sfizz" diff --git a/plugins/puredata/sfizz_puredata.c b/plugins/puredata/sfizz_puredata.c index 94cfca22..4043b6ca 100644 --- a/plugins/puredata/sfizz_puredata.c +++ b/plugins/puredata/sfizz_puredata.c @@ -7,6 +7,7 @@ #include "GitBuildId.h" #include #include +#include #include #include #include @@ -62,7 +63,7 @@ static bool sfizz_tilde_do_load(t_sfizz_tilde* self) { bool loaded; if (self->filepath[0] != '\0') - loaded = sfizz_load_file(self->synth, self->filepath); + loaded = sfizz_load_or_import_file(self->synth, self->filepath, NULL); else loaded = sfizz_load_string(self->synth, "default.sfz", "sample=*sine"); return loaded; diff --git a/plugins/vst/SfizzVstProcessor.cpp b/plugins/vst/SfizzVstProcessor.cpp index bb1bcac5..cf01f04f 100644 --- a/plugins/vst/SfizzVstProcessor.cpp +++ b/plugins/vst/SfizzVstProcessor.cpp @@ -9,7 +9,7 @@ #include "SfizzVstState.h" #include "SfizzVstParameters.h" #include "SfizzVstIDs.h" -#include "sfizz/import/ForeignInstrument.h" +#include "sfizz/import/sfizz_import.h" #include "plugin/SfizzFileScan.h" #include "plugin/InstrumentDescription.h" #include "base/source/fstreamer.h" @@ -682,16 +682,7 @@ void SfizzVstProcessor::loadSfzFileOrDefault(const std::string& filePath, bool i sfz::Sfizz& synth = *_synth; if (!filePath.empty()) { - const sfz::InstrumentFormatRegistry& formatRegistry = sfz::InstrumentFormatRegistry::getInstance(); - const sfz::InstrumentFormat* format = formatRegistry.getMatchingFormat(filePath); - if (!format) - synth.loadSfzFile(filePath); - else { - auto importer = format->createImporter(); - std::string virtualPath = filePath + ".sfz"; - std::string sfzText = importer->convertToSfz(filePath); - synth.loadSfzString(virtualPath, sfzText); - } + sfizz_load_or_import_file(synth.handle(), filePath.c_str(), nullptr); } else { synth.loadSfzString("default.sfz", defaultSfzText); diff --git a/scripts/innosetup.iss.in b/scripts/innosetup.iss.in index 87159e32..268bfa63 100644 --- a/scripts/innosetup.iss.in +++ b/scripts/innosetup.iss.in @@ -36,8 +36,8 @@ LicenseFile="sfizz.lv2\LICENSE.md" OutputBaseFileName={#MyAppName}-{#MyAppVersion}-msvc-{#Arch}-setup OutputDir=. UninstallFilesDir={app} -WizardImageFile="C:\Program Files (x86)\Inno Setup 6\WizModernImage-IS.bmp" -WizardSmallImageFile="C:\Program Files (x86)\Inno Setup 6\WizModernSmallImage-IS.bmp" +WizardImageFile=compiler:WizClassicImage-IS.bmp +WizardSmallImageFile=compiler:WizClassicSmallImage-IS.bmp [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 000c1eaa..a1a2533b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -251,11 +251,13 @@ endif() # Import library set(SFIZZ_IMPORT_HEADERS + sfizz/import/sfizz_import.h sfizz/import/ForeignInstrument.h sfizz/import/foreign_instruments/AudioFile.h sfizz/import/foreign_instruments/DecentSampler.h) set(SFIZZ_IMPORT_SOURCES + sfizz/import/sfizz_import.cpp sfizz/import/ForeignInstrument.cpp sfizz/import/foreign_instruments/AudioFile.cpp sfizz/import/foreign_instruments/DecentSampler.cpp) diff --git a/src/sfizz/MidiState.cpp b/src/sfizz/MidiState.cpp index 2072b1fd..4abaffb8 100644 --- a/src/sfizz/MidiState.cpp +++ b/src/sfizz/MidiState.cpp @@ -230,14 +230,6 @@ void sfz::MidiState::reset() noexcept absl::c_fill(noteOffTimes, 0); } -void sfz::MidiState::resetAllControllers(int delay) noexcept -{ - for (int ccIdx = 0; ccIdx < config::numCCs; ++ccIdx) - ccEvent(delay, ccIdx, 0.0f); - - pitchBendEvent(delay, 0.0f); -} - const sfz::EventVector& sfz::MidiState::getCCEvents(int ccIdx) const noexcept { if (ccIdx < 0 || ccIdx >= config::numCCs) diff --git a/src/sfizz/MidiState.h b/src/sfizz/MidiState.h index c92f45a4..16197c2f 100644 --- a/src/sfizz/MidiState.h +++ b/src/sfizz/MidiState.h @@ -180,11 +180,6 @@ public: */ void reset() noexcept; - /** - * @brief Reset all the controllers - */ - void resetAllControllers(int delay) noexcept; - const EventVector& getCCEvents(int ccIdx) const noexcept; const EventVector& getPolyAftertouchEvents(int noteNumber) const noexcept; const EventVector& getPitchEvents() const noexcept; diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 54cca904..f5d2a385 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -1932,18 +1932,21 @@ void Synth::disableFreeWheeling() noexcept void Synth::Impl::resetAllControllers(int delay) noexcept { - resources_.getMidiState().resetAllControllers(delay); + MidiState& midiState = resources_.getMidiState(); + midiState.pitchBendEvent(delay, 0.0f); + for (int cc = 0; cc < config::numCCs; ++cc) + midiState.ccEvent(delay, cc, defaultCCValues_[cc]); for (auto& voice : voiceManager_) { voice.registerPitchWheel(delay, 0); for (int cc = 0; cc < config::numCCs; ++cc) - voice.registerCC(delay, cc, 0.0f); + voice.registerCC(delay, cc, defaultCCValues_[cc]); } for (const LayerPtr& layerPtr : layers_) { Layer& layer = *layerPtr; for (int cc = 0; cc < config::numCCs; ++cc) - layer.registerCC(cc, 0.0f); + layer.registerCC(cc, defaultCCValues_[cc]); } } diff --git a/src/sfizz/SynthPrivate.h b/src/sfizz/SynthPrivate.h index 4b244649..2597f417 100644 --- a/src/sfizz/SynthPrivate.h +++ b/src/sfizz/SynthPrivate.h @@ -327,7 +327,7 @@ struct Synth::Impl final: public Parser::Listener { Parser parser_; absl::optional modificationTime_ { }; - std::array defaultCCValues_; + std::array defaultCCValues_ { }; BitArray currentUsedCCs_; BitArray changedCCsThisCycle_; BitArray changedCCsLastCycle_; diff --git a/src/sfizz/dsp/filters/sfz_filters.dsp b/src/sfizz/dsp/filters/sfz_filters.dsp index 72da6362..73cbed75 100644 --- a/src/sfizz/dsp/filters/sfz_filters.dsp +++ b/src/sfizz/dsp/filters/sfz_filters.dsp @@ -154,7 +154,7 @@ sfz2chEqHshelf = par(i,2,sfzEqHshelf); // Filter parameters cutoff = hslider("[01] Cutoff [unit:Hz] [scale:log]", 440.0, 50.0, 10000.0, 1.0) : max(1.0) : min(20000.0); -Q = vslider("[02] Resonance [unit:dB]", 0.0, 0.0, 40.0, 0.1) : max(0.0) : min(60.0) : ba.db2linear; +Q = vslider("[02] Resonance [unit:dB]", 0.0, 0.0, 40.0, 0.1) : max(-60.0) : min(60.0) : ba.db2linear; pkShGain = vslider("[03] Peak/shelf gain [unit:dB]", 0.0, 0.0, 40.0, 0.1) : max(-120.0) : min(60.0); bandwidthOrSlope = vslider("[04] Bandwidth [unit:octave]", 1.0, 0.1, 10.0, 0.01); bandwidth = bandwidthOrSlope : max(1e-2) : min(12.0); diff --git a/src/sfizz/gen/filters/sfz2chBpf2p.hxx b/src/sfizz/gen/filters/sfz2chBpf2p.hxx index 5c591b9e..9d6451e6 100644 --- a/src/sfizz/gen/filters/sfz2chBpf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf2p.hxx @@ -171,7 +171,7 @@ class faust2chBpf2p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); diff --git a/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx b/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx index 398dfec1..9feadd35 100644 --- a/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf2pSv.hxx @@ -139,7 +139,7 @@ class faust2chBpf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); diff --git a/src/sfizz/gen/filters/sfz2chBpf4p.hxx b/src/sfizz/gen/filters/sfz2chBpf4p.hxx index cb7113d0..ca2bea90 100644 --- a/src/sfizz/gen/filters/sfz2chBpf4p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf4p.hxx @@ -211,7 +211,7 @@ class faust2chBpf4p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); diff --git a/src/sfizz/gen/filters/sfz2chBpf6p.hxx b/src/sfizz/gen/filters/sfz2chBpf6p.hxx index 78495246..14c89256 100644 --- a/src/sfizz/gen/filters/sfz2chBpf6p.hxx +++ b/src/sfizz/gen/filters/sfz2chBpf6p.hxx @@ -251,7 +251,7 @@ class faust2chBpf6p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); diff --git a/src/sfizz/gen/filters/sfz2chBrf2p.hxx b/src/sfizz/gen/filters/sfz2chBrf2p.hxx index b802972f..4b73e3e3 100644 --- a/src/sfizz/gen/filters/sfz2chBrf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chBrf2p.hxx @@ -162,7 +162,7 @@ class faust2chBrf2p : public sfzFilterDsp { FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); - double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = (1.0 - fSlow0); double fSlow5 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow3) * fSlow4); diff --git a/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx b/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx index c9b75ee2..abc66437 100644 --- a/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chBrf2pSv.hxx @@ -139,7 +139,7 @@ class faust2chBrf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); diff --git a/src/sfizz/gen/filters/sfz2chHpf2p.hxx b/src/sfizz/gen/filters/sfz2chHpf2p.hxx index 49059293..48f45545 100644 --- a/src/sfizz/gen/filters/sfz2chHpf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf2p.hxx @@ -167,7 +167,7 @@ class faust2chHpf2p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); diff --git a/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx b/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx index 6631a898..ceb82840 100644 --- a/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf2pSv.hxx @@ -139,7 +139,7 @@ class faust2chHpf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); diff --git a/src/sfizz/gen/filters/sfz2chHpf4p.hxx b/src/sfizz/gen/filters/sfz2chHpf4p.hxx index 85ddb785..950aa163 100644 --- a/src/sfizz/gen/filters/sfz2chHpf4p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf4p.hxx @@ -207,7 +207,7 @@ class faust2chHpf4p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); diff --git a/src/sfizz/gen/filters/sfz2chHpf6p.hxx b/src/sfizz/gen/filters/sfz2chHpf6p.hxx index 4c848e81..c078bb41 100644 --- a/src/sfizz/gen/filters/sfz2chHpf6p.hxx +++ b/src/sfizz/gen/filters/sfz2chHpf6p.hxx @@ -247,7 +247,7 @@ class faust2chHpf6p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); diff --git a/src/sfizz/gen/filters/sfz2chHsh.hxx b/src/sfizz/gen/filters/sfz2chHsh.hxx index 7bb9fde3..68a2a387 100644 --- a/src/sfizz/gen/filters/sfz2chHsh.hxx +++ b/src/sfizz/gen/filters/sfz2chHsh.hxx @@ -175,7 +175,7 @@ class faust2chHsh : public sfzFilterDsp { double fSlow2 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow3 = std::cos(fSlow2); double fSlow4 = ((fSlow1 + 1.0) * fSlow3); - double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider1))))))); + double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider1))))))); double fSlow6 = ((fSlow1 + -1.0) * fSlow3); double fSlow7 = ((fSlow1 + fSlow5) + (1.0 - fSlow6)); double fSlow8 = (1.0 - fSlow0); diff --git a/src/sfizz/gen/filters/sfz2chLpf2p.hxx b/src/sfizz/gen/filters/sfz2chLpf2p.hxx index 1ee9a6f8..d71352b7 100644 --- a/src/sfizz/gen/filters/sfz2chLpf2p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf2p.hxx @@ -166,7 +166,7 @@ class faust2chLpf2p : public sfzFilterDsp { FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fConst1 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); diff --git a/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx b/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx index 6c42c4ed..a822345f 100644 --- a/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf2pSv.hxx @@ -139,7 +139,7 @@ class faust2chLpf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); double fTemp1 = double(input1[i]); diff --git a/src/sfizz/gen/filters/sfz2chLpf4p.hxx b/src/sfizz/gen/filters/sfz2chLpf4p.hxx index 7fabed76..ba0d9c6d 100644 --- a/src/sfizz/gen/filters/sfz2chLpf4p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf4p.hxx @@ -206,7 +206,7 @@ class faust2chLpf4p : public sfzFilterDsp { FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fConst1 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); diff --git a/src/sfizz/gen/filters/sfz2chLpf6p.hxx b/src/sfizz/gen/filters/sfz2chLpf6p.hxx index b2ce9fca..b3fca735 100644 --- a/src/sfizz/gen/filters/sfz2chLpf6p.hxx +++ b/src/sfizz/gen/filters/sfz2chLpf6p.hxx @@ -246,7 +246,7 @@ class faust2chLpf6p : public sfzFilterDsp { FAUSTFLOAT* output1 = outputs[1]; double fSlow0 = (fConst1 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); diff --git a/src/sfizz/gen/filters/sfz2chLsh.hxx b/src/sfizz/gen/filters/sfz2chLsh.hxx index b3ec808f..3d32d1a5 100644 --- a/src/sfizz/gen/filters/sfz2chLsh.hxx +++ b/src/sfizz/gen/filters/sfz2chLsh.hxx @@ -176,7 +176,7 @@ class faust2chLsh : public sfzFilterDsp { double fSlow3 = std::cos(fSlow2); double fSlow4 = ((fSlow1 + 1.0) * fSlow3); double fSlow5 = ((fSlow1 + -1.0) * fSlow3); - double fSlow6 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider1))))))); + double fSlow6 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider1))))))); double fSlow7 = (fSlow5 + fSlow6); double fSlow8 = ((fSlow1 + fSlow7) + 1.0); double fSlow9 = (1.0 - fSlow0); diff --git a/src/sfizz/gen/filters/sfz2chPeq.hxx b/src/sfizz/gen/filters/sfz2chPeq.hxx index 6126a8fd..4b5de6f3 100644 --- a/src/sfizz/gen/filters/sfz2chPeq.hxx +++ b/src/sfizz/gen/filters/sfz2chPeq.hxx @@ -169,7 +169,7 @@ class faust2chPeq : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = std::pow(10.0, (0.025000000000000001 * std::min(60.0, std::max(-120.0, double(fVslider1))))); double fSlow5 = (0.5 * (fSlow2 / (fSlow3 * fSlow4))); double fSlow6 = (fSlow5 + 1.0); diff --git a/src/sfizz/gen/filters/sfzBpf2p.hxx b/src/sfizz/gen/filters/sfzBpf2p.hxx index 9a0c61dc..e31555b3 100644 --- a/src/sfizz/gen/filters/sfzBpf2p.hxx +++ b/src/sfizz/gen/filters/sfzBpf2p.hxx @@ -149,7 +149,7 @@ class faustBpf2p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); diff --git a/src/sfizz/gen/filters/sfzBpf2pSv.hxx b/src/sfizz/gen/filters/sfzBpf2pSv.hxx index 19b66dec..99560151 100644 --- a/src/sfizz/gen/filters/sfzBpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzBpf2pSv.hxx @@ -129,7 +129,7 @@ class faustBpf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow2); diff --git a/src/sfizz/gen/filters/sfzBpf4p.hxx b/src/sfizz/gen/filters/sfzBpf4p.hxx index e51efc1b..4d74e7fe 100644 --- a/src/sfizz/gen/filters/sfzBpf4p.hxx +++ b/src/sfizz/gen/filters/sfzBpf4p.hxx @@ -169,7 +169,7 @@ class faustBpf4p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); diff --git a/src/sfizz/gen/filters/sfzBpf6p.hxx b/src/sfizz/gen/filters/sfzBpf6p.hxx index 98fc4b1e..0ec70dd0 100644 --- a/src/sfizz/gen/filters/sfzBpf6p.hxx +++ b/src/sfizz/gen/filters/sfzBpf6p.hxx @@ -189,7 +189,7 @@ class faustBpf6p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = (0.5 * (fSlow2 / fSlow3)); double fSlow5 = (fSlow4 + 1.0); double fSlow6 = (0.5 * (fSlow2 / (fSlow3 * fSlow5))); diff --git a/src/sfizz/gen/filters/sfzBrf2p.hxx b/src/sfizz/gen/filters/sfzBrf2p.hxx index 210366e5..49317e68 100644 --- a/src/sfizz/gen/filters/sfzBrf2p.hxx +++ b/src/sfizz/gen/filters/sfzBrf2p.hxx @@ -140,7 +140,7 @@ class faustBrf2p : public sfzFilterDsp { FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); - double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = (1.0 - fSlow0); double fSlow5 = (((0.0 - (2.0 * std::cos(fSlow1))) / fSlow3) * fSlow4); diff --git a/src/sfizz/gen/filters/sfzBrf2pSv.hxx b/src/sfizz/gen/filters/sfzBrf2pSv.hxx index 4a50a451..1024b9aa 100644 --- a/src/sfizz/gen/filters/sfzBrf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzBrf2pSv.hxx @@ -129,7 +129,7 @@ class faustBrf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec5[0] = ((fSlow0 * fRec5[1]) + fSlow2); diff --git a/src/sfizz/gen/filters/sfzHpf2p.hxx b/src/sfizz/gen/filters/sfzHpf2p.hxx index 9934aabf..18e3f648 100644 --- a/src/sfizz/gen/filters/sfzHpf2p.hxx +++ b/src/sfizz/gen/filters/sfzHpf2p.hxx @@ -145,7 +145,7 @@ class faustHpf2p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); diff --git a/src/sfizz/gen/filters/sfzHpf2pSv.hxx b/src/sfizz/gen/filters/sfzHpf2pSv.hxx index 2dc0420a..7d0e4507 100644 --- a/src/sfizz/gen/filters/sfzHpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzHpf2pSv.hxx @@ -129,7 +129,7 @@ class faustHpf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec4[0] = ((fSlow0 * fRec4[1]) + fSlow2); diff --git a/src/sfizz/gen/filters/sfzHpf4p.hxx b/src/sfizz/gen/filters/sfzHpf4p.hxx index 1ffeed51..4f02e288 100644 --- a/src/sfizz/gen/filters/sfzHpf4p.hxx +++ b/src/sfizz/gen/filters/sfzHpf4p.hxx @@ -165,7 +165,7 @@ class faustHpf4p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); diff --git a/src/sfizz/gen/filters/sfzHpf6p.hxx b/src/sfizz/gen/filters/sfzHpf6p.hxx index ab376387..ffcd8bdf 100644 --- a/src/sfizz/gen/filters/sfzHpf6p.hxx +++ b/src/sfizz/gen/filters/sfzHpf6p.hxx @@ -185,7 +185,7 @@ class faustHpf6p : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::cos(fSlow1); - double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow3 = (0.5 * (std::sin(fSlow1) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow4 = (fSlow3 + 1.0); double fSlow5 = (1.0 - fSlow0); double fSlow6 = (((-1.0 - fSlow2) / fSlow4) * fSlow5); diff --git a/src/sfizz/gen/filters/sfzHsh.hxx b/src/sfizz/gen/filters/sfzHsh.hxx index fc80a946..e4b69cc3 100644 --- a/src/sfizz/gen/filters/sfzHsh.hxx +++ b/src/sfizz/gen/filters/sfzHsh.hxx @@ -153,7 +153,7 @@ class faustHsh : public sfzFilterDsp { double fSlow2 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow3 = std::cos(fSlow2); double fSlow4 = ((fSlow1 + 1.0) * fSlow3); - double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider1))))))); + double fSlow5 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider1))))))); double fSlow6 = ((fSlow1 + -1.0) * fSlow3); double fSlow7 = ((fSlow1 + fSlow5) + (1.0 - fSlow6)); double fSlow8 = (1.0 - fSlow0); diff --git a/src/sfizz/gen/filters/sfzLpf2p.hxx b/src/sfizz/gen/filters/sfzLpf2p.hxx index 43880467..871be36a 100644 --- a/src/sfizz/gen/filters/sfzLpf2p.hxx +++ b/src/sfizz/gen/filters/sfzLpf2p.hxx @@ -144,7 +144,7 @@ class faustLpf2p : public sfzFilterDsp { FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fConst1 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); diff --git a/src/sfizz/gen/filters/sfzLpf2pSv.hxx b/src/sfizz/gen/filters/sfzLpf2pSv.hxx index f303bb73..ee51668a 100644 --- a/src/sfizz/gen/filters/sfzLpf2pSv.hxx +++ b/src/sfizz/gen/filters/sfzLpf2pSv.hxx @@ -129,7 +129,7 @@ class faustLpf2pSv : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (1.0 - fSlow0); double fSlow2 = (std::tan((fConst2 * std::min(20000.0, std::max(1.0, double(fHslider0))))) * fSlow1); - double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = (1.0 / std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); for (int i = 0; (i < count); i = (i + 1)) { double fTemp0 = double(input0[i]); fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow2); diff --git a/src/sfizz/gen/filters/sfzLpf4p.hxx b/src/sfizz/gen/filters/sfzLpf4p.hxx index d0435d56..88e8ae7c 100644 --- a/src/sfizz/gen/filters/sfzLpf4p.hxx +++ b/src/sfizz/gen/filters/sfzLpf4p.hxx @@ -164,7 +164,7 @@ class faustLpf4p : public sfzFilterDsp { FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fConst1 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); diff --git a/src/sfizz/gen/filters/sfzLpf6p.hxx b/src/sfizz/gen/filters/sfzLpf6p.hxx index 95f70228..1df6f79c 100644 --- a/src/sfizz/gen/filters/sfzLpf6p.hxx +++ b/src/sfizz/gen/filters/sfzLpf6p.hxx @@ -184,7 +184,7 @@ class faustLpf6p : public sfzFilterDsp { FAUSTFLOAT* output0 = outputs[0]; double fSlow0 = (fConst1 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow1 = std::cos(fSlow0); - double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))))); + double fSlow2 = (0.5 * (std::sin(fSlow0) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))))); double fSlow3 = (fSlow2 + 1.0); double fSlow4 = ((1.0 - fSlow1) / fSlow3); double fSlow5 = (fSmoothEnable ? fConst2 : 0.0); diff --git a/src/sfizz/gen/filters/sfzLsh.hxx b/src/sfizz/gen/filters/sfzLsh.hxx index b614b558..92e93f9d 100644 --- a/src/sfizz/gen/filters/sfzLsh.hxx +++ b/src/sfizz/gen/filters/sfzLsh.hxx @@ -154,7 +154,7 @@ class faustLsh : public sfzFilterDsp { double fSlow3 = std::cos(fSlow2); double fSlow4 = ((fSlow1 + 1.0) * fSlow3); double fSlow5 = ((fSlow1 + -1.0) * fSlow3); - double fSlow6 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider1))))))); + double fSlow6 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider1))))))); double fSlow7 = (fSlow5 + fSlow6); double fSlow8 = ((fSlow1 + fSlow7) + 1.0); double fSlow9 = (1.0 - fSlow0); diff --git a/src/sfizz/gen/filters/sfzPeq.hxx b/src/sfizz/gen/filters/sfzPeq.hxx index 50ce2084..bf7f770c 100644 --- a/src/sfizz/gen/filters/sfzPeq.hxx +++ b/src/sfizz/gen/filters/sfzPeq.hxx @@ -147,7 +147,7 @@ class faustPeq : public sfzFilterDsp { double fSlow0 = (fSmoothEnable ? fConst1 : 0.0); double fSlow1 = (fConst2 * std::max(0.0, std::min(20000.0, std::max(1.0, double(fHslider0))))); double fSlow2 = std::sin(fSlow1); - double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(0.0, double(fVslider0)))))); + double fSlow3 = std::max(0.001, std::pow(10.0, (0.050000000000000003 * std::min(60.0, std::max(-60.0, double(fVslider0)))))); double fSlow4 = std::pow(10.0, (0.025000000000000001 * std::min(60.0, std::max(-120.0, double(fVslider1))))); double fSlow5 = (0.5 * (fSlow2 / (fSlow3 * fSlow4))); double fSlow6 = (fSlow5 + 1.0); diff --git a/src/sfizz/import/sfizz_import.cpp b/src/sfizz/import/sfizz_import.cpp new file mode 100644 index 00000000..f73fc67d --- /dev/null +++ b/src/sfizz/import/sfizz_import.cpp @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: BSD-2-Clause + +// This code is part of the sfizz library and is licensed under a BSD 2-clause +// license. You should have receive a LICENSE.md file along with the code. +// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz + +#include "sfizz_import.h" +#include "ForeignInstrument.h" + +bool sfizz_load_or_import_file(sfizz_synth_t* synth, const char* path, const char** format) +{ + const sfz::InstrumentFormatRegistry& ireg = sfz::InstrumentFormatRegistry::getInstance(); + const sfz::InstrumentFormat* ifmt = ireg.getMatchingFormat(path); + + if (!ifmt) { + if (!sfizz_load_file(synth, path)) + return false; + if (format) + *format = nullptr; + } + else { + auto importer = ifmt->createImporter(); + std::string virtualPath = std::string(path) + ".sfz"; + std::string sfzText = importer->convertToSfz(path); + if (!sfizz_load_string(synth, virtualPath.c_str(), sfzText.c_str())) + return false; + if (format) + *format = ifmt->name(); + } + + return true; +} diff --git a/src/sfizz/import/sfizz_import.h b/src/sfizz/import/sfizz_import.h new file mode 100644 index 00000000..7ae1184b --- /dev/null +++ b/src/sfizz/import/sfizz_import.h @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: BSD-2-Clause + +// This code is part of the sfizz library and is licensed under a BSD 2-clause +// license. You should have receive a LICENSE.md file along with the code. +// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz + +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Loads or imports an instrument file. + * + * The file path can be absolute or relative. + * @since 1.0.1 + * + * @param synth The synth. + * @param path A null-terminated string representing a path to an instrument + * in SFZ format, or another format which can be imported. + * @param format An optional pointer to a string pointer, which receives the + * null-terminated name of the format if the file was imported, + * or null if the file was loaded directly as SFZ. + * + * @return @true when file loading went OK, + * @false if some error occured while loading. + * + * @par Thread-safety constraints + * - @b CT: the function must be invoked from the Control thread + * - @b OFF: the function cannot be invoked while a thread is calling @b RT functions + */ +bool sfizz_load_or_import_file(sfizz_synth_t* synth, const char* path, const char** format); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/tests/MidiStateT.cpp b/tests/MidiStateT.cpp index 8bb44d40..f29c7198 100644 --- a/tests/MidiStateT.cpp +++ b/tests/MidiStateT.cpp @@ -57,19 +57,6 @@ TEST_CASE("[MidiState] Reset") REQUIRE(state.getCCValue(123) == 0_norm); } -TEST_CASE("[MidiState] Reset all controllers") -{ - sfz::MidiState state; - state.pitchBendEvent(20, 0.7f); - state.ccEvent(10, 122, 124_norm); - REQUIRE(state.getPitchBend() == 0.7f); - REQUIRE(state.getCCValue(122) == 124_norm); - state.resetAllControllers(30); - REQUIRE(state.getPitchBend() == 0.0f); - REQUIRE(state.getCCValue(122) == 0_norm); - REQUIRE(state.getCCValue(4) == 0_norm); -} - TEST_CASE("[MidiState] Set and get note velocities") { sfz::MidiState state; diff --git a/tests/SynthT.cpp b/tests/SynthT.cpp index 919163a6..383775ac 100644 --- a/tests/SynthT.cpp +++ b/tests/SynthT.cpp @@ -1917,4 +1917,29 @@ TEST_CASE("[Synth] Sustain cancels release is off by default") synth.cc(0, 64, 127); synth.renderBlock(buffer); REQUIRE( playingSamples(synth) == std::vector { } ); +} + +TEST_CASE("[Synth] Resets all controllers to default values") +{ + sfz::Synth synth; + std::vector messageList; + sfz::Client client(&messageList); + client.setReceiveCallback(&simpleMessageReceiver); + sfz::AudioBuffer buffer { 2, static_cast(synth.getSamplesPerBlock()) }; + synth.loadSfzString(fs::current_path() / "tests/TestFiles/default_cc.sfz", R"( + set_cc56=64 + sample=*sine + )"); + REQUIRE( synth.getHdcc(56) == 64_norm ); + REQUIRE( synth.getHdcc(78) == 0.0f ); + synth.cc(0, 56, 10); + synth.cc(0, 78, 100); + synth.renderBlock(buffer); + REQUIRE( synth.getHdcc(56) == 10_norm ); + REQUIRE( synth.getHdcc(78) == 100_norm ); + synth.cc(0, 121, 127); + synth.cc(0, 121, 0); + synth.renderBlock(buffer); + REQUIRE( synth.getHdcc(56) == 64_norm ); + REQUIRE( synth.getHdcc(78) == 0.0f ); }