mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-28 00:55:50 +01:00
Rewrite AddChoice and TieChoice calls...
... either lifting or inlining array-of-string computations, so fewer statements are mixed among ShuttleGui method calls
This commit is contained in:
@@ -1003,6 +1003,8 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
|
||||
ShuttleGui S(&d, eIsCreating);
|
||||
wxString text;
|
||||
|
||||
int selected = -1;
|
||||
|
||||
S.StartVerticalLay();
|
||||
{
|
||||
S.SetBorder(10);
|
||||
@@ -1022,30 +1024,26 @@ int ExportFFmpeg::AskResample(int bitrate, int rate, int lowrate, int highrate,
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
|
||||
wxArrayStringEx choices;
|
||||
int selected = -1;
|
||||
for (int i = 0; sampRates[i] > 0; i++)
|
||||
{
|
||||
int label = sampRates[i];
|
||||
if (label >= lowrate && label <= highrate)
|
||||
{
|
||||
wxString name = wxString::Format(wxT("%d"),label);
|
||||
choices.push_back(name);
|
||||
if (label <= rate)
|
||||
{
|
||||
selected = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selected == -1)
|
||||
selected = 0;
|
||||
|
||||
S.StartHorizontalLay(wxALIGN_CENTER, false);
|
||||
{
|
||||
choice = S.AddChoice(_("Sample Rates"),
|
||||
choices,
|
||||
selected);
|
||||
[&]{
|
||||
wxArrayStringEx choices;
|
||||
for (int i = 0; sampRates[i] > 0; i++)
|
||||
{
|
||||
int label = sampRates[i];
|
||||
if (label >= lowrate && label <= highrate)
|
||||
{
|
||||
wxString name = wxString::Format(wxT("%d"),label);
|
||||
choices.push_back(name);
|
||||
if (label <= rate)
|
||||
selected = i;
|
||||
}
|
||||
}
|
||||
return choices;
|
||||
}(),
|
||||
std::max( 0, selected )
|
||||
);
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user