Development of "VPDpro. Arpeggia". Some demonstrations

With a point/value table:

>>> rprint(renoise.song().patterns[1].tracks[1].automation[1].points)
[1] => table
[time] => 509
[value] => 0.7062401175499
[2] => table
[time] => 512.99609375
[value] => 0.75
[3] => table
[time] => 513
[value] => 0.7045311331749

If I execute:

>>> renoise.song().patterns[1].tracks[1].automation[1]:clear_range(1,512.999999999)

I get (here with Linux):

>>> rprint(renoise.song().patterns[1].tracks[1].automation[1].points)
[1] => table
[time] => 512.99609375
[value] => 0.75
[2] => table
[time] => 513
[value] => 0.7045311331749

If I execute:

>>> renoise.song().patterns[1].tracks[1].automation[1]:clear()

I get:

>>> rprint(renoise.song().patterns[1].tracks[1].automation[1].points)
[1] => table
[time] => 513
[value] => 0.7045311331749

That 513 entry remains.

If I try:

>>> renoise.song().patterns[1].tracks[1].automation[1]:remove_point_at(513)

I get:

*** std::logic_error: 'invalid point time. time must be >= 1 and <= Pattern.MAX_NUMBER_OF_LINES'

If I copy an automation say from track 2 into track 1 with say:

renoise.song().patterns[1].tracks[1].automation[1]:copy_from(renoise.song().patterns[1].tracks[2].automation[1])

I get the points from track 2 into track 1. (There were no points > 512 in track 2):

>>> rprint(renoise.song().patterns[1].tracks[1].automation[1].points)
[1] => table
[time] => 25
[value] => 0.5

I execute a clear:

>>> renoise.song().patterns[1].tracks[1].automation[1]:clear()

And therefore:

>>> rprint(renoise.song().patterns[1].tracks[1].automation[1].points)
***No output***

To try to answer the difference between Linux and Windows, probably it just comes down to the difference with how embedded lua handles float point numbers between the two systems Raul. Similar to → Small Bug in “Background Blend” values. Is value 51 omitted?

Thanks 4Tey!!

Finally I have solved this issue by adding the cleaning at the end of the function of the exact time of the last point (time = 512.99609375).I do not like much having to resort to these solutions. Apparently, there is a rounding when you insert any point, so that the grid always falls to a value of + -0.00390625.

Now Arpeggia is already fine and there is no deadpoint in clearing a range of times within a 512 lines in selected pattern.

--clear level
function vpd_arp_clear_level( val_1, rns, sp, spt, spa, sli, amp, val_f )
  rns = renoise.song()
  sp = rns.selected_parameter
  spt = rns.selected_pattern_track
  sli = rns.selected_line_index
  amp = vws["VPD_ARP_AMPLITUDE"].value
  val_f = ( val_1 * amp - amp )
  if (sp) then
    spa = spt:find_automation( sp )
    if ( spa and vpd_arp_anchor == true ) then
      if ( (sli + val_f + amp) < 513 ) then
        spa:clear_range( sli + val_f, sli + val_f + amp )
        print("first individual")
      elseif ( (sli + val_f + amp) == 513 ) then
        spa:clear_range( sli + val_f, sli + val_f + amp -0.001 )
        ---last point
        if spa:has_point_at(512.99609375) then
          spa:remove_point_at(512.99609375)
        end
        print("last individual")
      end
    end
    ---
    for i = 0, 20 do
      vws["VPD_ARP_BT_"..val_1.."_"..i].color = VPD_ARP_CLR[1]
    end
  end
  ---
  VPD_ARP_BT_LEVEL[val_1] = nil
  --print(VPD_ARP_BT_LEVEL[val_1])
  --rprint(VPD_ARP_BT_LEVEL)
end

--clear level x4
function vpd_arp_clear_level_x4( value )
  for i = value, value + 3 do
    vpd_arp_clear_level( i )
  end
  rprint(VPD_ARP_BT_LEVEL)
end

--clear global level
function vpd_arp_gclear_level( rns, sp, spt, spa, sli, amo, amp )
  rns = renoise.song()
  sp = rns.selected_parameter
  spt = rns.selected_pattern_track
  sli = rns.selected_line_index
  amo = vws["VPD_ARP_AMOUNT"].value
  amp = vws["VPD_ARP_AMPLITUDE"].value
  if (sp) then
    spa = spt:find_automation( sp )
    if ( spa and vpd_arp_anchor == true ) then
      if ( ( sli + amo * amp ) < 513 ) then
        spa:clear_range( sli, sli + amo * amp )
        print("first global")
      elseif ( ( sli + amo * amp ) == 513 ) then
        spa:clear_range( sli, sli + amo * amp - 0.001 )
        ---last point
        if spa:has_point_at(512.99609375) then
          spa:remove_point_at(512.99609375)
        end
        print("last global")
      end
    end
  end
  ---
  for c = 1, 16 do
    for i = 0, 20 do
      vws["VPD_ARP_BT_"..c.."_"..i].color = VPD_ARP_CLR[1]
      vws["VPD_ARP_BT_G_"..i].color = VPD_ARP_CLR[1]
    end
    VPD_ARP_BT_LEVEL[c] = nil
  end
end

--clear all points
function vpd_arp_clear_all( sli, nol, sp, spt, spa )
  sli = renoise.song().selected_line_index + 0.007
  nol = renoise.song().selected_pattern.number_of_lines + 1.999
  sp = renoise.song().selected_parameter
  spt = renoise.song().selected_pattern_track
  --there might be no parameter selected...
  if (sp) then
    spa = spt:find_automation( sp )
    if (spa) then
      spa = spt:delete_automation( sp )
    end
  end
end

I enclose the rest of the functions related to erase the envelope or erase only time ranges…

Edit:I believe that as it is now, it will work well in Linux and in Windows.