Callback when preset saved??
-
Ha I've done it! I need to do a little clean up then I'll make a pull request.
-
@d-healey you should make videos of your debugging journeys for Patreon.
-
@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.
-
Dang, I I haven't quite done it. I'm hitting an infinite loop now that ends in a segfault..
-
@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); }
-
@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.
-
Bump bump
-
@d-healey Why don't you call your method from
saveUserPresetInternal
? -
I've added that function.
-
@Christoph-Hart Woohoo! Thanks!
-
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(); }
-
Ah I see the problem. Do we want to
sendNotification
here?