• R/O
  • HTTP
  • SSH
  • HTTPS

Alchemusica: Commit

Free MIDI Sequencer for Mac


Commit MetaInfo

Revisiónd2f26a2aeacd81c39fc8892a1698b14ae52ecc6d (tree)
Tiempo2022-08-07 00:12:07
AutorToshi Nagata <alchemist.2005@nift...>
CommiterToshi Nagata

Log Message

Modify durations command is implemented

Cambiar Resumen

Diferencia incremental

--- a/Ruby_Scripts/200.commands.rb
+++ b/Ruby_Scripts/200.commands.rb
@@ -341,6 +341,36 @@ def move_selected_events_to_track
341341 end
342342 end
343343
344+@@modify_durations_delta = "0"
345+
346+def modify_durations
347+ values = [@@modify_durations_delta]
348+ hash = Dialog.run("Modify Durations") {
349+ layout(1,
350+ layout(2,
351+ item(:text, :title=>"Duration delta (tick)"),
352+ item(:textfield, :width=>40, :tag=>"delta", :value=>values[0])))
353+ }
354+ # p hash
355+ if hash[:status] == 0
356+ delta = hash["delta"].to_f
357+ @@modify_durations_delta = hash["delta"]
358+ if delta != 0.0
359+ each_track { |tr|
360+ next if tr.selection.length == 0
361+ tr.each_selected { |p|
362+ next if p.kind != :note
363+ d = p.duration + delta
364+ if d <= 0
365+ d = 1
366+ end
367+ p.duration = d
368+ }
369+ }
370+ end
371+ end
372+end
373+
344374 end
345375
346376 register_menu("Change Timebase...", :change_timebase)
@@ -348,3 +378,4 @@ register_menu("Randomize Ticks...", :randomize_ticks, 1)
348378 register_menu("Thin Selected Events...", :thin_events, 1)
349379 register_menu("Create tremolo...", :create_tremolo, 1)
350380 register_menu("Move selected events to track...", :move_selected_events_to_track, 1)
381+register_menu("Modify durations...", :modify_durations, 1)
Show on old repository browser