mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-24 06:10:09 +01:00
Additional autosave speed improvement and 1 fix
This changes the autosave XML file to a binary representation during writing to speed up autosave processing. A lot of the time used during autosave is a result of having to convert and print all of the values to the XML file. Writing the same information, but in binary format, reduces all of that to just the bare essentials and the actual write I/O. During recovery, the binary file is read and converted to the real xML representation and processing happens as it did before. It is a noticeable difference with very long or many tracks. The included fix has to do with append recording. Say you have 3 tracks and you want to append recorded audio to the middle track. Sometime later Audacity crashes and upon recovery, the recorded audio is actually appended to the third track, not the second one. This fixes that by adding an "autosaveid" to each track as it is written to the autosave file. The same ID is written to the recording recovery appends to the autosave file. Then, during recovery, the IDs are matched up and the audio gets appended to the proper track. These autosaveid attributes are only present in the autosave file and not in saved project files.
This commit is contained in:
@@ -3384,7 +3384,7 @@ void AudioIO::FillBuffers()
|
||||
{
|
||||
// Append captured samples to the end of the WaveTracks.
|
||||
// The WaveTracks have their own buffering for efficiency.
|
||||
XMLStringWriter blockFileLog;
|
||||
AutoSaveFile blockFileLog;
|
||||
int numChannels = mCaptureTracks.GetCount();
|
||||
|
||||
for( i = 0; (int)i < numChannels; i++ )
|
||||
@@ -3392,7 +3392,7 @@ void AudioIO::FillBuffers()
|
||||
int avail = commonlyAvail;
|
||||
sampleFormat trackFormat = mCaptureTracks[i]->GetSampleFormat();
|
||||
|
||||
XMLStringWriter appendLog;
|
||||
AutoSaveFile appendLog;
|
||||
|
||||
if( mFactor == 1.0 )
|
||||
{
|
||||
@@ -3423,6 +3423,7 @@ void AudioIO::FillBuffers()
|
||||
if (!appendLog.IsEmpty())
|
||||
{
|
||||
blockFileLog.StartTag(wxT("recordingrecovery"));
|
||||
blockFileLog.WriteAttr(wxT("id"), mCaptureTracks[i]->GetAutoSaveIdent());
|
||||
blockFileLog.WriteAttr(wxT("channel"), (int)i);
|
||||
blockFileLog.WriteAttr(wxT("numchannels"), numChannels);
|
||||
blockFileLog.WriteSubTree(appendLog);
|
||||
|
||||
Reference in New Issue
Block a user