HISE Logo Forum
    • Categories
    • Register
    • Login

    Callback when preset saved??

    Scheduled Pinned Locked Moved Scripting
    preset browsercallbacksave
    22 Posts 4 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by d.healey

      I added this at the end of the save preset function so that it triggers the post callback and it works nicely here

      chain->getMainController()->getUserPresetHandler().postPresetLoad();

      @Christoph-Hart Any reason why I shouldn't do this?

      I've also fixed the bug where renaming a preset deselects it :)

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      Christoph HartC 1 Reply Last reply Reply Quote 2
      • Christoph HartC
        Christoph Hart @d.healey
        last edited by

        @d-healey yes the name of the function suggests that it happens after a preset load which might be used for all kinds of things, so running this after you saved a preset is very irritating.

        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @Christoph Hart
          last edited by

          @Christoph-Hart Should I look at adding a presetSaved callback or do you think a broadcaster based solution would be better?

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            @d-healey I would add a UserPresetHandler.setPostPresetSaveCallback(onPresetSaveCallback) function.

            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @Christoph Hart
              last edited by

              @Christoph-Hart Thanks, I'll give it a go

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 2
              • d.healeyD
                d.healey
                last edited by

                @Christoph-Hart I've started implementing it on a separate branch but when I'm compiling I'm getting an error that I haven't been able to figure out as it seems unrelated to anything I've touched.

                In file included from ../../../../../HISE/hi_components/hi_components.cpp:42,
                from ../../JuceLibraryCode/include_hi_components.cpp:9:
                ../../../../../HISE/hi_components/plugin_components/PresetBrowser.cpp: In constructor ‘hise::PresetBrowser::PresetBrowser(hise::MainController*, int, int)’:
                ../../../../../HISE/hi_components/plugin_components/PresetBrowser.cpp:531:57: error: invalid new-expression of abstract class type ‘hise::TagList’
                531 | addAndMakeVisible(tagList = new TagList(mc, this));

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  @Christoph-Hart Any tips? This C++ stuff is not my comfort zone :)

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey
                    last edited by

                    Ha I've done it! I need to do a little clean up then I'll make a pull request.

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    Dan KorneffD 1 Reply Last reply Reply Quote 1
                    • Dan KorneffD
                      Dan Korneff @d.healey
                      last edited by

                      @d-healey you should make videos of your debugging journeys for Patreon.

                      Dan Korneff - Producer / Mixer / Audio Nerd

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Dan Korneff
                        last edited by

                        @Dan-Korneff I'll have a think and see if I can come up with a way of showing that in an interesting way. A lot of it is me in bed or in the shower just thinking things over until I realise where to target my effort.

                        Then at the computer I'm just reading a lot through the existing code and trying to figure out which bits to copy/paste and where I need to add new stuff. Then I compile and test, then do that some more. It's quite tedious.

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        Dan KorneffD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey
                          last edited by

                          Dang, I I haven't quite done it. I'm hitting an infinite loop now that ends in a segfault..

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey
                            last edited by d.healey

                            @Christoph-Hart I've got it triggering my callback when a new preset is added.

                            But when clicking the save button in the preset browser I've hit a snag.

                            In the function void PresetBrowser::ModalWindow::buttonClicked(Button* b)

                            I'm calling my callback caller after the replace action completes

                            getMainController()->getUserPresetHandler().postPresetSave();

                            But this goes into an infinite loop and I don't know why.

                            This is the caller (it's the same as your changed caller, I just altered the name of the listener).

                            void MainController::UserPresetHandler::postPresetSave()
                            {
                            	auto f = [](Dispatchable* obj)
                            	{
                            		auto uph = static_cast<UserPresetHandler*>(obj);
                            		auto mc_ = uph->mc;
                            		ignoreUnused(mc_);
                            		jassert_dispatched_message_thread(mc_);
                            
                            		ScopedLock sl(uph->listeners.getLock());
                            
                            		for (auto l : uph->listeners)
                            		{
                            			uph->mc->checkAndAbortMessageThreadOperation();
                            
                            			if (l != nullptr)
                            				l->presetSaved(uph->currentlyLoadedFile);
                            		}
                            
                            		return Status::OK;
                            	};
                            
                            	mc->getLockFreeDispatcher().callOnMessageThreadAfterSuspension(this, f);
                            }
                            

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            1 Reply Last reply Reply Quote 0
                            • Dan KorneffD
                              Dan Korneff @d.healey
                              last edited by

                              @d-healey said in Callback when preset saved??:

                              A lot of it is me in bed or in the shower just thinking things over until I realise where to target my effort.

                              Awesome! You can do Patreon AND OnlyFans content. 😄😄😄😄

                              Dan Korneff - Producer / Mixer / Audio Nerd

                              1 Reply Last reply Reply Quote 2
                              • d.healeyD
                                d.healey
                                last edited by

                                Bump bump

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                ustkU 1 Reply Last reply Reply Quote 0
                                • ustkU
                                  ustk @d.healey
                                  last edited by ustk

                                  @d-healey Why don't you call your method from saveUserPresetInternal ?

                                  Can't help pressing F5 in the forum...

                                  Christoph HartC 1 Reply Last reply Reply Quote 0
                                  • Christoph HartC
                                    Christoph Hart @ustk
                                    last edited by

                                    I've added that function.

                                    d.healeyD 1 Reply Last reply Reply Quote 0
                                    • d.healeyD
                                      d.healey @Christoph Hart
                                      last edited by

                                      @Christoph-Hart Woohoo! Thanks!

                                      Libre Wave - Freedom respecting instruments and effects
                                      My Patreon - HISE tutorials
                                      YouTube Channel - Public HISE tutorials

                                      1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey
                                        last edited by d.healey

                                        Getting a build error:

                                        ../../../../../HISE/hi_backend/../hi_modules/../hi_scripting/../hi_sampler/../hi_components/../hi_dsp/../hi_core/hi_core/MainControllerHelpers.h:116:53: error: no matching function for call to ‘hise::MidiControllerAutomationHandler::clear()’
                                          116 |         void resetUserPresetState() override { clear(); }
                                        

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        d.healeyD 1 Reply Last reply Reply Quote 0
                                        • d.healeyD
                                          d.healey @d.healey
                                          last edited by

                                          Ah I see the problem. Do we want to sendNotification here?

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post

                                          34

                                          Online

                                          1.7k

                                          Users

                                          11.9k

                                          Topics

                                          103.5k

                                          Posts