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

EVENT_PAR_ZONE_ID differs with duration in play_note

Discussion in 'Scripting Workshop' started by mindblower23!, Sep 20, 2021.

  1. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    I want to know if a note has a zone attached to it. So I used EVENT_PAR_ZONE_ID but I get different results depending on the duration value in the note_on function.

    Code:
    ev := play_note(EVENT_NOTE, EVENT_VELOCITY, 0, -1)
    wait(1)
    message(get_event_par(ev, EVENT_PAR_ZONE_ID)) // prints -1
    This returns -1 if I play notes with no zones attached. This is how I thought things should work.

    Code:
    ev := play_note(EVENT_NOTE, EVENT_VELOCITY, 0, 0)
    wait(1)
    message(get_event_par(ev, EVENT_PAR_ZONE_ID)) // prints 0
    This returns 0 if I play notes with no zones attached.

    Is this by design? Or am I missing something again?
     
    Last edited: Sep 20, 2021
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    You need to wait(1) before grabbing the zone ID.
     
  3. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    I did. it's just a snippet of the code ... edited the post to reflect this.
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    If you don't have any zones in the instrument then there's no zone ID to return!
     
  5. mindblower23!

    mindblower23! NI Product Owner

    Messages:
    40
    Yes, it should return -1. But it returns 0 (the first available zone in the group) if the duration ist set to 0 in the play_note function ...
     
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Curious. No idea - first time I see that!