Lua: Undo works only on fade in operations (not fade out) - bug?

Either I’m going crazy, or here is a bug. Please try out running this test script on an audio region:

-- prepare undo operation
Session:begin_reversible_command ("FADE IN AND OUT")
local add_undo = false -- keep track if something has changed

local sel = Editor:get_selection ()
for r in sel.regions:regionlist ():iter () do

	-- prepare selected region(s) for undo
	r:to_stateful ():clear_changes ()

	local ar = r:to_audioregion ()
	ar:set_fade_out_shape (ARDOUR.FadeShape.FadeLinear)
	ar:set_fade_out_length (100000)
	ar:set_fade_out_active (true)

	ar:set_fade_in_shape (ARDOUR.FadeShape.FadeLinear)
	ar:set_fade_in_length (100000)
    ar:set_fade_in_active (true)

    -- save changes for selected region(s) (if any) to undo command
	if not Session:add_stateful_diff_command (r:to_statefuldestructible ()):empty () then
		add_undo = true


-- all done, commit the combined Undo Operation
if add_undo then
	-- the 'nil' Command here means to use the collected diffs added above
	Session:commit_reversible_command (nil)
	Session:abort_reversible_command ()

Here: Fade in and fade out are created correctly; but when doing the undo command, only the fade in is removed, the fade out remains…?

Thanks for any feedback!

I did one more test round with virgin Ardour6 config folder, old and freshly created projects… It is a bit crazy - but 100% reproducible on my machine!

It works perfectly with:

  • Freshly recorded regions
  • Regions of freshly opened (existing) projects
  • Regions that have been moved within their track
  • Regions that have been shortened or extended by moving their boundaries

Fade-Out-Undo doesn’t work with:

  • A region that got moved to another track
  • Imported audio files/regions
  • Regions that have been cut apart (both new regions don’t work)
  • Region that got copied with Ctrl+drag (“original” region still works) or Ctrl+c/x/Ctrl+v
  • (Once project is saved and reopened, also those regions work as expected (again)!)

Interesting: I also tried with scripting only fade outs: Interestingly, the undo command is not even registered/available for the dysfunctioning cases mentioned above!

On the fade-in-side everything seems to be perfect!

If some one else could confirm (takes only two minutes!), I will post a bug report. Thank you!

Unfortunately nobody confirmed (that it isn’t my mistake), but I filed a bug report:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.