mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-22 07:10:06 +02:00
Bug2304: Export Mp3, Const or Var: shouldn't empty Quality choice
problem began at 5638d6844fb1dca563671e5ced1a916db974de34
This commit is contained in:
parent
836bc36536
commit
02dd7dc96b
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user