Timer Questions
-
Hey!
Making a timer on my preset browser viewports to provide "real-time" updates to the viewport on the file system. When the preset browser is opened, I have set the timer to start on one second then it stops once the panel is closed. The thing is, I have three viewports that need the updating. Does this mean I need multiple
setTimerCallback()
functions? I tried to make one timer and have three different callbacks on each viewport, but when testing, the timer only seems to use one callback and affect one viewport. Is this normal? The next question is how I go about this. Right now, my callbacks for each viewport fit around the code that calculates the directory contents and updates it. The thing is, the viewport will only update when the timer updates on the first run. This means when the user opens the preset browser, they have to wait one second before seeing the contents in viewport one. What I need is the opposite of theresetCounter()
function such that when the preset browser is opened, the timer will immediately run the callback then proceed with the one second interval updates. So how do I go about that?Thanks!
-
Each timer can only have one callback. So you either need multiple timers or you need to do everything in a single callback.
Reduce the timer duration to the absolute minimum, I think it's 40 milliseconds. That should be fast enough, then within the timer callback change the delay to 1 second again.
-
@d-healey HISE crashes on me, any reason why?
HiseSnippet 6955.3oc6cs7bbablGCk.kH0KJEFmM6VaUX45J0nD6QCvL7UrczvmVLVjZLGZZ60aJIvY5YHrv.LA.CEY7pJZSkGN6kjiatkSYq8Vtt2TpMG1iopbYO5iYurk+OX2utafAciWCvvGhRFSRYQzO+5e8W+q+59qaf5VlMQ11lVBElXmi5gDJbUwFGY3r+J6qpYHrwp3.1ZsF6TWW8HjkvxG0S01F0RnPgK7t3TTXhKJP98k2cYUcUilH+fDD10TqI59Zc0b7Csds2SSWec0Vncz5xj5p01noowJl5l8Ao4BhkE5o17wpcPaohS1XhBEFesVZNlVMbTcP1BEt3xlsNpw9lOwfl9c0r01SGgePVnATPzfW2TuEVhwgJrx9Z5sp60psEDJbo59XvEnXvzhap0RaP39XwTjHj7yAKdTXLdw6BbhmLq3UlQ7hPjJvHRWjJR2TrQSKsdN9wfkmqHtggCxpsJ.6rhBMsBisweu3JlPJLbJ0U8wn0sfGFjihKLa42PZtxku8aMIoOuTKTaj0Jp556AHucQGq9HHtIm7N2YcMcHWRKsZiskvknkot8jSB8W1NRtw8NRexO3sbCZo6AIbMi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XZXQFX.Z49EG8vrW5Ssew7sd6Xamx4z6dC2EK4FTY7RhKcuUarMQzdMwcwewkQjPVCr5QGZ07csaZZX5cSFX4T.NhNX6PYD6HaKK43.TZqz25.FZv+zcWE0T8nPgRSL6KBSZH2GnvzYq+6guOebl40jwLuZ+pZM5a6DvTvsQ5H799v7A7Zsll77yYB6GhEdhoT+3ZhzFoDYtoyPkiBgMzdRwcAcfl3pDKZeSpthWXCD9xCWLgoSbIvYUPH63dK1vbe+3w2M.yh6VkjxfL1jtEBmT2unT12bcu9FpF34OCFupHQ0+rV2Ish2MDcGHdtE.utnKuvKRH7RQN5aZwLNvCXL+ehXfm2BZQAoLiZf2Y9PrDu2mW3U6684EXp+I7VOj+cGj91918f1Renbh61guacXd0x99rpu7c2yT686qpG.cWVqGdmONtH+Iz9e7Z99p5Ey5h4llLBanlR7L05IXL9+9oq0S+weWZrd5u7G9ps0S4VPjaAw4HKHdYeKj+lhtS6HQN8.mqk0qK99u3EvjMW3ph2u95mQVLTqVtECwawPzl1+0G7nzfVfbhh3iZ29+83Ya+I3ry4LOeEl4INexF3KHatWYy8JatWYeYyqrIy935CMx2p6ykKkg34PIrideUqOx6sxE17B2+lts3W.4dCrKTXL8fqz26KC5XhBifu2ky88dtu2GQeuuEzbN.k668SAeuKm668WU88tbtu2y88dx9dWN22646bd9NmeJ668n1fNkbmu+UamuKmuU5muc99K+lOk678bmumaBQty2ycA1qDNeWN+358xgy2qj678blmWUb9tRty2yc9dty2yc9dty2e4046J4NeO246rNeekz678558a9XTqbuueJ38ckbuu+pp22Ux89dt22y89d9Vmmu04m+79d0buu+UauuqbpuW54de+X48ckbuum688bSHxMgH26649.67f22Ux899KGdee1buumy77ph22qj688buum688buum688yKde+rPJ6p1zx7gtec4vx5kIg.RogZW5GCN7yRxBGv9g4nqVKsG1ro2WinnyixHjmJiPdpNB4Y1QHOyMB4Y9QHOKjXdv9X18aADlYCBn9ZTEqBqMPw5BB++ev7cZC
changing milliseconds to 100 didn't solve the problem
-
setTimer()
isn't a function.
Don't declarereg
inside timer callbacks, usevar
.
You should set your timer callback withinon init
, not inside a function.Some of this stuff probably doesn't need to be done repeatedly in a timer. For example updating the list of directories. You only need to do that once at start, and then again when the user makes a change to the directory structure through your custom browser.
I would still encourage you to adapt your design and use the stock preset browser. You will get your project finished way more quickly.
-
@d-healey Thanks David! Decided to scrap the timer callback due to what you said on updating the entries repeatedly! Did not think of it that way. Now there's three different inline functions for each of the viewports update code, works amazing and the viewport updates whenever clicked on, it it would run the functions whenever a change is made in the browser! I did think about modifying some aspects to fit the browser, but the future integrations/features with the preset browser with other elements and for the most customizability, the default one just seems like it'd be a restriction later on