1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-24 16:01:16 +02:00

Addressing bug 454, and some minor clean-up. Now we only measure the selected track, and if one is selected, otherwise inform the user.

This commit is contained in:
martynshaw99 2012-01-11 00:39:13 +00:00
parent d28404a3b6
commit f708bc877c

View File

@ -117,17 +117,41 @@ float ContrastDialog::GetDB()
return 1234.0; return 1234.0;
} }
if(mT0 == mT1) if(mT0 == mT1)
{
wxMessageDialog m(NULL, _("Nothing to measure.\nPlease select a section of a track."), _("Error"), wxOK);
m.ShowModal();
return 1234.0; return 1234.0;
}
bool mSelected = false;
while(t) { while(t) {
// FIX-ME: This isn't quite right. if( ((WaveTrack *)t)->GetSelected() )
// What to do if more than one track selected? {
// Also what if tracks in selection are not wavetracks? if( mSelected == true ) // already measured one track
((WaveTrack *)t)->GetRMS(&rms, mT0, mT1); {
wxMessageDialog m(NULL, _("You can only measure one track at a time."), _("Error"), wxOK);
m.ShowModal();
return 1234.0;
}
else
{
((WaveTrack *)t)->GetRMS(&rms, mT0, mT1);
mSelected = true;
}
}
t = iter.Next(); t = iter.Next();
} }
if( rms < 1.0E-30 ) if( mSelected )
return -60.0; {
return 20.0*log10(rms); if( rms < 1.0E-30 )
return -60.0;
return 20.0*log10(rms);
}
else
{
wxMessageDialog m(NULL, _("Please select something to be measured."), _("Error"), wxOK);
m.ShowModal();
return 1234.0;
}
} }
double ContrastDialog::GetStartTime() double ContrastDialog::GetStartTime()