New Tool (3.1): GT16-Colors v1.2a1 (updated 12 June 2017)

Just some quick tiny thoughts Raul. To save having the transport record border flash when the user presses a ‘WMP key’, I suppose you could just preserve the note/volume/instrument rather than toggling the edit_mode in function ‘wmp_fn_bt_pres’?

I leave here both codes, in case anyone wants to study it:

–Codefirst version (causes flicker in frame Edit Mode for pattern editor):

--Button Pressed for OSC Server
function wmp_fn_bt_pres( stored_edit_mode )
  stored_edit_mode = renoise.song().transport.edit_mode
  if stored_edit_mode then
    renoise.song().transport.edit_mode = false
  end
  osc_client:trigger_instrument( true, wmp_instr(), wmp_track(), wmp_note(), wmp_vel() )
  if stored_edit_mode then
    local timer_func
    timer_func = function()
      renoise.song().transport.edit_mode = true
      renoise.tool():remove_timer( timer_func )
    end
    renoise.tool():add_timer(timer_func, 40 ) -- 40 default value
  end
end
--Button Released for OSC Server
function wmp_fn_bt_rel()
  osc_client:trigger_instrument( false, wmp_instr(), wmp_track(), wmp_note(), wmp_vel() )
end

-Codemodified (prevents flicker):

--Button Pressed for OSC Server
function wmp_fn_bt_pres( stored_edit_mode )
  local song = renoise.song()
  if song.transport.edit_mode == false then
    osc_client:trigger_instrument( true, wmp_instr(), wmp_track(), wmp_note(), wmp_vel() )
    return
  else
    local spi, sti, sli, snci = song.selected_pattern_index, song.selected_track_index, song.selected_line_index, song.selected_note_column_index
    local column = song:pattern(spi):track(sti):line(sli):note_column(snci)
    local patnte, patinst, patvol = column.note_value, column.instrument_value, column.volume_value
    
    osc_client:trigger_instrument( true, wmp_instr(), wmp_track(), wmp_note(), wmp_vel() )

    local timer_func
    timer_func = function()
      if column.note_value == wmp_note() and column.volume_value == wmp_vel() and column.instrument_value == wmp_instr()-1 then
        renoise.tool():remove_timer( timer_func )
        column.note_value = patnte
        column.instrument_value = patinst
        column.volume_value = patvol
      end
    end
    renoise.tool():add_timer(timer_func, 20)   
  end
end
--Button Released for OSC Server
function wmp_fn_bt_rel()
  osc_client:trigger_instrument( false, wmp_instr(), wmp_track(), wmp_note(), wmp_vel() )
end

This issue was a headache! With the last code, even if a very high value is set inrenoise.tool():add_timer(timer_func, 20 ) the frame work without flicker.

Thank you for this!I will review it. Related Topic

Also (a small tip) surely no need to write all those if/else statements (for example in functions ‘wmp_ctrl_ins’ and ‘wmp_fn_pp_pan’)? Made my eyes go funny Raul scrolling around :slight_smile:

Yes, some functions can be reduced.At first, I use a breakdown to study behavior.I have to review all the functions again, in an optimization process.But I will take time to do it. Thanks!