Fully non-destructive editors can easily implement an undo feature simply by "backtracking" in the edit decision list; no waveform data has to be changed on disk. It is more difficult for in-place editors, because they must save a copy of the samples before the edit, which can take time proportional to the size of the edit. With a simple modification, our sequence-based approach can be used to implement an unlimited undo mechanism that runs in constant time and wastes very little space. To do this, let each block of samples to which every node points be a reference-counted object instead of just a simple array. That way, two different nodes can point to the same set of samples, and the samples are not destroyed until both nodes pointing to them are deleted.
~
MAZZONI, Dominic and DANNENBERG, Roger B., 2002. A fast data structure for disk-based audio editing. Computer Music Journal. Online. 2002. Vol. 26, no. 2, p. 62–76. [Accessed 10 November 2023]. Available from: https://www.jstor.org/stable/3681457
From a FileLocator to a JSONObjectNode