HISE Logo Forum
    • Categories
    • Register
    • Login

    Local int in an inline function won't increase with timer, but an object property will

    Scheduled Pinned Locked Moved Bug Reports
    1 Posts 1 Posters 84 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.
    • A
      aaronventure
      last edited by

      Take a look at this snippet

      HiseSnippet 1019.3ocuWstaiSDEdbZGD1.qXk3Avp+xUaIxwrWPffcooonHnsQjkUHgPqlLdRyPmLi03wEhp5KDuG79va.bFeK1oI8RztDoD44b86bY74jQZEkklpzHG2WuHggb9X73ERyr9yHbIZ3QHmGgOgjZXZ+BRGtHgjlxhQNN678VBNt6hx+7Ou7PhfHorkjPn2n3T1OxmyMKoN5U+.WHNlDydMedCoe5qFRUx9JgJCvyN3PTBgdA4b1oDqXcvHmOXPL2nziMDCKE4r6gp3Eimo9CYg7ugmxmHX1C8PiACUP9XkH1hXKUT+YbQ7np3NEAVYzxrvNEYgOCeBOlWSeY13SyY3uTil4CmNsg2NsfWulvKrA7VCjbZ.ocKfziwioZdhYIGKd9H7PITblRfzdSnTHKpyeiw8UfDRS24jKXGqgC0ZD77vvC7ge1+q873RAWx7mlIoFtR5afZidX5YS9cF0DPUySTRvL66ckmqPQIhBI7+F+AxyAM6R0LHrskTcoRfYKEkZrBd00.AOW3P2JcCAJ4O2M0PzlbsChdlEQt0bXEz6SDhIPGQPEF+0ZTcf0CGTfneKXeO2q.sc4S8CZ3Lva.GW.+ttPRIUIXcSzboIXuYrE9pbPum0ytWCeYhTleaS7s2hETsLPcPoRJhoZy5spp0lOWjkN6IOANeMP75MVbFJeGUYBqJL+OURtyhA7v5qD2QMnVuGVAnJ02Jo6AuMJ03eIQ6eXlwnj8frS0soyYl9UgZvdk7st1J9jdS4ZP07j4MJdJYo3VaoUhfF4rKIhLVdkrxFubi2D8+pJGYQMb2x6N.msrU5y5B2pfw9pfaD3Q2QfGUG3Q2m.O51C7nUB71c41nN5dG0Q2dTG0Lp8Z.zSUF1Yxfb.A8B9qxZ5z0xqzbBa+1ZXW1ItYECjYymvzMSGVAgg.smrf27jklC9nEYlFBpjCkbyYIL4lFGhJSmvTnNknBD0jOC5QkyfJRdHNLpwEW1+fxgbyY+nGf5QqQ8ed3QDCwNMrDR.LSXZC2lAbNhcIrZQwrQW7QrzKfq54XtrE.RZ2CT+mMc4hUf+CvRQVKgc9qaXkaNIG1gPEmIHl1KVX2lpjAzSzZZtchsLkaVzbaq2Yaabeg3iwi3F5r0iwNqAi1Vn2CXrbGsOAOX5T3MhKA3t3i+k2OKjg9IUlgKO+DhQysE5SylOFVSkx.uKkv.Jawuisoo3bn8rMCLlIiyO7uvmRl8rmcJY1qhIZNgpUukVbowtE3GlSAvjLeAXWXSb3re8UMLNraHZNrP5aoTa3+4vE50qSzVnyWrE57zsPmmsE577sPmWrE57k2pN1+Kv2kYTyKtN.DFMH+cVNNCjDnyJuKD8e3wVNyJ
      

      I have to inline functions that are seemingly the same. Both create a timer object and a local counter, as well as set two conditions that should happen in the timer. The idea is that once the counter counts off once, the second condition executes.

      I'm doing this to time fadeComponent properly, so that another fade in starts once the fade out completes.

      One function sets the counter as an integer and attempts to increase it at the end of the timer callback. This fails.

      I was baffled by this, given how I was able to do my animation timers properly without issues, but then remembered that the counters there were in the .data object of a panel. So I duplicated the function and created an object with the counter now being a property. And whaddyaknow, this works as expected.

      There's a simple ternary in the control callback to prevent execution on compile. Trigger the buttons to see this in action.

      Why does the int counter fail to count up?

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

      20

      Online

      1.8k

      Users

      12.0k

      Topics

      104.5k

      Posts