Make enum class for dither type
This commit is contained in:
parent
bccf8f92cd
commit
a3d12e1658
|
@ -325,17 +325,17 @@ void Dither::Apply(enum DitherType ditherType,
|
|||
// We must do dithering
|
||||
switch (ditherType)
|
||||
{
|
||||
case none:
|
||||
case DitherType::none:
|
||||
DITHER(NoDither, dest, destFormat, destStride, source, sourceFormat, sourceStride, len);
|
||||
break;
|
||||
case rectangle:
|
||||
case DitherType::rectangle:
|
||||
DITHER(RectangleDither, dest, destFormat, destStride, source, sourceFormat, sourceStride, len);
|
||||
break;
|
||||
case triangle:
|
||||
case DitherType::triangle:
|
||||
Reset(); // reset dither filter for this NEW conversion
|
||||
DITHER(TriangleDither, dest, destFormat, destStride, source, sourceFormat, sourceStride, len);
|
||||
break;
|
||||
case shaped:
|
||||
case DitherType::shaped:
|
||||
Reset(); // reset dither filter for this NEW conversion
|
||||
DITHER(ShapedDither, dest, destFormat, destStride, source, sourceFormat, sourceStride, len);
|
||||
break;
|
||||
|
|
|
@ -13,15 +13,16 @@
|
|||
#include "SampleFormat.h"
|
||||
|
||||
|
||||
/// These ditherers are currently available:
|
||||
enum class DitherType : unsigned {
|
||||
none = 0, rectangle = 1, triangle = 2, shaped = 3 };
|
||||
|
||||
class Dither
|
||||
{
|
||||
public:
|
||||
/// Default constructor
|
||||
Dither();
|
||||
|
||||
/// These ditherers are currently available:
|
||||
enum DitherType { none = 0, rectangle = 1, triangle = 2, shaped = 3};
|
||||
|
||||
/// Reset state of the dither.
|
||||
void Reset();
|
||||
|
||||
|
|
|
@ -45,18 +45,18 @@
|
|||
#include "Dither.h"
|
||||
#include "Internat.h"
|
||||
|
||||
static Dither::DitherType gLowQualityDither = Dither::none;
|
||||
static Dither::DitherType gHighQualityDither = Dither::none;
|
||||
static DitherType gLowQualityDither = DitherType::none;
|
||||
static DitherType gHighQualityDither = DitherType::none;
|
||||
static Dither gDitherAlgorithm;
|
||||
|
||||
void InitDitherers()
|
||||
{
|
||||
// Read dither preferences
|
||||
gLowQualityDither = (Dither::DitherType)
|
||||
gPrefs->Read(wxT("/Quality/DitherAlgorithm"), (long)Dither::none);
|
||||
gLowQualityDither = (DitherType)
|
||||
gPrefs->Read(wxT("/Quality/DitherAlgorithm"), (long)DitherType::none);
|
||||
|
||||
gHighQualityDither = (Dither::DitherType)
|
||||
gPrefs->Read(wxT("/Quality/HQDitherAlgorithm"), (long)Dither::shaped);
|
||||
gHighQualityDither = (DitherType)
|
||||
gPrefs->Read(wxT("/Quality/HQDitherAlgorithm"), (long)DitherType::shaped);
|
||||
}
|
||||
|
||||
const wxChar *GetSampleFormatStr(sampleFormat format)
|
||||
|
@ -120,6 +120,6 @@ void CopySamplesNoDither(samplePtr src, sampleFormat srcFormat,
|
|||
unsigned int dstStride /* = 1 */)
|
||||
{
|
||||
gDitherAlgorithm.Apply(
|
||||
Dither::none,
|
||||
DitherType::none,
|
||||
src, srcFormat, dst, dstFormat, len, srcStride, dstStride);
|
||||
}
|
||||
|
|
|
@ -98,10 +98,10 @@ void QualityPrefs::Populate()
|
|||
void QualityPrefs::GetNamesAndLabels()
|
||||
{
|
||||
//------------ Dither Names
|
||||
mDitherNames.Add(_("None")); mDitherLabels.push_back(Dither::none);
|
||||
mDitherNames.Add(_("Rectangle")); mDitherLabels.push_back(Dither::rectangle);
|
||||
mDitherNames.Add(_("Triangle")); mDitherLabels.push_back(Dither::triangle);
|
||||
mDitherNames.Add(_("Shaped")); mDitherLabels.push_back(Dither::shaped);
|
||||
mDitherNames.Add(_("None")); mDitherLabels.push_back((int) DitherType::none);
|
||||
mDitherNames.Add(_("Rectangle")); mDitherLabels.push_back((int) DitherType::rectangle);
|
||||
mDitherNames.Add(_("Triangle")); mDitherLabels.push_back((int) DitherType::triangle);
|
||||
mDitherNames.Add(_("Shaped")); mDitherLabels.push_back((int) DitherType::shaped);
|
||||
|
||||
//------------ Sample Rate Names
|
||||
// JKC: I don't understand the following comment.
|
||||
|
@ -179,7 +179,7 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||
/* i18n-hint: technical term for randomization to reduce undesirable resampling artifacts */
|
||||
S.TieChoice(_("&Dither:"),
|
||||
wxT("/Quality/DitherAlgorithm"),
|
||||
Dither::none,
|
||||
(int) DitherType::none,
|
||||
mDitherNames,
|
||||
mDitherLabels);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||
/* i18n-hint: technical term for randomization to reduce undesirable resampling artifacts */
|
||||
S.TieChoice(_("Dit&her:"),
|
||||
wxT("/Quality/HQDitherAlgorithm"),
|
||||
Dither::shaped,
|
||||
(int) DitherType::shaped,
|
||||
mDitherNames,
|
||||
mDitherLabels);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
class ShuttleGui;
|
||||
enum sampleFormat : unsigned;
|
||||
enum class DitherType : unsigned;
|
||||
|
||||
class QualityPrefs final : public PrefsPanel
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue