1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 07:43:54 +02:00

Dither.cpp and SampleFormat.cpp have fewer dependencies...

... Notably they longer depend indirectly on AudioIO.cpp (via QualityPrefs)

This frees nine files from dependency cycles
This commit is contained in:
Paul Licameli
2019-05-11 14:52:42 -04:00
parent d68db39b5c
commit 82f4948360
5 changed files with 63 additions and 57 deletions

View File

@@ -55,44 +55,6 @@ static EnumSetting formatSetting{
wxT("/SamplingRate/DefaultProjectSampleFormat"),
};
//////////
static const EnumValueSymbol choicesDither[] = {
{ XO("None") },
{ XO("Rectangle") },
{ XO("Triangle") },
{ XO("Shaped") },
};
static const size_t nChoicesDither = WXSIZEOF( choicesDither );
static const int intChoicesDither[] = {
(int) DitherType::none,
(int) DitherType::rectangle,
(int) DitherType::triangle,
(int) DitherType::shaped,
};
static_assert(
nChoicesDither == WXSIZEOF( intChoicesDither ),
"size mismatch"
);
static const size_t defaultFastDither = 0; // none
static EnumSetting fastDitherSetting{
wxT("Quality/DitherAlgorithmChoice"),
choicesDither, nChoicesDither, defaultFastDither,
intChoicesDither,
wxT("Quality/DitherAlgorithm")
};
static const size_t defaultBestDither = 3; // shaped
static EnumSetting bestDitherSetting{
wxT("Quality/HQDitherAlgorithmChoice"),
choicesDither, nChoicesDither, defaultBestDither,
intChoicesDither,
wxT("Quality/HQDitherAlgorithm")
};
//////////
BEGIN_EVENT_TABLE(QualityPrefs, PrefsPanel)
EVT_CHOICE(ID_SAMPLE_RATE_CHOICE, QualityPrefs::OnSampleRateChoice)
@@ -225,7 +187,7 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
/* i18n-hint: technical term for randomization to reduce undesirable resampling artifacts */
S.TieChoice(_("&Dither:"),
fastDitherSetting);
Dither::FastSetting);
}
S.EndMultiColumn();
}
@@ -240,7 +202,7 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
/* i18n-hint: technical term for randomization to reduce undesirable resampling artifacts */
S.TieChoice(_("Dit&her:"),
bestDitherSetting);
Dither::BestSetting);
}
S.EndMultiColumn();
}
@@ -287,13 +249,3 @@ sampleFormat QualityPrefs::SampleFormatChoice()
return (sampleFormat)formatSetting.ReadInt();
}
DitherType QualityPrefs::FastDitherChoice()
{
return (DitherType) fastDitherSetting.ReadInt();
}
DitherType QualityPrefs::BestDitherChoice()
{
return (DitherType) bestDitherSetting.ReadInt();
}

View File

@@ -41,9 +41,6 @@ class QualityPrefs final : public PrefsPanel
static sampleFormat SampleFormatChoice();
static DitherType FastDitherChoice();
static DitherType BestDitherChoice();
private:
void Populate();
void GetNamesAndLabels();