yucongj / piano-precision

GNU General Public License v2.0
8 stars 1 forks source link

Add the logic that actually saves to CSV #26

Closed cannam closed 9 months ago

cannam commented 9 months ago

This PR adds the code to actually save musical event data to CSV.

There is also a logical change in Session::exportAlignmentTo, to make the export go ahead even if there is no alignment available - so that the user can export an empty alignment in order to get a CSV file with "template" musical event data only. Since the export code doesn't actually need an alignment any more, we can go ahead both with and without it.

Also a few changes to the UI state handling in MainWindow - it was possible to get in a mess by e.g. opening a new file while the UI was still waiting for an alignment to be accepted or rejected, so now opening a new file also rejects the alignment.

Similarly I've made it so that you can't export an alignment that has not yet been accepted or rejected - nor can you load one to replace it - since it was pretty ambiguous what that would lead to, and it would probably only happen because the user had forgotten to accept.

I haven't made any interesting decisions about what the CSV format should look like, so do adjust the content of exportAlignmentEntriesTo to taste. Once the saved format is settled, we can readily enough update the import code as well.