1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Fix autorecover to recover more than just 3 recording tracks

Also fix mac crash due to assertion where envelope len is zero after recovery.
This commit is contained in:
mchinen 2010-07-09 16:17:45 +00:00
parent cf3ba227f7
commit fb9e6e5f1a

View File

@ -282,7 +282,8 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
return false; return false;
} }
WaveTrack* track = tracks.Item(index); WaveTrack* track = tracks.Item(index);
Sequence* seq = track->GetLastOrCreateClip()->GetSequence(); WaveClip* clip = track->GetLastOrCreateClip();
Sequence* seq = clip->GetSequence();
// Load the blockfile from the XML // Load the blockfile from the XML
BlockFile* blockFile = NULL; BlockFile* blockFile = NULL;
@ -297,6 +298,7 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
} }
seq->AppendBlockFile(blockFile); seq->AppendBlockFile(blockFile);
clip->UpdateEnvelopeTrackLen();
} else if (wxStrcmp(tag, wxT("recordingrecovery")) == 0) } else if (wxStrcmp(tag, wxT("recordingrecovery")) == 0)
{ {
@ -312,10 +314,11 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
break; break;
const wxString strValue = value; const wxString strValue = value;
//this channels value does not correspond to WaveTrack::Left/Right/Mono, but which channel of the recording device
//it came from, and thus we can't use XMLValueChecker::IsValidChannel on it. Rather we compare to the next attribute value.
if (wxStrcmp(attr, wxT("channel")) == 0) if (wxStrcmp(attr, wxT("channel")) == 0)
{ {
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || nValue < 0)
!XMLValueChecker::IsValidChannel(nValue))
return false; return false;
mChannel = nValue; mChannel = nValue;
} }
@ -324,8 +327,11 @@ bool RecordingRecoveryHandler::HandleXMLTag(const wxChar *tag,
if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) || if (!XMLValueChecker::IsGoodInt(strValue) || !strValue.ToLong(&nValue) ||
(nValue < 1)) (nValue < 1))
return false; return false;
if(mChannel >= nValue )
return false;
mNumChannels = nValue; mNumChannels = nValue;
} }
} }
} }