MCPcopy Create free account
hub / github.com/audacity/audacity / AskResample

Method AskResample

modules/import-export/mod-ffmpeg/ExportFFmpeg.cpp:1740–1831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1738//----------------------------------------------------------------------------
1739
1740int FFmpegExporter::AskResample(int bitrate, int rate, int lowrate, int highrate, const int *sampRates)
1741{
1742#if defined(FFMPEG_AUTO_RESAMPLE)
1743 std::vector<int> rates;
1744
1745 for (int i = 0; sampRates[i]; ++i)
1746 {
1747 rates.push_back(sampRates[i]);
1748 }
1749
1750 std::sort(rates.begin(), rates.end());
1751
1752 int bestRate = 0;
1753 for (auto i : rates)
1754 {
1755 bestRate = i;
1756 if (i > rate)
1757 {
1758 break;
1759 }
1760 }
1761
1762 return bestRate;
1763#else
1764 wxDialogWrapper d(nullptr, wxID_ANY, XO("Invalid sample rate"));
1765 d.SetName();
1766 wxChoice *choice;
1767 ShuttleGui S(&d, eIsCreating);
1768
1769 int selected = -1;
1770
1771 S.StartVerticalLay();
1772 {
1773 S.SetBorder(10);
1774 S.StartStatic(XO("Resample"));
1775 {
1776 S.StartHorizontalLay(wxALIGN_CENTER, false);
1777 {
1778 S.AddTitle(
1779 (bitrate == 0
1780 ? XO(
1781"The project sample rate (%d) is not supported by the current output\nfile format. ")
1782 .Format( rate )
1783 : XO(
1784"The project sample rate (%d) and bit rate (%d kbps) combination is not\nsupported by the current output file format. ")
1785 .Format( rate, bitrate/1000))
1786 + XO("You may resample to one of the rates below.")
1787 );
1788 }
1789 S.EndHorizontalLay();
1790
1791 S.StartHorizontalLay(wxALIGN_CENTER, false);
1792 {
1793 choice = S.AddChoice(XO("Sample Rates"),
1794 [&]{
1795 TranslatableStrings choices;
1796 for (int i = 0; sampRates[i] > 0; i++)
1797 {

Callers

nothing calls this directly

Calls 14

VerbatimFunction · 0.85
maxFunction · 0.85
StartStaticMethod · 0.80
AddChoiceMethod · 0.80
EndStaticMethod · 0.80
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SetNameMethod · 0.45
AddTitleMethod · 0.45
LayoutMethod · 0.45
FitMethod · 0.45

Tested by

no test coverage detected