From 94016e1cde8ca0ec3e50f514b753b2e8c442bb26 Mon Sep 17 00:00:00 2001 From: Be Date: Tue, 9 Feb 2021 15:56:46 -0600 Subject: avoid symbol collision with fdk-aac This is just a quick hack. We should move all Mixxx code into the mixxx namespace. --- src/test/sampleutiltest.cpp | 8 ++++---- src/util/sample.cpp | 8 ++++---- src/util/types.h | 8 ++++---- src/vinylcontrol/vinylcontrolxwax.cpp | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/test/sampleutiltest.cpp b/src/test/sampleutiltest.cpp index 5bbf8eabb7..b890fef13c 100644 --- a/src/test/sampleutiltest.cpp +++ b/src/test/sampleutiltest.cpp @@ -255,15 +255,15 @@ TEST_F(SampleUtilTest, copy3WithGain) { TEST_F(SampleUtilTest, convertS16ToFloat32) { // Shorts are asymmetric, so SAMPLE_MAX is less than -SAMPLE_MIN. - const float expectedMax = static_cast(SAMPLE_MAX) / - static_cast(-SAMPLE_MIN); + const float expectedMax = static_cast(SAMPLE_MAXIMUM) / + static_cast(-SAMPLE_MINIMUM); for (int i = 0; i < buffers.size(); ++i) { CSAMPLE* buffer = buffers[i]; int size = sizes[i]; SAMPLE* s16 = new SAMPLE[size]; FillBuffer(buffer, 1.0f, size); for (int j = 0; j < size; ++j) { - s16[j] = SAMPLE_MAX; + s16[j] = SAMPLE_MAXIMUM; } SampleUtil::convertS16ToFloat32(buffer, s16, size); for (int j = 0; j < size; ++j) { @@ -279,7 +279,7 @@ TEST_F(SampleUtilTest, convertS16ToFloat32) { } FillBuffer(buffer, -1.0f, size); for (int j = 0; j < size; ++j) { - s16[j] = SAMPLE_MIN; + s16[j] = SAMPLE_MINIMUM; } SampleUtil::convertS16ToFloat32(buffer, s16, size); for (int j = 0; j < size; ++j) { diff --git a/src/util/sample.cpp b/src/util/sample.cpp index 3fbf46e088..390b976be9 100644 --- a/src/util/sample.cpp +++ b/src/util/sample.cpp @@ -369,8 +369,8 @@ void SampleUtil::convertS16ToFloat32(CSAMPLE* M_RESTRICT pDest, // SAMPLE_MIN = -32768 is a valid low sample, whereas SAMPLE_MAX = 32767 // is the highest valid sample. Note that this means that although some // sample values convert to -1.0, none will convert to +1.0. - DEBUG_ASSERT(-SAMPLE_MIN >= SAMPLE_MAX); - const CSAMPLE kConversionFactor = -SAMPLE_MIN; + DEBUG_ASSERT(-SAMPLE_MINIMUM >= SAMPLE_MAXIMUM); + const CSAMPLE kConversionFactor = -SAMPLE_MINIMUM; // note: LOOP VECTORIZED. for (SINT i = 0; i < numSamples; ++i) { pDest[i] = CSAMPLE(pSrc[i]) / kConversionFactor; @@ -380,8 +380,8 @@ void SampleUtil::convertS16ToFloat32(CSAMPLE* M_RESTRICT pDest, //static void SampleUtil::convertFloat32ToS16(SAMPLE* pDest, const CSAMPLE* pSrc, SINT numSamples) { - DEBUG_ASSERT(-SAMPLE_MIN >= SAMPLE_MAX); - const CSAMPLE kConversionFactor = -SAMPLE_MIN; + DEBUG_ASSERT(-SAMPLE_MINIMUM >= SAMPLE_MAXIMUM); + const CSAMPLE kConversionFactor = -SAMPLE_MINIMUM; // note: LOOP VECTORIZED only with "int i" for (int i = 0; i < numSamples; ++i) { pDest[i] = SAMPLE(pSrc[i] * kConversionFactor); diff --git a/src/util/types.h b/src/util/types.h index cc1ded5db5..320cc147bc 100644 --- a/src/util/types.h +++ b/src/util/types.h @@ -16,19 +16,19 @@ typedef std::ptrdiff_t SINT; // range [SHRT_MIN, SHRT_MAX]. typedef short int SAMPLE; constexpr SAMPLE SAMPLE_ZERO = 0; -constexpr SAMPLE SAMPLE_MIN = SHRT_MIN; -constexpr SAMPLE SAMPLE_MAX = SHRT_MAX; +constexpr SAMPLE SAMPLE_MINIMUM = SHRT_MIN; +constexpr SAMPLE SAMPLE_MAXIMUM = SHRT_MAX; // Limits the range of a SAMPLE value to [SAMPLE_MIN, SAMPLE_MAX]. inline SAMPLE SAMPLE_clamp(SAMPLE in) { - return math_clamp(in, SAMPLE_MIN, SAMPLE_MAX); + return math_clamp(in, SAMPLE_MINIMUM, SAMPLE_MAXIMUM); } // Limits the range of a SAMPLE value to [-SAMPLE_MAX, SAMPLE_MAX]. inline SAMPLE SAMPLE_clampSymmetric(SAMPLE in) { - return math_clamp(in, static_cast(-SAMPLE_MAX), SAMPLE_MAX); + return math_clamp(in, static_cast(-SAMPLE_MAXIMUM), SAMPLE_MAXIMUM); } // 32-bit single precision floating-point sample data diff --git a/src/vinylcontrol/vinylcontrolxwax.cpp b/src/vinylcontrol/vinylcontrolxwax.cpp index 2919d6642b..70b61ee03d 100644 --- a/src/vinylcontrol/vinylcontrolxwax.cpp +++ b/src/vinylcontrol/vinylcontrolxwax.cpp @@ -21,7 +21,7 @@ constexpr int kChannels = 2; } // namespace // Sample threshold below which we consider there to be no signal. -const double kMinSignal = 75.0 / SAMPLE_MAX; +const double kMinSignal = 75.0 / SAMPLE_MAXIMUM; bool VinylControlXwax::s_bLUTInitialized = false; QMutex VinylControlXwax::s_xwaxLUTMutex; @@ -208,12 +208,12 @@ void VinylControlXwax::analyzeSamples(CSAMPLE* pSamples, size_t nFrames) { // Convert CSAMPLE samples to shorts, preventing overflow. for (int i = 0; i < static_cast(samplesSize); ++i) { - CSAMPLE sample = pSamples[i] * gain * SAMPLE_MAX; + CSAMPLE sample = pSamples[i] * gain * SAMPLE_MAXIMUM; - if (sample > SAMPLE_MAX) { - m_pWorkBuffer[i] = SAMPLE_MAX; - } else if (sample < SAMPLE_MIN) { - m_pWorkBuffer[i] = SAMPLE_MIN; + if (sample > SAMPLE_MAXIMUM) { + m_pWorkBuffer[i] = SAMPLE_MAXIMUM; + } else if (sample < SAMPLE_MINIMUM) { + m_pWorkBuffer[i] = SAMPLE_MINIMUM; } else { m_pWorkBuffer[i] = static_cast(sample); } -- cgit v1.2.3