Share it however is convenient
whaaaat? I cannot recreate it now. Oh man… now I feel rather silly. Then again I haven’t introduced all the GUI updating code yet. Sorry about this.
EDIT: Could I just share my project on google drive? It isn’t that complicated. It isn’t the neatest, bestest code ever. My plan was to go over it and optimise it mostly later. I was held up because of these issues.
I hope this is any good. I will set up a github for in future. This all started as just an experiment. There are no assets or anything. It isn’t ever planned to be a commercial product so I don’t mind sharing the code. I was probably going to open source it anyway. I just wanted to use what I learnt from this coding run in future projects.
EDIT: But this isn’t exactly… how I would write code for other people to look at. LOL. Needs some refactoring overall tbh. It has gone through some changes and as such has ended up a bit cobbled.
Adding bits back one at a time will help you understand the issue.
But if you need to go through the whole code to see what is sucking up CPU the profiler is the best bet, it’s usually just one mistake that is causing it and you’ll see that as the hot path in the code. Hitting pause can be helpful as it will often stop in whatever is locking up, but I guess from what you’re saying above it’s not so much freezing as just doing lots slowly?
I’ll see if it builds
I haven’t a clue anymore to be honest Dave. Gone from one extreme to the other with this and have ended up fundamentally confused. Basically… everything… the GUI, etc calls that toggle method. but the toggle method just sets stuff up for the timer in the audio thread to actually call that setValueNotifyingHost method. and that is where it all starts to end up an issue. But if I comment them lines out… no issue anymore.
Aha thats the badger right there. Now all I have to do to cause a problem… is press a toggle button. But are you on mac? Might not happen on mac. haha. Sorry. I am on windows. I should have said.
Oh sorry… I have settings saved. Make sure you press that Basic button, and then click edit. Then activate a parameter, set a value for it… set a value for maybe… patch 2. and try toggling.
Oh lmfao… yes i did sorry. Gah. Just uncomment lines those sections… those beginChangeGesture, etc. The three offenders. haha.
Yeah - so it does pause slightly on my system when i push a button too…
It does? oh thank god. It seems to get worse too. If i set maxBanks in the audio processor initialiser list… to 2, it seems to no longer be an issue. But I cannot see why that would be. They are just structs basically… glorified PODs for the most part.
Well what I’d like to do is shove it in the profiler and see what happens when it hesitates (for about 300ms) but bloody Xcode Instruments is fucked and won’t record any data
If you profile in Visual Studio what is it doing just after you push one of those buttons?
well I did try that awhile ago, but I had mixed results. It did seem to say a lot of stuff was happing on the UI side of things. I will have another look.
ah… it may be allocating… here is a screenshot with a red arrow on there at what happened when I pressed a button…
Ah something seems to be a leaking if I press buttons. Ever so slightly… maybe. It keeps growing in memory.
It could be growing in memory as Reaper likes to keep a lot of undo state…
There’s a call tree view in the profiler that’s a bit more useful. You want to highlight the time period when it pauses ideally. Or make it pause a lot and highlight that range.
ah I see. well thanks for the help for today but I have been up since very early this morning. So I am going to wrap up on it for tonight and hit the hay I reckon. Return tomorrow with a fresh mind. Feel a bit burnt out on it today if i am honest. I will start again tomorrow though :).
Average = 249 millisecs, minimum = 249 millisecs, maximum = 249 millisecs, total = 249 millisecs
getStateInformation is taking 1/4 of a second to run maybe?
And that’s on the M1 Max Macbook - so it’s pretty slow.
If i comment out your code in that function it behaves ok.
Reaper calls getStateInformation all the time (e.g. every time a parameter is changed - hence calling setParameterNotifyingHost triggered it). I’d rewrite your stuff there so it’s fast.