mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-16 17:41:14 +01:00
Bug2304: Export Mp3, Const or Var: shouldn't empty Quality choice
problem began at 5638d6844f
This commit is contained in:
@@ -451,6 +451,7 @@ int ValidateValue( int nValues, int value, int defaultValue )
|
||||
{
|
||||
return (value >= 0 && value < nValues) ? value : defaultValue;
|
||||
}
|
||||
|
||||
int ValidateValue( const std::vector<int> &values, int value, int defaultValue )
|
||||
{
|
||||
auto start = values.begin(), finish = values.end(),
|
||||
@@ -458,6 +459,13 @@ int ValidateValue( const std::vector<int> &values, int value, int defaultValue )
|
||||
return ( iter != finish ) ? value : defaultValue;
|
||||
}
|
||||
|
||||
int ValidateIndex( const std::vector<int> &values, int value, int defaultIndex )
|
||||
{
|
||||
auto start = values.begin(), finish = values.end(),
|
||||
iter = std::find( start, finish, value );
|
||||
return ( iter != finish ) ? static_cast<int>( iter - start ) : defaultIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///
|
||||
@@ -488,7 +496,7 @@ void ExportMP3Options::OnABR(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
LoadNames(fixRateNames);
|
||||
|
||||
mRate->SetSelection(ValidateValue(fixRateValues, mAbrRate, 10));
|
||||
mRate->SetSelection(ValidateIndex(fixRateValues, mAbrRate, 10));
|
||||
mRate->Refresh();
|
||||
mMode->Enable(false);
|
||||
}
|
||||
@@ -499,7 +507,7 @@ void ExportMP3Options::OnCBR(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
LoadNames(fixRateNames);
|
||||
|
||||
mRate->SetSelection(ValidateValue(fixRateValues, mCbrRate, 10));
|
||||
mRate->SetSelection(ValidateIndex(fixRateValues, mCbrRate, 10));
|
||||
mRate->Refresh();
|
||||
mMode->Enable(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user