What's new

Show multiple Waveforms for 4 groups at the same time

The-Architect

New Member
Is there a way to show 4 waveforms changes for 4 different group menus at the same time. All are mapped on different zones and some are on the same zones. Something like NI light series with 4 waveforms. Just need the logic!
 
Sure there is a way. It's all about which zone IDs you attach to the ui_waveform widget.
Ok, storing the zone ids and directly using them on listener and on persistence solves the wave problem but can you show the play cursors at the same time for the groups whose zones are mapped on separate keys?
 
Why would the below not work? I am checking the group of the stored event ids array to find the play position of an event if it belongs in the correct group:
Code:
on init
    make_perfview
    set_ui_color(000000)
    set_ui_width_px(999)
    set_ui_height_px(300)
    set_listener($NI_SIGNAL_TIMER_MS,40000)

    declare ui_waveform $wf1(10,10)
    set_control_par(get_ui_id($wf1), $CONTROL_PAR_WIDTH, 281)
    set_control_par(get_ui_id($wf1), $CONTROL_PAR_HEIGHT,70)
    set_control_par(get_ui_id($wf1), $CONTROL_PAR_WAVE_COLOR, 11186870)
    set_control_par(get_ui_id($wf1),$CONTROL_PAR_BG_ALPHA,0)
    hide_part($wf1,$HIDE_PART_BG)
    move_control_px($wf1, 25, 125)

    declare ui_waveform $wf2(10,10)
    set_control_par(get_ui_id($wf2), $CONTROL_PAR_WIDTH, 281)
    set_control_par(get_ui_id($wf2), $CONTROL_PAR_HEIGHT,70)
    set_control_par(get_ui_id($wf2), $CONTROL_PAR_WAVE_COLOR, 11186870)
    set_control_par(get_ui_id($wf2),$CONTROL_PAR_BG_ALPHA,0)
    hide_part($wf2,$HIDE_PART_BG)
    move_control_px($wf2, 650, 125)

    declare $noteID
    declare $noteID2
    declare $i

    declare %activeevents[500]
end on


on note
    $noteID := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
    set_event_par_arr($noteID, $EVENT_PAR_ALLOW_GROUP, 0, $ALL_GROUPS)
    set_event_par_arr($noteID, $EVENT_PAR_ALLOW_GROUP, 1, 0)
    wait(1)
    attach_zone($wf1,get_event_par($noteID,$EVENT_PAR_ZONE_ID), 0)


    $noteID2 := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,-1)
    set_event_par_arr($noteID2, $EVENT_PAR_ALLOW_GROUP, 0, $ALL_GROUPS)
    set_event_par_arr($noteID2, $EVENT_PAR_ALLOW_GROUP, 1, 1)  
    wait(1)
    attach_zone($wf2,get_event_par($noteID2,$EVENT_PAR_ZONE_ID), 0)

    get_event_ids(%activeevents)
end on

on listener
    if ($NI_SIGNAL_TYPE = $NI_SIGNAL_TIMER_MS)
        $i := 0
        while($i < 500)
            if(get_event_par_arr(%activeevents[$i], $EVENT_PAR_ALLOW_GROUP, 0) = 1)
                set_ui_wf_property($wf1,$UI_WF_PROP_PLAY_CURSOR,0,get_event_par(%activeevents[$i],$EVENT_PAR_PLAY_POS)-1)  
            end if
        inc($i)
        end while

        $i := 0
        while($i < 500)
            if(get_event_par_arr(%activeevents[$i], $EVENT_PAR_ALLOW_GROUP, 1) = 1)
                set_ui_wf_property($wf2,$UI_WF_PROP_PLAY_CURSOR,0,get_event_par(%activeevents[$i],$EVENT_PAR_PLAY_POS)-1)  
            end if
        inc($i)
        end while    
    end if
end on
 
Top Bottom