Arpeggiator loop problem.

Home Forums General Programming Arpeggiator loop problem.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #116741
    Tedjuh
    Participant
    • Topics: 7
    • Replies: 70
    • Total: 77

    Hello there..

    I’m trying to build an arpeggiator to program my own arps for my Roland SH-201.

    The arpeggiator consists of uiLabels which you can change on doubleclick with a popup menu. Schematically:
    [X][ ][ ][X] [X][Tie][Tie][Tie] [X][Tie][Tie][Tie]

    Essentially it consists of 16 rows of 32 uiLabels.
    Every [] is a uiLabel named 1-1, 1-2, 1-3 and so on. (or 2-1, 2-2 for 2nd row)
    x = note selected. Empty = empty. Tie = Tied Note, extends note

    Most of the menu is working except for one small thing. I want to be able to delete all Tied notes until the next X. For instance: I deselect the X in the second bar. It should delete the Tie’s that follow until the next X. Because you cannot have Tied notes without a selected note. But it should not delete the Ties in the Third bar. Schematically:
    [X][ ][ ][X] [][][][] [X][Tie][Tie][Tie]

    (sC = L(comp:getOwner():getName())
    (rowNr is componentGroupName of sC .. just 1 2 3 and so on)
    (labelNr is componentVisibleName of sC .. just 1 2 3 and so on)

    this deletes everything in selected row:

    row = string.format("%s-", rowNr)
    for i = 1,32 do
    panel:getComponent(row..i):setText("")
    end

    How do I iterate over the uiLabels until an X is met which breaks the loop? Because:

    i = tonumber(labelNr)
    	
    while i <= 31 do
    i = i + 1
    console("I = "..i)
    console(row..i)
    
    	if panel:getComponent(row..i):getProperty("uiLabelText") == "Tie" then
    	panel:getComponent(row..i):setText("")
    	elseif panel:getComponent(row..i):getProperty("uiLabelText") == "X" then
    	break
    	end
    end

    results in a nil value for the first if statement..

    without the if statement console prints 1-1, 1-2 1-3 and so on.. so why doesn’t it run over all the labels to see if it’s a Tie or X ?

    I’m lost.. :-/

    Thnx in advance..

    I wish i could send the panel but i don’t know which file to send..

    #116742
    Tedjuh
    Participant
    • Topics: 7
    • Replies: 70
    • Total: 77

    Whew, guess I solved my own problem.

    i = tonumber(labelNr)
    	
     	for i = labelNr,31 do
    	i = i + 1
    
    		if panel:getComponent(row..i):getProperty("uiLabelText") == "Tie" then
    		panel:getComponent(row..i):setText("")
    		panel:getModulatorByName("vel"..row..i):setModulatorValue(0, false, false, false)
    		elseif panel:getComponent(row..i):getProperty("uiLabelText") == "X" then
    		break
    		end
    
    	end

    Now it doesn’t delete all the ties in the 1st or 2nd bar when i delete the ties in the third. This works when the clicked label is a Tie, now to make it work when the clicked label is an “X” followed by a Tie or Ties.

    #116750
    dnaldoogdnaldoog
    Participant
    • Topics: 3
    • Replies: 442
    • Total: 445
    • ★★

    
    
    • This reply was modified 8 months, 2 weeks ago by dnaldoogdnaldoog.
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
There is currently 0 users and 36 guests online
No users are currently active
Forum Statistics
Threads: 2,423, Posts: 17,090, Members: 56,845
Most users ever online was 12 on January 22, 2019 3:47 pm
Do NOT follow this link or you will be banned from the site!