Saving and Opening Edits [Tracktion Engine]

Hi all,

I’m wondering how I should go about saving edits made in my program and how to open those edits later. I’ve checked out using ProjectManager::createNewProjectInteractively as a potential solution, but according to this post from 2018, Projects are not to be used - is this still true? I feel like it makes to use them, but I’m not sure…

You should still avoid using projects, there is a lot of legacy functionality that you probably don’t need.

The idea was, you could add a wave file to a project and it would get an id. Then you could use that id in several edits, and then you could swap out the wave file and all the edits would change. Turns out, that’s not some anybody ever wants, it adds complexity, and it confuses users. Now, edits can just use relative paths. Much better.

To load an edit:

edit = std::make_unique<te::Edit> (engine, te::loadEditFromFile (engine, editFile, {}), te::Edit::forEditing, nullptr, 0);

To save:

EditFileOperations (edit).save (true, false, true)

or

EditFileOperations (edit).writeToFile (file, false)

2 Likes

Awesome, works like a charm. Thank you!

I get an assert with this.

jassert (editProjectItemID.isValid());

I’m creating the edit like this:
edit = std::make_uniquete::Edit (engine, te::createEmptyEdit (engine), te::Edit::forEditing, nullptr, 0);

I’ve simplified creating edits with some new functions in track_EditfileOperations.h

Now you can do edit = te::loadEditFromFile (engine, editFile); or edit = te::createEmptyEdit (engine, editFile); and it’ll setup all the options correctly and pass to the Edit constructor.

2 Likes