v.audacity 2011-11-16 05:59:48 +00:00
parent 618df78900
commit 59db8d4ad4
21 changed files with 77 additions and 81 deletions

View File

@ -1577,7 +1577,7 @@ bool AudacityApp::CreateSingleInstanceChecker(wxString dir)
runningTwoCopiesStr +
_("Do you still want to start Audacity?");
int action = wxMessageBox(prompt,
_("Error locking temporary folder"),
_("Error Locking Temporary Folder"),
wxYES_NO | wxICON_EXCLAMATION,
NULL);
if (action == wxNO) {

View File

@ -1754,7 +1754,7 @@ void AudioIO::StopStream()
if (recordingOffset < 0)
track->Clear(mT0, mT0 - recordingOffset); // cut the latency out
else
track->InsertSilence(mT0, recordingOffset); // put silence in
wxASSERT(track->InsertSilence(mT0, recordingOffset)); // put silence in
}
else
{ // recording into a new track

View File

@ -423,7 +423,11 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
if (mEditDetail)
Printf(wxT("Paste: %d\n"), y0 * chunkSize);
t->Paste(double (y0 * chunkSize), tmp);
if (!t->Paste((double)(y0 * chunkSize), tmp))
{
Printf(wxT("Trial %d\nFailed on Paste.\n"), z);
goto fail;
}
if (t->GetClipByIndex(0)->GetSequence()->GetNumSamples() != (sampleCount) nChunks * chunkSize) {
Printf(wxT("Trial %d\n"), z);

View File

@ -3465,7 +3465,7 @@ void AudacityProject::OnPaste()
}else{
WaveTrack *tmp;
tmp = mTrackFactory->NewWaveTrack( ((WaveTrack*)n)->GetSampleFormat(), ((WaveTrack*)n)->GetRate());
tmp->InsertSilence(0.0, msClipT1 - msClipT0); // MJS: Is this correct?
wxASSERT(tmp->InsertSilence(0.0, msClipT1 - msClipT0)); // MJS: Is this correct?
tmp->Flush();
bPastedSomething |=
@ -3590,19 +3590,16 @@ bool AudacityProject::HandlePasteNothingSelected()
pNewTrack = mTrackFactory->NewTimeTrack();
break;
default:
// Vaughan, 2010-08-05:
// This is probably an error, but was never checked...
// The only kinds of tracks not checked above are Track::None and Track::All.
pClip = iterClip.Next();
continue;
}
wxASSERT(pClip);
pNewTrack->SetLinked(pClip->GetLinked());
pNewTrack->SetChannel(pClip->GetChannel());
pNewTrack->SetName(pClip->GetName());
// Vaughan, 2010-08-05: This code never checked the paste result...
pNewTrack->Paste(0.0, pClip);
wxASSERT(pNewTrack->Paste(0.0, pClip));
mTracks->Add(pNewTrack);
pNewTrack->SetSelected(true);

View File

@ -2328,7 +2328,7 @@ void AudacityProject::OpenFile(wxString fileName, bool addtohistory)
int numRead = ff->Read(buf, 15);
if (numRead != 15) {
wxMessageBox(wxString::Format(_("File may be invalid or corrupted: \n%s"),
(const wxChar*)fileName), _("Error opening file or project"),
(const wxChar*)fileName), _("Error Opening File or Project"),
wxOK | wxCENTRE, this);
ff->Close();
delete ff;
@ -3043,7 +3043,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
{
if (mUndoManager.UnsavedChanges() && mEmptyCanBeDirty) {
int result = wxMessageBox(_("Your project is now empty.\nIf saved, the project will have no tracks.\n\nTo save any previously open tracks:\nClick 'No', Edit > Undo until all tracks\nare open, then File > Save Project.\n\nSave anyway?"),
_("Warning empty project"),
_("Warning - Empty Project"),
wxYES_NO | wxICON_QUESTION, this);
if (result == wxNO)
return false;
@ -3116,7 +3116,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
wxMessageBox(wxString::Format(
_("Could not save project. Path not found. Try creating \ndirectory \"%s\" before saving project with this name."),
projPath.c_str()),
_("Error saving project"),
_("Error Saving Project"),
wxICON_ERROR, this);
return false;
}
@ -3153,7 +3153,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
wxRename(safetyFileName, mFileName);
wxMessageBox(wxString::Format(_("Could not save project. Perhaps %s \nis not writable or the disk is full."),
project.c_str()),
_("Error saving project"),
_("Error Saving Project"),
wxICON_ERROR, this);
return false;
}
@ -3176,7 +3176,7 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
wxMessageBox(wxString::Format(
_("Couldn't write to file \"%s\": %s"),
mFileName.c_str(), pException->GetMessage().c_str()),
_("Error saving project"), wxICON_ERROR);
_("Error Saving Project"), wxICON_ERROR);
delete pException;
@ -3443,10 +3443,10 @@ bool AudacityProject::Import(wxString fileName, WaveTrackArray* pTrackArray /*=
if (!errorMessage.IsEmpty()) {
// Version that goes to internet...
// ShowErrorDialog(this, _("Error importing"),
// ShowErrorDialog(this, _("Error Importing"),
// errorMessage, wxT("http://audacity.sourceforge.net/help/faq?s=files&i=wma-proprietary"));
// Version that looks locally for the text.
ShowErrorDialog(this, _("Error importing"),
ShowErrorDialog(this, _("Error Importing"),
errorMessage, wxT("innerlink:wma-proprietary"));
}
if (numTracks <= 0)
@ -3539,7 +3539,11 @@ bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/)
//We should only overwrite it if this project already has the same name, where the user
//simply chose to use the save as command although the save command would have the effect.
if(mFileName!=fName+ext && wxFileExists(fName+ext)) {
wxMessageDialog m(NULL, _("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."), _("Error Saving Project"), wxOK|wxICON_ERROR);
wxMessageDialog m(
NULL,
_("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
_("Error Saving Project"),
wxOK|wxICON_ERROR);
m.ShowModal();
return false;
}
@ -4190,7 +4194,7 @@ void AudacityProject::EditClipboardByLabel( WaveTrack::EditDestFunction action )
regions.Item(i+1)->start - regions.Item(i)->end);
}
merged->Paste( 0.0 , dest );
wxASSERT(merged->Paste( 0.0 , dest ));
delete dest;
}
}
@ -4392,7 +4396,7 @@ void AudacityProject::AutoSave()
wxMessageBox(wxString::Format(
_("Couldn't write to file \"%s\": %s"),
(fn + wxT(".tmp")).c_str(), pException->GetMessage().c_str()),
_("Error writing autosave file"), wxICON_ERROR, this);
_("Error Writing Autosave File"), wxICON_ERROR, this);
delete pException;

View File

@ -80,7 +80,7 @@ Sequence::Sequence(const Sequence &orig, DirManager *projDirManager)
mBlock = new BlockArray();
Paste(0, &orig);
wxASSERT(Paste(0, &orig));
}
Sequence::~Sequence()
@ -533,6 +533,7 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
insertBlock->f = mDirManager->CopyBlockFile(srcBlock->Item(i)->f);
if (!insertBlock->f) {
// TODO error: Could not paste! (Out of disk space?)
wxASSERT(false);
return false;
}
@ -622,6 +623,7 @@ bool Sequence::InsertSilence(sampleCount s0, sampleCount len)
sTrack->mNumSamples = pos;
bool bResult = Paste(s0, sTrack);
wxASSERT(bResult);
delete sTrack;
@ -936,7 +938,7 @@ void Sequence::WriteXML(XMLWriter &xmlFile)
_("Sequence has block file with length %s > mMaxSamples %s.\nTruncating to mMaxSamples."),
Internat::ToString(((wxLongLong)(bb->f->GetLength())).ToDouble(), 0).c_str(),
Internat::ToString(((wxLongLong)mMaxSamples).ToDouble(), 0).c_str());
::wxMessageBox(sMsg, _("Warning Writing Sequence"), wxICON_EXCLAMATION | wxOK);
::wxMessageBox(sMsg, _("Warning - Length in Writing Sequence"), wxICON_EXCLAMATION | wxOK);
::wxLogWarning(sMsg);
bb->f->SetLength(mMaxSamples);
}

View File

@ -1086,7 +1086,7 @@ void TagsEditor::OnLoad(wxCommandEvent & event)
if (!reader.Parse(&mLocal, fn)) {
// Inform user of load failure
wxMessageBox(reader.GetErrorStr(),
_("Error loading metadata"),
_("Error Loading Metadata"),
wxOK | wxCENTRE,
this);
}
@ -1170,7 +1170,7 @@ void TagsEditor::OnSave(wxCommandEvent & event)
wxMessageBox(wxString::Format(
_("Couldn't write to file \"%s\": %s"),
fn.c_str(), pException->GetMessage().c_str()),
_("Error saving tags file"), wxICON_ERROR, this);
_("Error Saving Tags File"), wxICON_ERROR, this);
delete pException;
}

View File

@ -244,6 +244,7 @@ bool Track::SyncLockAdjust(double oldT1, double newT1)
if (!ret) return false;
ret = Paste(newT1, tmp);
wxASSERT(ret);
delete tmp;
return ret;

View File

@ -4885,7 +4885,7 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM
{
WaveTrack* linked = (WaveTrack*)mTracks->GetLink(track);
if (linked)
linked->ExpandCutLine(mCapturedTrackLocation.pos);
wxASSERT(linked->ExpandCutLine(mCapturedTrackLocation.pos));
mViewInfo->sel0 = cutlineStart;
mViewInfo->sel1 = cutlineEnd;
DisplaySelection();
@ -4894,10 +4894,10 @@ bool TrackPanel::HandleTrackLocationMouseEvent(WaveTrack * track, wxRect &r, wxM
}
} else if (mCapturedTrackLocation.typ == WaveTrack::locationMergePoint)
{
track->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2);
wxASSERT(track->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2));
WaveTrack* linked = (WaveTrack*)mTracks->GetLink(track);
if (linked)
linked->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2);
wxASSERT(linked->MergeClips(mCapturedTrackLocation.clipidx1, mCapturedTrackLocation.clipidx2));
MakeParentPushState(_("Merged Clips"),_("Merge"), PUSH_CONSOLIDATE|PUSH_CALC_SPACE);
handled = true;
}
@ -7090,13 +7090,14 @@ void TrackPanel::OnFormatChange(wxCommandEvent & event)
break;
default:
// ERROR -- should not happen
wxASSERT(false);
break;
}
((WaveTrack *) mPopupMenuTarget)->ConvertToSampleFormat(newFormat);
wxASSERT(((WaveTrack*)mPopupMenuTarget)->ConvertToSampleFormat(newFormat));
Track *partner = mTracks->GetLink(mPopupMenuTarget);
if (partner)
((WaveTrack *) partner)->ConvertToSampleFormat(newFormat);
wxASSERT(((WaveTrack *) partner)->ConvertToSampleFormat(newFormat));
MakeParentPushState(wxString::Format(_("Changed '%s' to %s"),
mPopupMenuTarget->GetName().
@ -7577,6 +7578,7 @@ bool TrackPanel::MoveClipToTrack(WaveClip *clip, WaveTrack* dst)
#ifdef USE_MIDI
// dst could be a note track. Can't move clip to a note track.
// EXPLAIN: How could dst be a note track (pointer)? It's declared to be a WaveTrack*. I think this test is pointless.
if (dst->GetKind() != Track::Wave) return false;
#endif

View File

@ -576,7 +576,7 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
// falls within it and this isn't the first clip in the track.
if (fabs(t1 - clip->GetStartTime()) < WAVETRACK_MERGE_POINT_TOLERANCE) {
if (i > 0) {
MergeClips(GetClipIndex(clips[i - 1]), GetClipIndex(clip));
wxASSERT(MergeClips(GetClipIndex(clips[i - 1]), GetClipIndex(clip)));
}
break;
}
@ -594,7 +594,7 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
// falls within it and this isn't the last clip in the track.
if (fabs(t0 - clip->GetEndTime()) < WAVETRACK_MERGE_POINT_TOLERANCE) {
if (i < clips.GetCount() - 1) {
MergeClips(GetClipIndex(clip), GetClipIndex(clips[i + 1]));
wxASSERT(MergeClips(GetClipIndex(clip), GetClipIndex(clips[i + 1])));
}
break;
}
@ -638,8 +638,7 @@ bool WaveTrack::ClearAndPaste(double t0, // Start of time to clear
}
// If we created a default time warper, we need to delete it
if (effectWarper == NULL)
delete warper;
delete warper;
return true;
}
@ -814,6 +813,7 @@ bool WaveTrack::SyncLockAdjust(double oldT1, double newT1)
if (!ret) return false;
ret = Paste(newT1, tmp);
wxASSERT(ret);
delete tmp;
}
@ -828,9 +828,9 @@ bool WaveTrack::SyncLockAdjust(double oldT1, double newT1)
if (!f) return false;
WaveTrack *tmp = f->NewWaveTrack(GetSampleFormat(), GetRate());
tmp->InsertSilence(0.0, newT1 - oldT1);
wxASSERT(tmp->InsertSilence(0.0, newT1 - oldT1));
tmp->Flush();
Paste(oldT1, tmp);
wxASSERT(Paste(oldT1, tmp));
delete tmp;
}
}
@ -846,18 +846,13 @@ bool WaveTrack::Paste(double t0, Track *src)
{
bool editClipCanMove = true;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove);
//printf("paste: entering WaveTrack::Paste\n");
// JKC Added...
if( src == NULL )
return false;
if (src->GetKind() != Track::Wave)
return false;
//printf("paste: we have a wave track\n");
WaveTrack* other = (WaveTrack*)src;
//
@ -902,7 +897,7 @@ bool WaveTrack::Paste(double t0, Track *src)
if (!IsEmpty(t0, GetEndTime())) {
Track *tmp = NULL;
Cut(t0, GetEndTime()+1.0/mRate, &tmp);
Paste(t0 + insertDuration, tmp);
wxASSERT(Paste(t0 + insertDuration, tmp));
delete tmp;
}
} else
@ -1206,12 +1201,12 @@ bool WaveTrack::Join(double t0, double t1)
if (clip->GetOffset() - t > (1.0 / mRate)) {
double addedSilence = (clip->GetOffset() - t);
//printf("Adding %.6f seconds of silence\n");
newClip->InsertSilence(t, addedSilence);
wxASSERT(newClip->InsertSilence(t, addedSilence));
t += addedSilence;
}
//printf("Pasting at %.6f\n", t);
newClip->Paste(t, clip);
wxASSERT(newClip->Paste(t, clip));
t = newClip->GetEndTime();
mClips.DeleteObject(clip);
@ -2114,6 +2109,7 @@ bool WaveTrack::MergeClips(int clipidx1, int clipidx2)
WaveClip* clip1 = GetClipByIndex(clipidx1);
WaveClip* clip2 = GetClipByIndex(clipidx2);
wxASSERT(clip2);
if(clip2 == NULL) // could happen if one track of a linked pair had a split and the other didn't
return false;

View File

@ -264,11 +264,10 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
// Take the output track and insert it in place of the original
// sample data
double newLength = outputTrack->GetEndTime();
if (bLoopSuccess) {
SetTimeWarper(new LinearTimeWarper(
mCurT0, mCurT0, mCurT1, mCurT0 + newLength ));
track->ClearAndPaste(mCurT0, mCurT1, outputTrack, true, false,
GetTimeWarper());
if (bLoopSuccess)
{
SetTimeWarper(new LinearTimeWarper(mCurT0, mCurT0, mCurT1, mCurT0 + newLength));
wxASSERT(track->ClearAndPaste(mCurT0, mCurT1, outputTrack, true, false, GetTimeWarper()));
}
if (newLength > mMaxNewLength)

View File

@ -189,7 +189,7 @@ void Effect::GetSamples(WaveTrack *track, sampleCount *start, sampleCount *len)
t1 = t0 + mLength;
if (mT0 == mT1) {
// Not really part of the calculation, but convenient to put here
track->InsertSilence(t0, t1);
wxASSERT(track->InsertSilence(t0, t1));
}
}

View File

@ -531,7 +531,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
if(toClipOutput)
{
//put the processed audio in
t->Paste(clipStartEndTimes[i].first,toClipOutput);
wxASSERT(t->Paste(clipStartEndTimes[i].first,toClipOutput));
//if the clip was only partially selected, the Paste will have created a split line. Join is needed to take care of this
//This is not true when the selection is fully contained within one clip (second half of conditional)
if( (clipRealStartEndTimes[i].first != clipStartEndTimes[i].first ||
@ -1020,7 +1020,7 @@ void EqualizationDialog::LoadCurves(wxString fileName, bool append)
{
// Inform user of load failure
wxMessageBox( reader.GetErrorStr(),
_("Error loading EQ curve"),
_("ErrorLoading EQ Curve"),
wxOK | wxCENTRE,
this );
}
@ -1085,7 +1085,7 @@ void EqualizationDialog::SaveCurves(wxString fileName)
wxMessageBox(wxString::Format(
_("Couldn't write to file \"%s\": %s"),
fn.GetFullPath().c_str(), pException->GetMessage().c_str()),
_("Error saving equalization curves"), wxICON_ERROR, this);
_("Error Saving Equalization Curves"), wxICON_ERROR, this);
delete pException;
}

View File

@ -708,7 +708,7 @@ bool EffectNoiseRemoval::ProcessOne(int count, WaveTrack * track,
double tLen = mOutputTrack->LongSamplesToTime(len);
// Filtering effects always end up with more data than they started with. Delete this 'tail'.
mOutputTrack->HandleClear(tLen, mOutputTrack->GetEndTime(), false, false);
track->ClearAndPaste(t0, t0 + tLen, mOutputTrack, true, false);
wxASSERT(track->ClearAndPaste(t0, t0 + tLen, mOutputTrack, true, false));
}
// Delete the outputTrack now that its data is inserted in place

View File

@ -363,13 +363,14 @@ bool EffectSBSMS::Process()
if(rightTrack)
rb.outputRightTrack->Flush();
leftTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputLeftTrack,
true, false, GetTimeWarper());
wxASSERT(leftTrack->ClearAndPaste(
mCurT0, mCurT1, rb.outputLeftTrack,
true, false, GetTimeWarper()));
if(rightTrack) {
rightTrack->ClearAndPaste(mCurT0, mCurT1, rb.outputRightTrack,
true, false, GetTimeWarper());
}
if(rightTrack)
wxASSERT(rightTrack->ClearAndPaste(
mCurT0, mCurT1, rb.outputRightTrack,
true, false, GetTimeWarper()));
}
mCurTrackNum++;
}

View File

@ -56,17 +56,7 @@ bool EffectSilence::GenerateTrack(WaveTrack *tmp,
const WaveTrack &track,
int ntrack)
{
tmp->InsertSilence(0.0, mDuration);
return true;
const bool bResult = tmp->InsertSilence(0.0, mDuration);
wxASSERT(bResult);
return bResult;
}
// Indentation settings for Vim and Emacs and unique identifier for Arch, a
// version control system. Please do not modify past this point.
//
// Local Variables:
// c-basic-offset: 3
// indent-tabs-mode: nil
// End:
//
// vim: et sts=3 sw=3
// arch-tag: 78c8d521-815a-4fdb-830a-f9655cd4f529

View File

@ -96,7 +96,7 @@ bool EffectStereoToMono::ProcessOne(int count)
double minStart = wxMin(mLeftTrack->GetStartTime(), mRightTrack->GetStartTime());
mLeftTrack->Clear(mLeftTrack->GetStartTime(), mLeftTrack->GetEndTime());
mOutTrack->Flush();
mLeftTrack->Paste(minStart, mOutTrack);
wxASSERT(mLeftTrack->Paste(minStart, mOutTrack));
mLeftTrack->SetLinked(false);
mRightTrack->SetLinked(false);
mLeftTrack->SetChannel(Track::MonoChannel);

View File

@ -610,7 +610,7 @@ void VSTEffectDialog::OnLoad(wxCommandEvent & evt)
if (!reader.Parse(this, fn)) {
// Inform user of load failure
wxMessageBox(reader.GetErrorStr(),
_("Error loading program"),
_("Error Loading VST Program"),
wxOK | wxCENTRE,
this);
}

View File

@ -284,7 +284,7 @@ void KeyConfigPrefs::OnLoad(wxCommandEvent & e)
XMLFileReader reader;
if (!reader.Parse(mManager, file)) {
wxMessageBox(reader.GetErrorStr(),
_("Error loading keyboard shortcuts"),
_("Error Loading Keyboard Shortcuts"),
wxOK | wxCENTRE, this);
}
@ -323,7 +323,7 @@ void KeyConfigPrefs::OnSave(wxCommandEvent & e)
catch (XMLFileWriterException* pException)
{
wxMessageBox(_("Couldn't write to file: ") + file,
_("Error saving keyboard shortcuts"),
_("Error Saving Keyboard Shortcuts"),
wxOK | wxCENTRE, this);
delete pException;

View File

@ -856,7 +856,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
newTrack->InsertSilence(0.0, t0 - t1);
newTrack->Flush();
wt->Clear(t1, t0);
wt->Paste(t1, newTrack);
wxASSERT(wt->Paste(t1, newTrack));
delete newTrack;
}
newRecordingTracks.Add(wt);

View File

@ -326,7 +326,7 @@ XMLFileWriter::~XMLFileWriter()
void XMLFileWriter::Open(const wxString &name, const wxString &mode)
{
if (!wxFFile::Open(name, mode))
throw new XMLFileWriterException(_("Error opening file"));
throw new XMLFileWriterException(_("Error Opening File"));
}
void XMLFileWriter::Close()
@ -345,12 +345,12 @@ void XMLFileWriter::CloseWithoutEndingTags()
if (!wxFFile::Flush())
{
wxFFile::Close();
throw new XMLFileWriterException(_("Error flushing file"));
throw new XMLFileWriterException(_("Error Flushing File"));
}
// Note that this should never fail if flushing worked.
if (!wxFFile::Close())
throw new XMLFileWriterException(_("Error closing file"));
throw new XMLFileWriterException(_("Error Closing File"));
}
void XMLFileWriter::Write(const wxString &data)
@ -360,7 +360,7 @@ void XMLFileWriter::Write(const wxString &data)
// When writing fails, we try to close the file before throwing the
// exception, so it can at least be deleted.
wxFFile::Close();
throw new XMLFileWriterException(_("Error writing to file"));
throw new XMLFileWriterException(_("Error Writing to File"));
}
}