1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

custom loading/complete label

Discussion in 'Scripting Workshop' started by Lovechld2000, Dec 6, 2020.

  1. Lovechld2000

    Lovechld2000 NI Product Owner

    Messages:
    267
    I'd like to have a big friendly loading /complete animated label. This is how I thought I could do it. But async finishes even when the samples are still loading into ram (sampler mode) I also tried using get_purge_state in a while statement with the label change after that, but i couldn't get it to wait and THEN show the label state change, i'm not even sure that was going to work
    Code:
    on ui_control(load)
        infographic(system,0,$HIDE_PART_NOTHING)  {<- label visible showing wait state 0}
        $asyncID_purge := purge_group(mygroup, 1)
    end on
    
    on async_complete
        if ($NI_ASYNC_ID = $asyncID_purge)
            $asyncID_purge := -1
            if ($NI_ASYNC_EXIT_STATUS = 1)
                infographic(system,1,$HIDE_PART_NOTHING) {<- changes label to complete state 1}
            end if   
        end if
    end on
     
  2. soundtrax

    soundtrax NI Product Owner

    Messages:
    301
    "is_zone_empty" should work (not only for user zones) to check if a sample is actually loaded.
     
  3. Lovechld2000

    Lovechld2000 NI Product Owner

    Messages:
    267
    how would you structure it using "is zone empty" would it be a while loop or something else?
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    I wouldn't bother, Kontakt already has loading progress showing right below instrument header...
     
  5. soundtrax

    soundtrax NI Product Owner

    Messages:
    301
    I quite like your idea of a loading label...
    What I would try:
    - Show the label on $load control (like you already did it)
    - then hide the label again when the samples are un-purged with:
    if (is_zone_empty(<number of the last zone of your group>) = 0)
     
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Above wouldn't work because there's no guarantee that samples are loaded in the same order as they are in the groups.
     
  7. soundtrax

    soundtrax NI Product Owner

    Messages:
    301
    Yeah. I just tried it myself and it does not work. And I'm not sure if purge (with non-user zones) really makes a zone empty.
     
  8. Lovechld2000

    Lovechld2000 NI Product Owner

    Messages:
    267
    thanks for your input guys. I guess the purge async id doesn't work as I expected